THotPDF.RegisterLabColorSpace Method

 

THotPDF.RegisterLabColorSpace

THotPDF

 

傳回頂部

在自動產生的 resource name(Lab1、Lab2、...)下註冊 PDF 1.3 CIELab color space (ISO 32000-1 8.6.5.3)。請將傳回的 name 搭配 THPDFPage.SetFillColorSpace / SetStrokeColorSpace 使用,接著以三個 L*a*b* components 呼叫 SetFillColor / SetStrokeColorLab1, Lab2, ...). Use the returned name with THPDFPage.SetFillColorSpace / SetStrokeColorSpace followed by SetFillColor / SetStrokeColor passing the three L*a*b* components.

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

 

說明

CIELab color space 會以不依賴任何 display 或 printing device 的方式描述色彩:L* 代表 [0..100] 中的 lightness,a* 是 green/red axis,b* 是 blue/yellow axis(通常為 [-128..127])。符合規範的 PDF viewers 會使用設定的 WhitePoint illuminant 將 L*a*b* 轉換為 device color。常見 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.

 

傳回值: 自動產生的 resource name(Lab1、Lab2、...)。當 StrictVersionLock 啟用且目前 Version 低於 PDF 1.3 時會傳回空字串;否則 version 會自動提升到 1.3

 

 

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;

 

請參閱

Version, Compression, PDF 篩選器支援