Harlequin RIP SDK

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 <string.h>
#include "skinkit.h"
#include "devutils.h"
#include "kitdevs.h"
#include "skindevs.h"
#include "swdevice.h"
#include "rdrapi.h"
#include "namedcolordev.h"

Data Structures

struct  nc_data_t
 

Typedefs

typedef struct nc_data_t nc_data_t
 

Functions

static int CRT_API color_sort (const void *a, const void *b)
 
static ncdev_details_tnamedcolor_find_device (const uint8 *devname)
 

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 is in skintest. It contains the device specific named color data, along with optional functions for handling tint transforms.

The namedcolordev.c file (this file) contains boilerplate code for a PostScript device that acts as the intermediary between the RIP and the named color data and tint transforms. This file is not expected to require any changes.

The PostScript device is expected to be called using two protocols, for obtaining the equivalent solid color and tint transforms:

  • solid lookup, e.g. for the CMYK device instance:
        (%namedcolorCMYK%Dark Blue) run
        
    which opens and execute the 'Dark Blue' pseudo-file on the required device instance. The result is that the solid color is left on the stack as an HNA (homogenous number array). The 'Dark Blue' pseudo-file is automatically closed. The namedcolor device function calls resulting from this fragment are:
        open_file -> read_file -> close_file
        
  • tint transform, e.g. for the CMYK device instance:
        (%namedcolorCMYK%) << /Tint 0.2 /Solid [...] >> setdevparams
        (%namedcolorCMYK%) run
        
    which sets the required tint value and loads the Solid with the HNA previously obtained from the call for the solid lookup. Then the device is run with an arbitrary pseudo-file (empty in this example) because it is ignored when the Tint value has been set like this. The result is that the tint color is left on the stack as an HNA (homogenous number array). The namedcolor device function calls resulting from this fragment are:
        set_param -> open_file -> read_file -> close_file
        

The example namedcolor resources in SW/NamedColor/Examples shows how to use this device.

Typedef Documentation

◆ nc_data_t

typedef struct nc_data_t nc_data_t

Private data of devicelist instances.

Function Documentation

◆ color_sort()

static int CRT_API color_sort ( const void *  a,
const void *  b 
)
static

Helper function for qsort.

◆ namedcolor_find_device()

static ncdev_details_t* namedcolor_find_device ( const uint8 devname)
static

Return the named color device instance associated with 'devname'. Return NULL if not found.