TPDFICCComponentTransform

颜色管理

描述

TPDFICCComponentTransform 借助可选的 LittleCMS 2 运行时在两个 ICC profile 之间转换完整的分量元组。它支持 GRAY、RGB、CMYK、CMY、Lab、XYZ 与 N 通道 profile,保留每个输出通道,工作在 0 到 1 的单位区间。

每个实例加载自己的库句柄、CMM 上下文、profile 与变换。环境问题不会在构造时抛出:调用 Transform 前先检查 Valid 并读取 LastError。

InputComponents 与 OutputComponents 报告源与目标的通道数;BackendVersion 报告编码后的 LittleCMS 版本。

语法

Delphi

TPDFICCComponentTransform = class
  Public
    constructor Create(const SourceProfile, TargetProfile: AnsiString;
      RenderingIntent: Integer = 1; BlackPointCompensation: Boolean = False;
      const LibraryFileName: AnsiString = '');
    destructor Destroy; override;
    function Transform(const Samples: array of Double;
      var Converted: TPLICCComponentValues): Boolean;
    property Valid: Boolean read FValid;
    property InputComponents: Integer read FInputComponents;
    property OutputComponents: Integer read FOutputComponents;
    property BackendVersion: Integer read FVersion;
    property LastError: AnsiString read FErrorText;
  end;

字段

Create构造函数:接收原始源与目标 profile 字节、0 到 3 的渲染意向、黑点补偿标志以及可选的库路径
Transform转换交错的源元组;失败时返回 False 并清空目标数组
Valid仅当库、两个 profile 与变换都就绪时为 True
InputComponents源通道数,1 到 15
OutputComponents目标通道数,1 到 15
BackendVersion已加载的 LittleCMS 运行时报告的编码版本
LastError最近一次构造或转换失败的英文诊断信息
Destroy释放变换、profile、CMM 上下文与库句柄

备注

源或目标 profile 为空时选用 CMM 的标准 sRGB profile。

非空 profile 至少 132 字节、不超过 16 MiB,偏移 36 处须有 acsp 签名,且声明的大小不得超过实际提供的字节数。

构造只接受 0 到 3 的渲染意向;其他取值会使 Valid 为 false 并设置 LastError。

Transform 把有限输入样本夹到单位区间,转换前拒绝 NaN 和无穷大,并在校验其他内容之前先清空 Converted。

句柄、上下文、profile 与变换都不共享,因此每个并发调用方要各用一个实例。

另请参阅

Transform, ICCComponentTransforms, ICCProfileComponents, ICCBasedRendering