Harlequin RIP SDK
namedcolorlookup.c File Reference

Example of a PostScript device type to implement named color lookup. This example is unusual in that it is split into two files. More...

#include "hhrsdk.h"

Functions

static void lab_tint (float *color, int32 num_channels, float tint)
 
static void xyzD50_tint (float *color, int32 num_channels, float tint)
 

Variables

static ncdev_color_t color_table_CMYK []
 
static ncdev_color_t color_table_CMYKOGV []
 
static ncdev_color_t color_table_LabD50 []
 
static ncdev_color_t color_table_XYZD50 []
 
static ncdev_color_t color_table_None []
 
struct {
   const uint8 *   devicename
 
   int32   devicenamelen
 
   ncdev_details_t   details
 
namedcolor_devices []
 

Detailed Description

Example of a PostScript device type to implement named color lookup. This example is unusual in that it is split into two files.

The namedcolorlookup.c file (this file) contains the device specific named color data and C functions for optional tint transforms. It should be rewritten for each device.

The namedcolordev.c file is in skinkit. It contains boilerplate code for a PostScript device that acts as the intermediary between the RIP and the namedcolor data and tint transform functions. It accesses the data in this file using the namedcolor_find_device() and device iterator functions.

There may be many named color device instances. This example supports five instances for CMYK, CMYKOGV, Lab, XYX, and None. These devices are instantiated in SW/Sys/ExtraDevices. The test namedcolor resources that make use of them are in SW/NamedColor/Examples.

Function Documentation

◆ lab_tint()

static void lab_tint ( float *  color,
int32  num_channels,
float  tint 
)
static

Tint transform function for Lab colorspace. This is quite simplistic, it does not take gamut boundaries into account.

It is very important that this tint function produce white when tint is 0.0f, and that it doesn't change the solid values when tint is 1.0f. The implementation here is a C equivalent of the PostScript:

/TintTransform { % tint [L a b] |- L' a b
aload pop % tint L a b
2 {3 index mul exch} repeat % tint L a' b'
4 2 roll 100 sub mul 100 add 3 1 roll % L' a' b'
} bind def

◆ xyzD50_tint()

static void xyzD50_tint ( float *  color,
int32  num_channels,
float  tint 
)
static

Tint transform function for XYZ colorspace. This is quite simplistic, it does not take gamut boundaries into account.

The implementation here scales in Lab along with the necessary conversion between XYZ<->Lab.

Variable Documentation

◆ color_table_CMYK

ncdev_color_t color_table_CMYK[]
static
Initial value:
= {
{ STRING_AND_LENGTH("Dark Blue"), {0.98f, 0.83f, 0.00f, 0.39f} },
{ STRING_AND_LENGTH("Mold Green"), {0.55f, 0.00f, 0.37f, 0.00f} },
{ STRING_AND_LENGTH("Sky Blue"), {1.00f, 0.00f, 0.06f, 0.11f} },
{ STRING_AND_LENGTH("Deep Sea"), {0.99f, 0.53f, 0.00f, 0.77f} },
{ STRING_AND_LENGTH("Mud"), {0.00f, 0.23f, 0.58f, 0.59f} },
}
#define STRING_AND_LENGTH(s1_)
Definition: std.h:150

Example pre-defined CMYK color table.

◆ color_table_CMYKOGV

ncdev_color_t color_table_CMYKOGV[]
static
Initial value:
= {
{ STRING_AND_LENGTH("Dark Blue"), {1.00f, 0.00f, 0.00f, 0.73f, 0.00f, 0.00f, 0.79f} },
{ STRING_AND_LENGTH("Mold Green"), {0.00f, 0.00f, 0.09f, 0.07f, 0.00f, 0.57f, 0.00f} },
{ STRING_AND_LENGTH("Sky Blue"), {0.99f, 0.00f, 0.00f, 0.13f, 0.00f, 0.21f, 0.00f} },
{ STRING_AND_LENGTH("Deep Sea"), {0.98f, 0.00f, 0.00f, 0.84f, 0.00f, 0.00f, 0.45f} },
{ STRING_AND_LENGTH("Mud"), {0.00f, 0.00f, 0.39f, 0.62f, 0.31f, 0.00f, 0.00f} },
}

Example pre-defined CMYKOGV color table.

◆ color_table_LabD50

ncdev_color_t color_table_LabD50[]
static
Initial value:
= {
{ STRING_AND_LENGTH("Dark Blue"), {15.116f, 9.812f, -46.239f} },
{ STRING_AND_LENGTH("Mold Green"), {78.292f, -29.409f, -4.436f} },
{ STRING_AND_LENGTH("Sky Blue"), {55.967f, -38.163f, -42.229f} },
{ STRING_AND_LENGTH("Deep Sea"), {20.904f, -5.936f, -27.864f} },
{ STRING_AND_LENGTH("Mud"), {48.735f, 5.239f, 24.496f} },
}

Example pre-defined Lab D50 color table.

◆ color_table_None

ncdev_color_t color_table_None[]
static
Initial value:
= {
{ STRING_AND_LENGTH("Die"), {0.0f} },
{ STRING_AND_LENGTH("Cut"), {0.0f} },
}

Example pre-defined None color table.

◆ color_table_XYZD50

ncdev_color_t color_table_XYZD50[]
static
Initial value:
= {
{ STRING_AND_LENGTH("Dark Blue"), {0.0230f, 0.0193f, 0.1028f} },
{ STRING_AND_LENGTH("Mold Green"), {0.4134f, 0.5371f, 0.4805f} },
{ STRING_AND_LENGTH("Sky Blue"), {0.1553f, 0.2388f, 0.4745f} },
{ STRING_AND_LENGTH("Deep Sea"), {0.0277f, 0.0322f, 0.0790f} },
{ STRING_AND_LENGTH("Mud"), {0.1772f, 0.1738f, 0.0682f} },
}

Example pre-defined XYZ D50 color table.

◆ details

ncdev_details_t details

Device details.

◆ devicename

const uint8* devicename

Name of device instance, e.g. 'namedcolorCMYK'. Not null-terminated.

◆ devicenamelen

int32 devicenamelen

Length of 'devicename'.

◆ 

struct { ... } namedcolor_devices[]

The details of the supported namedcolor device instances with their color spaces and tables.