CreatePdfLittleCmsColourTransform implements IPdfColourTransform for original Gray, RGB, CMYK, ICCBased and PCS Lab component buffers and the document color conversion helper
Supply an explicit absolute library path whose architecture matches the process; the native library must expose the LittleCMS 2 cdecl API, and the supplied build helper produces that ABI from the MIT-licensed LittleCMS 2.19 source
A DLL using the Microsoft stdcall build configuration is incompatible with the Win32 provider; calling conventions cannot be inferred reliably from undecorated exported names
TryCreatePdfLittleCmsColourTransform returns dependency diagnostics and leaves the transform nil on failure without changing the process search path
Each call owns its native context, profiles and transform; the provider can be shared, but callers must keep their sample buffers immutable for the duration of a call
Buffers contain tightly packed whole pixels with 1, 3 or 4 components and 8-bit bytes or 16-bit unsigned words in native byte order; PDF big-endian image samples are converted by the document helper before invoking this provider
Unprofiled DeviceRGB uses sRGB and unprofiled DeviceGray uses a D50 gamma-2.2 profile; DeviceCMYK and ICCBased require an explicit source ICC profile, and every profile data color space must match its declared component count
The base Transform method accepts a pcsLab source buffer that feeds the ICC v4 PCS Lab connection without profile bytes: exactly three 16-bit components encoded as L*655.35 and (a+128)*257, with white mapped to the D50 PCS; other bit depths, component counts or attached profile bytes raise EPdfColourBackendError
Since v3.312.0, query IPdfColourFloatTransform for TransformFloat: the source must be pcsLab with three 32-bit native-endian IEEE 754 Single components, containing 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, while the base Transform method and ConvertPdfColourBuffer retain their integer sample contract; malformed, NaN or infinite floating sources clear the target and raise EPdfColourBackendError
Targets are DeviceGray, DeviceRGB or DeviceCMYK with a matching ICC profile; an omitted target profile is supported only for the provider's Gray and RGB defaults, and PCS Lab itself is never a target
Default selects relative colorimetric intent, black point compensation, 256 MiB of sample bytes and 16 MiB of ICC profile bytes; the profile limit is capped at 16 MiB
TPdfLittleCmsOptions carries these settings into every call: RenderingIntent takes a LittleCMS intent value from 0 through 3, BlackPointCompensation turns 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 nonpositive budget raises EPdfColourBackendError before the library loads
Cancellation is checked before and after native setup and between blocks of at most 65,536 pixels; native profile opening and an individual transform block have no cancellation callback
Failed transforms clear the target buffer and raise EPdfColourBackendError; cancellation preserves EPdfOperationCancelled
Existing integer LittleCMS 2.19 transforms and PDF save/reopen/render fixtures retain their recorded platform profiles; the new floating PCS interface and JPX CIELab document path are qualified with Delphi and checked FPC 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 accepts a finite gamma from 0.1 through 10; both profile helpers serialize genuine native ICC profiles for embedding or reuse
CreatePdfLittleCmsSrgbProfile serializes 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 helper requires a compatible MinGW GCC installation and an existing LittleCMS 2.19 source checkout, copies applicable native license notices into the output directory and does not download or install dependencies