PdfColorSpace class abstract

A PDF colour space (§8.6) resolved to what rendering needs: how many components a colour carries, and how those components become sRGB.

This is the single source of truth for the knowledge "given a COS colour-space object, how many channels does it have and how do N component values convert to sRGB". The interpreter (sc/scn), axial and radial shadings, mesh shadings, and image decoding all resolve their colour spaces through parse rather than each re-deriving the family/channel/conversion logic. The device families, the CIE-based calibrated spaces (PdfCalibratedColorSpace), ICC profiles (IccProfile), Indexed palettes, and Separation/DeviceN tint transforms are all folded into one interface here.

Constructors

PdfColorSpace()
const

Properties

channels → int
Nominal component count of the space. Pattern spaces report 0.
no setter
family → String
The space's family name (DeviceGray/DeviceRGB/DeviceCMYK/ Indexed/Separation/DeviceN/ICCBased/CalGray/CalRGB/Lab/ Pattern).
no setter
hashCode → int
The hash code for this object.
no setterinherited
iccProfile → IccProfile?
The parsed ICC profile backing an ICCBased space, when supported; null for every other family (and for an ICCBased space whose profile could not be parsed, where the device fallback applies).
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

blendColorants(List<double> values, {PdfRenderingIntent intent = PdfRenderingIntent.perceptual}) → PdfInkColorants?
Process-colour reading used inside a transparency blending space.
inkColorants(List<double> values) → PdfInkColorants?
The device colorants painting values in this space writes, with the overprint semantics of the space (§8.6.7) - or null when the space has no colorant reading, in which case overprint cannot be resolved and the painting device's approximation stands.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toSrgb(List<double> values) → PdfColor
Converts values - nominally one per channels, in the space's own component ranges - to sRGB. Lenient on a length mismatch: device families read what they can and treat the rest as zero.
toSrgbFromSamples(List<int> samples) → PdfColor
Converts raw 8-bit samples (0–255), as stored in image data or an Indexed palette entry, to sRGB through the space's default component decode (§8.6.5). The default decode is 0, 1 per component; Lab overrides it with its L*/a*/b* ranges.
toSrgbFromSamplesIntent(List<int> samples, PdfRenderingIntent intent) → PdfColor
toSrgbFromSamples with an explicit ICC rendering intent.
toSrgbIntent(List<double> values, PdfRenderingIntent intent) → PdfColor
toSrgb with an explicit ICC rendering intent. Non-ICC spaces ignore it; ICCBased selects its A2B0/1/2 transform.
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Methods

parse(CosDocument cos, CosObject? object, {CosDictionary? resources, Map<CosStream, IccProfile?>? iccCache, PdfColorContext? colorContext}) → PdfColorSpace
Resolves a colour-space object. object may be a device or abbreviation name, a Pattern name, an array space ([/ICCBased …], [/Indexed …], [/Separation …], [/DeviceN …], [/CalRGB …], …), or - when resources is given - a name keying the resource dictionary's /ColorSpace sub-dictionary (as cs/CS operands do). Always returns a space; unrecognised shapes fall back to a device family.

Constants

deviceGray → const PdfColorSpace
The default DeviceGray space - the initial fill/stroke space (§8.6.3) and a safe fallback for anything unresolved.