THotPDF.RegisterLabColorSpace Method

 

THotPDF.RegisterLabColorSpace

THotPDF

 

Top

Registers a PDF 1.3 CIELab colour space (ISO 32000-1 8.6.5.3) under an auto-generated resource name (Lab1, Lab2, ...). Use the returned name with THPDFPage.SetFillColorSpace / SetStrokeColorSpace followed by SetFillColor / SetStrokeColor passing the three L*a*b* components.

 

Delphi syntax:

function RegisterLabColorSpace(WhitePointX, WhitePointY, WhitePointZ: Single; RangeAMin, RangeAMax, RangeBMin, RangeBMax: Single): AnsiString;

 

C++ syntax:

AnsiString RegisterLabColorSpace(float WhitePointX, float WhitePointY, float WhitePointZ, float RangeAMin, float RangeAMax, float RangeBMin, float RangeBMax);

 

Description

The CIELab colour space describes colours independently of any display or printing device: L* expresses lightness in [0..100], a* the green/red axis, b* the blue/yellow axis (typically [-128..127]). Conforming PDF viewers convert L*a*b* to device colour using the configured WhitePoint illuminant. Common illuminants:

 

D50  - ICC print standard. WhitePoint = [0.9505, 1.0, 1.089].

D65  - sRGB / display standard. WhitePoint = [0.95047, 1.0, 1.08883].

 

WhitePoint Y must equal 1.0 per spec table 64; X and Z must be positive. Passing all four Range parameters as zero falls back to the spec's implicit default [-100 100 -100 100]; pass any non-zero combination to override.

 

Return value: an auto-generated resource name (Lab1, Lab2, ...). Returns the empty string when StrictVersionLock is on and the active Version is below PDF 1.3 (otherwise the version is auto-bumped to 1.3).

 

Code Example

// Register a D50 Lab space for print, paint a magenta swatch.
var
  CSName: AnsiString;
begin
  HPDF.Version := pdf14;
  HPDF.BeginDoc;
  CSName := HPDF.RegisterLabColorSpace(
    0.9505, 1.0, 1.089,        // D50 WhitePoint
    -128, 127, -128, 127);     // standard a* and b* range
  HPDF.CurrentPage.SetFillColorSpace(CSName);
  HPDF.CurrentPage.SetFillColor([50.0, 60.0, -50.0]);  // L* a* b*
  HPDF.CurrentPage.Rectangle(60, 60, 200, 100);
  HPDF.CurrentPage.Fill;
  HPDF.EndDoc;
end;

 

See Also

Version, Compression, PDF Filter Support