Named color database resources
This page applies to Harlequin v13.1r0 and later; both Harlequin Core and Harlequin MultiRIP.
NamedColor
resources are PostScript language dictionary resources in the NamedColor category. As is normal for resources, disk-based NamedColor resources are found in the SW/NamedColor directory, and resources may be defined dynamically in PostScript language code. They contain a set of named colors and their equivalent values in an alternate color space, amongst other things. For most use cases the HqnColorDatabase procset calls documented in HqnColorDatabase procset are the easiest way to add new NamedColor
resources, but creating NamedColor resources by writing your own Lookup procedure (see below) may occasionally be required.
To build a NamedColor resource dictionary (NCD) from scratch, include these entries:
| (Required either in the NCD or in the dictionary returned by the Variant 2 Lookup) the alternate space which will replace the alternate space in a Separation color space from the job. It is used for all colorants in this resource. It may be any of the PostScript or PDF color spaces with the exceptions of Indexed and Pattern. It must be a color space array; if the color space is a device space, it must be in the array form (for example, If the |
| (Required) a procedure to determine if this colorant should be replaced by this resource, and to obtain its solid color equivalent. The procedure is called with the NCD and the name of the colorant in question on the operand stack (as a string or name). If this colorant is not to be replaced, the procedure should remove both operands and return
If this colorant is to be replaced, two approaches are supported: Variant 1: If all colorants to be replaced by this NCD will use the same color space for the replacement, then define the
The array must include the correct number of color values, in the correct range, for the ColorSpace specified in the NCD. As an example, if ColorSpace is This array must be unique to each call to Lookup. The means of obtaining the solid colors is not defined, but some methods are in Named color lookup examples. If this variant is used, Variant 2: Alternatively, the Lookup procedure can dynamically select or construct the color space in which the values are returned and include the color space and tint transform in a dictionary that is returned with
The returned dictionary may contain a ColorSpace entry, exactly as described above; if ColorSpace is not defined in the returned dictionary then it must be defined in the NCD itself. The
CODE
|
| Procedure, required either in the NCD or in the dictionary returned by Lookup, but note that the values must be structured differently for Variants 1 and 2 above. Variant 1: In the case where the Lookup procedure returns an array a color values, a
An example might be:
CODE
Variant 2: In the case where the Lookup procedure returns a dictionary in which |
| (Optional) a Boolean, default: For resources that have a ColorSpace entry of For resources that have a ColorSpace entry of For resources with other ColorSpace entries,
|
| (Optional) An integer, name, string, or null. Default: Subject to the following caveats, after extracting the named color's equivalent value from the resource, the color is passed directly to the The ID key only has effect if the ColorSpace of the resource is If an ID key is present and not null, All of the colorants present in the ColorSpace entry must be accepted by the matching For the purpose of ID matching, names and strings are considered equivalents. It is important that a tint of |
NC-setID
Setting the ID key of a particular resource normally requires knowledge of the precise color configuration. In particular, it requires knowledge of the ID keys associated with each NextDevice
transform. Therefore, setting the ID key is normally done at runtime after placing NamedColor
resources in the graphics state using setinterceptcolorspace. That is achieved using the NC-setID
procedure from the HqnNamedColor
procset:
ID resource-name NC-setID –
where ID is the integer, name or string used for the ID, and resource-name is the name of a NamedColor
resource. It is often convenient to define this procedure in a local name before use, with this line:
/NC-setID /HqnNamedColor /ProcSet findresource /NC-setID get def
These are examples of how to use NC-setID:
1 /SWOP_NCD NC-setID
/a-name /Calibrated_NCD NC_setID
(a-string) /Output_NCD NC-setID
where each of the three NCDs in the examples use different printing conditions.