THotPDF.RegisterDeviceN Method

 

THotPDF.RegisterDeviceN

THotPDF

 

傳回頂部

Declares a PDF 1.3+ DeviceN color space backed by N user-supplied spot inks (ISO 32000-1 8.6.6.5). Generalises RegisterSeparation from one colorant to many: six-color printing, metallic / fluorescent inks, custom PDF/X ink mixes, or any N-channel ink set.

 

Delphi 語法:

ColorantNames - N 個 ink names 的 array。每個 entry 會寫為 PDF name;spaces 依 PDF 1.7 7.3.5 escape 為 #20。special name 'None' 會標記 unused colorant slot。name list 定義 resulting color space 的 N 個 input dimensions

 

C++ 語法:

AnsiString RegisterDeviceN(const AnsiString* ColorantNames, int ColorantNameCount, const AnsiString& AlternateCS, const Extended* TintC1Matrix, int TintC1MatrixCount);

 

說明

DeviceN 會接受 N 個位於 [0..1] 的 tint operands,每個 colorant 一個,並使用 HotPDF 在內部建立為 PostScript-calculator Function Type 4 的 linear weighted-blend tint transform,在 AlternateCS 中計算 M 個 output components。channel m 的輸出是所有 colorants n 的 tint[n] * TintC1Matrix[n*M + m] 加總,並由 rendering pipeline clamp 到 [0..1][0..1]、每個色版一個,並以線性加權混合 tint 轉換計算 AlternateCS 的 M 個輸出分量;該轉換由 HotPDF 內部建構為 PostScript calculator Function Type 4。通道 m 的輸出是所有色版 n 的 tint[n] * TintC1Matrix[n*M + m] 總和,並限制在 [0..1]

 

ColorantNames - N 個 ink names 的 array。每個 entry 會寫為 PDF name;spaces 依 PDF 1.7 7.3.5 escape 為 #20。special name 'None' 會標記 unused colorant slot。name list 定義 resulting color space 的 N 個 input dimensions

AlternateCS - 'DeviceGray' (M = 1), 'DeviceRGB' (M = 3), or 'DeviceCMYK' (M = 4). Any other value raises an exception.

TintC1Matrix - row-major N * M Extended array。Row n、column m 是 colorant n 在 full strength(tint[n] = 1.0)且其他 tints 全為 zero 時,對 AlternateCS channel m 的 contribution。Length 必須正好是 Length(ColorantNames) * M

 

傳回值: 自動產生的 name(DevN1、DevN2、...)。當 StrictVersionLock 啟用且目前 Version 低於 PDF 1.3 時會傳回空字串;否則檔案版本會自動提升到 1.3DevN1、DevN2 ...)。StrictVersionLock 生效時回傳空字串

 

Code Example

// Two-colorant DeviceN over DeviceRGB. Colorant 0 ('Red') is pure
// red at full strength, colorant 1 ('Blue') is pure blue. Mixing
// (0.5, 0.5) yields a 50/50 blend; (1, 1) saturates to magenta
var
  CSName: AnsiString;
  Mat: array[0..5] of Extended;
begin
  HPDF.Version := pdf14;
  HPDF.BeginDoc;
  Mat[0] := 1.0; Mat[1] := 0.0; Mat[2] := 0.0;  // Red row     -> (1, 0, 0)
  Mat[3] := 0.0; Mat[4] := 0.0; Mat[5] := 1.0;  // Blue row    -> (0, 0, 1)
  CSName := HPDF.RegisterDeviceN(
    ['Red', 'Blue'], 'DeviceRGB', Mat);
  HPDF.CurrentPage.SetFillColorSpace(CSName);
  HPDF.CurrentPage.SetFillColor([0.5, 0.5]);   // mid-purple
  HPDF.CurrentPage.Rectangle(60, 60, 200, 100);
  HPDF.CurrentPage.Fill;
  HPDF.EndDoc;
end;

 

請參閱

RegisterSeparation, RegisterLabColorSpace, Version, PDF 篩選器支援