|
Declares a PDF 1.3+ DeviceN colour space backed by N user-supplied spot inks (ISO 32000-1 8.6.6.5). Generalises RegisterSeparation from one colorant to many: six-colour printing, metallic / fluorescent inks, custom PDF/X ink mixes, or any N-channel ink set.
Delphi 语法:
function RegisterDeviceN(const ColorantNames: array of AnsiString; const AlternateCS: AnsiString; const TintC1Matrix: array of Extended): AnsiString;
C++ 语法:
AnsiString RegisterDeviceN(const AnsiString* ColorantNames, int ColorantNameCount, const AnsiString& AlternateCS, const Extended* TintC1Matrix, int TintC1MatrixCount);
说明
DeviceN 接收 N 个位于 [0..1] 的 tint 操作数,每个色料一个,并使用 HotPDF 在内部构建的、作为 PostScript 计算器 Function Type 4 的线性加权混合 tint 变换,计算 M 个输出分量(位于 AlternateCS 中)。通道 m 的输出是所有色料 n 的 tint[n] * TintC1Matrix[n*M + m] 之和,并由渲染管线钳位到 [0..1]
ColorantNames - N 个油墨名称的数组。每个条目按 PDF 名称写出;依 PDF 1.7 7.3.5,空格转义为 #20。特殊名称 'None' 标记未使用的着色剂槽位。名称列表定义了所得色彩空间的 N 个输入维度。
AlternateCS - 'DeviceGray' (M = 1), 'DeviceRGB' (M = 3), or 'DeviceCMYK' (M = 4). Any other value raises an exception.
TintC1Matrix - 按行优先排列的 N * M Extended 数组。第 n 行第 m 列,是色料 n 对 AlternateCS 通道 m 的贡献,前提是该色料满强度(tint[n] = 1.0)、其余 tint 均为零。长度必须恰好等于 Length(ColorantNames) * M
返回值:自动生成的名称(DevN1、DevN2 等)。当 StrictVersionLock 开启且当前 Version 低于 PDF 1.3 时返回空字符串(否则文档版本自动升到 1.3)。
代码示例
// 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 过滤器支持
|