This topic covers the implementation details of TCmyk.
Scope: TypeDefinitions.pas; record. Prepared from the curated implementation supplied for this review on 2 October 2026.
ColorName is the principal current color reference. Ordinary exports omit CMYK component numbers; the reader still accepts them. A special undefined template-color sentinel writes Cyan=Magenta=Yellow=Black=99, empty ColorName and RGB=99.
A missing RGB defaults to zero in this reader. Do not treat the constructor’s 12/34/56/78 CMYK values as an actual intended print color; comments mark them as legacy placeholders.
Notation and shared helper rules: Reading this reference.
Literal rec_type values emitted within these routines: TCmyk. Nested values may belong to child wrappers rather than this owner itself; the attribute entries below give their exact locations.
Exact XML fields and attributes
The paths below start at this record or property node. A slash identifies a child element; @ identifies an attribute. Curly braces mark a variable index or expression, not literal XML text. Initial values describe initialization; they do not establish what an omitted individual element does. The Implementation toggle below contains the supplied routines for exact branch order and conversions.
Cyan
XML representation: The text of the Cyan element.
Initial value: 12 (TCmyk.Initialize).
Reading: Reads the element into Cyan when the record node exists; the Cyan child element exists.
Writing: Stores the literal text “99” when (ColorName is empty and Cyan is 99 and Magenta is 99 and Yellow is 99 and Black is 99).
Magenta
XML representation: The text of the Magenta element.
Initial value: 34 (TCmyk.Initialize).
Reading: Reads the element into Magenta when the record node exists; the Cyan child element exists.
Writing: Stores the literal text “99” when (ColorName is empty and Cyan is 99 and Magenta is 99 and Yellow is 99 and Black is 99).
Yellow
XML representation: The text of the Yellow element.
Initial value: 56 (TCmyk.Initialize).
Reading: Reads the element into Yellow when the record node exists; the Cyan child element exists.
Writing: Stores the literal text “99” when (ColorName is empty and Cyan is 99 and Magenta is 99 and Yellow is 99 and Black is 99).
Black
XML representation: The text of the Black element.
Initial value: 78 (TCmyk.Initialize).
Reading: Reads the element into Black when the record node exists; the Cyan child element exists.
Writing: Stores the literal text “99” when (ColorName is empty and Cyan is 99 and Magenta is 99 and Yellow is 99 and Black is 99).
RGB
XML representation: The text of the RGB element.
Initial value: 0 (TCmyk.Initialize).
Reading: Reads the element into RGB when the record node exists; the RGB child element exists.
Writing: Stores the literal text “99” when (ColorName is empty and Cyan is 99 and Magenta is 99 and Yellow is 99 and Black is 99).
Writing: Stores the numeric value of RGB when (ColorName is not empty or Cyan is not 99 or Magenta is not 99 or Yellow is not 99 or Black is not 99); RGB is not 0.
ColorName
XML representation: The text of the ColorName element.
Initial value: “BLACK:1” (TCmyk.Initialize).
Reading: Reads the element into ColorName when the record node exists.
Writing: Stores the literal text an empty string when (ColorName is empty and Cyan is 99 and Magenta is 99 and Yellow is 99 and Black is 99).
Writing: Stores ColorName when (ColorName is not empty or Cyan is not 99 or Magenta is not 99 or Yellow is not 99 or Black is not 99).
@rec_type
XML representation: The rec_type attribute.
Writing: Stores the literal text “TCmyk” whenever the writer reaches this field.
Initialization and reset values
TCmyk.Initialize
Setting or temporary variable |
Initial value |
When it is assigned |
self |
Default (TCmyk) |
Always |
Cyan |
12 |
Always |
Magenta |
34 |
Always |
Yellow |
56 |
Always |
Black |
78 |
Always |
ColorName |
“BLACK:1” |
Always |
RGB |
0 |
Always |
Storage declarations relevant to interpretation
These are in-memory member and property types, not a list of mandatory XML children. They retain array bounds, fixed buffers and selector types. The field reference above defines what is actually serialized.
Name |
Declared type / bounds |
Kind |
Cyan |
integer |
member |
Magenta |
integer |
member |
Yellow |
integer |
member |
Black |
integer |
member |
FColorName |
array [1..50] of Char |
member |
RGB |
integer |
member |
ColorName |
string |
property/accessor |
The Implementation toggle contains only TCmyk methods. Initializers and helpers belonging to other types are identified separately below. Shared XML-helper limitations are explained in Reading this reference.
Declaration reproduces this record’s complete declaration from the supplied source, including its fields, properties and method signatures.