CreatePdfLittleCmsColourTransform implements IPdfColourTransform for buffers of original Gray, RGB, CMYK, ICCBased and PCS Lab components, including those supplied by the document colour-conversion helper
Give the absolute path of a library built for the process architecture; it must export the LittleCMS 2 cdecl API, which the supplied build helper produces from the MIT-licensed LittleCMS 2.19 source
A DLL built with Microsoft's stdcall configuration cannot be used by the Win32 provider; undecorated export names are insufficient to establish the calling convention
On failure, TryCreatePdfLittleCmsColourTransform returns dependency diagnostics with a nil transform and leaves the process search path as it was
Calls own their native contexts, profiles and transforms individually; sharing the provider is supported, provided sample buffers remain unchanged throughout each call
Sample buffers pack complete pixels without gaps, using 1, 3 or 4 components as 8-bit bytes or native-endian 16-bit unsigned words; the document helper converts PDF big-endian image samples before passing them here
DeviceRGB without a profile uses sRGB, and unprofiled DeviceGray uses a D50 gamma-2.2 profile; DeviceCMYK and ICCBased need an explicit source ICC profile, whose data colour space must agree with its declared component count
The base Transform method takes a pcsLab source buffer that feeds the ICC v4 PCS Lab connection without any profile bytes: exactly three 16-bit components, encoded as L*655.35 and (a+128)*257, with white mapped onto the D50 PCS; any other bit depth, component count or attached profile bytes raises EPdfColourBackendError
Since v3.312.0, query IPdfColourFloatTransform for TransformFloat: the source must be pcsLab with three 32-bit native-endian IEEE 754 Single components, holding finite L/a/b values in physical Lab units and no profile bytes; TargetBitsPerComponent selects 8 or 16-bit Gray/RGB/CMYK output
The optional interface preserves wider PCS chroma for ICC gamut conversion, whilst the base Transform method and ConvertPdfColourBuffer keep their integer sample contract; malformed, NaN or infinite floating sources clear the target and raise EPdfColourBackendError
The destination must be DeviceGray, DeviceRGB or DeviceCMYK with a corresponding ICC profile; leaving out that profile is supported only for the provider's default Gray and RGB spaces, and PCS Lab itself is never a destination
Default uses relative colorimetric intent and black point compensation, allowing 256 MiB of sample data and 16 MiB of ICC profile data; the latter allowance cannot exceed 16 MiB
TPdfLittleCmsOptions carries these settings into every call: RenderingIntent takes a LittleCMS intent value from 0 through 3, BlackPointCompensation switches on the black point compensation transform flag, and CancellationToken is the optional token checked around native work
MaxSampleBytes bounds both the submitted source samples and the converted output bytes, and MaxProfileBytes bounds every opened or generated ICC profile; an intent above 3 or a non-positive budget raises EPdfColourBackendError before the library loads
Cancellation is tested around native setup and between blocks containing at most 65,536 pixels; native profile opening and a single transformation block offer no cancellation callback
A failed transformation empties the destination buffer and raises EPdfColourBackendError; cancellation continues to raise EPdfOperationCancelled
Existing integer LittleCMS 2.19 transformations and the PDF save/reopen/render fixtures keep their recorded platform profiles; the new floating PCS interface and the JPX CIELab document path are qualified with Delphi and a checked FPC build on Win64
type
EPdfColourBackendError = class(EPdfProduction);
TPdfLittleCmsOptions = record
RenderingIntent: Cardinal;
BlackPointCompensation: Boolean;
MaxSampleBytes: Integer;
MaxProfileBytes: Integer;
CancellationToken: IPdfCancellationToken;
class function Default: TPdfLittleCmsOptions; static;
end;
function CreatePdfLittleCmsColourTransform(const LibraryPath: string;
const Options: TPdfLittleCmsOptions): IPdfColourTransform;
function TryCreatePdfLittleCmsColourTransform(const LibraryPath: string;
const Options: TPdfLittleCmsOptions; out Transform: IPdfColourTransform;
out ErrorText: string): Boolean;
function CreatePdfLittleCmsGrayProfile(const LibraryPath: string;
Gamma: Double = 2.2): TBytes;
function CreatePdfLittleCmsSrgbProfile(const LibraryPath: string): TBytes;
CreatePdfLittleCmsGrayProfile requires a finite gamma between 0.1 and 10; both profile helpers serialise real native ICC profiles suitable for embedding or reuse
CreatePdfLittleCmsSrgbProfile serialises the native sRGB profile the provider uses for unprofiled DeviceRGB, ready for embedding as an explicit source or target ICC profile
pwsh Native/ColourLittleCms/Build-LittleCms.ps1 -SourceDirectory C:/deps/lcms2.19 -OutputDirectory C:/deps/lcms-bin -Platform Win64
The build helper needs compatible MinGW GCC and an existing LittleCMS 2.19 source checkout; it places the applicable native licence notices in the output directory without downloading or installing dependencies