Harlequin RIP SDK

An instance structure for the CCS API implementation. More...

#include "swccs.h"

Data Fields

const sw_ccs_apiimplementation
 Pointer to the API implementation. More...
 
sw_memory_instancemem
 A memory allocator instance. More...
 
HqBool multithread_customcmm_transforms
 If TRUE, sw_ccs_api::open_transform(), sw_ccs_api::close_transform() and sw_ccs_api::invoke_transform() for custom color space transforms may be called from more than one thread at the same time.
 
sw_datum params
 Contains a copy of the key/value pairs in the params dictionary that is optionally passed to the setcustomcolorspace operator. A custom color space cmm accesses these params via swdataapi.
 

Detailed Description

An instance structure for the CCS API implementation.

This is the definition of a custom color space instance. The RIP allocates memory for the instances, fills in the implementation and memory instance fields, and calls the implementation's constructor to complete the remaining details. The RIP will construct one instance as a result of using either the setcustomcolorspace operator. These are commonly used in the RIP's configuration.

There will normally be at most one CCS instance active on each page. There may be more than one CCS instance active at a time if Harlequin Parallel Pages is in use. While discouraged, it is possible to call setcustomcolorspacecmm multiple times on the same page; this may result in several CCS instances active on the same page which will have unpredictable results depending on the job structure.

The instance structure may be subclassed to hold private data by defining a subclass structure containing this structure as its first member, and using the size of that structure as the implementation's instance size. Individual methods may then downcast their instance pointer parameters to subclass pointers, and use the private data. e.g.,

typedef struct my_instance {
sw_ccs_instance super ; // must be first entry
struct my_data *dynamic ;
int32 other_fields ;
} my_instance ;
static sw_ccs_result RIPCALL my_construct(sw_ccs_instance *inst)
{
my_instance *myinst = (my_instance *)inst ; // downcast to subclass
// allocate private data:
myinst->dynamic = cmmegMemAlloc(inst, sizeof(myinst->dynamic)) ;
return myinst->dynamic != NULL ? SW_CCS_SUCCESS : SW_CCS_ERROR_MEMORY ;
}
static void RIPCALL my_destruct(sw_ccs_instance *inst)
{
my_instance *myinst = (my_instance *)inst ; // downcast to subclass
// free allocated data, if necessary:
cmmegMemFree(inst, myinst->dynamic) ;
}
const static sw_ccs_api my_impl = {
{
(const uint8 *)"myname",
(const uint8 *)("A long description of my module implementation"
"Copyright (C) 2021 Global Graphics Software Ltd."),
sizeof(my_instance), // RIP will allocate this amount for the subclassed instance
},
// ...more of sw_ccs_api definition...
my_construct,
my_destruct,
// ...rest of sw_ccs_api definition...
} ;
// use the PostScript fragment:
// (myname) setcustomcolorspace
// in the config to create the CCS instance and call my_construct().
void cmmegMemFree(sw_memory_instance *instance, void *p)
Release CMM memory.
Definition: cmm_common.c:40
void * cmmegMemAlloc(sw_memory_instance *instance, size_t n)
Allocate CMM memory.
Definition: cmm_common.c:28
uint8_t uint8
8-bit unsigned integer
Definition: hqtypes.h:88
int32_t int32
32-bit signed integer
Definition: hqtypes.h:91
HqnResult sw_ccs_result
Type of return values from sw_ccs_api functions.
Definition: swccs.h:253
@ SW_CCS_ERROR_MEMORY
Unused, for compatibility with SW_CMM_RESULT.
Definition: swccs.h:236
@ SW_CCS_SUCCESS
Success return value for sw_ccs_api methods.
Definition: swccs.h:229
@ SW_CCS_API_VERSION_20251001
Current version. Must be > SW_CMM_API_VERSION_20200117.
Definition: swccs.h:221
#define NULL
Definition of NULL pointer.
Definition: hqtypes.h:37
#define RIPCALL
The normal calling convention for RIP-exported APIs.
Definition: ripcall.h:27
The definition of an implementation of the custom color space interface.
Definition: swccs.h:433
An instance structure for the CCS API implementation.
Definition: swccs.h:369

The RIP will not touch memory beyond the size of the instance structure for the implementation version registered.

Field Documentation

◆ implementation

const sw_ccs_api* sw_ccs_instance::implementation

Pointer to the API implementation.

This field is filled in by the RIP before sw_ccs_api::construct() is called.

◆ mem

sw_memory_instance* sw_ccs_instance::mem

A memory allocator instance.

This object is supplied by the RIP so that the CCS implementation can allocate memory using the RIP's memory allocator. CCS implementations should use this in preference to malloc() and free(), so that the RIP can track memory allocation and respond to low memory states more effectively.

This field is filled in by the RIP before sw_ccs_api::construct() is called.


The documentation for this struct was generated from the following file: