The %cmmparams%
example PostScript device for setting configuration parameters used by the PureColor CMM example.
More...
Files | |
file | cmm_params.c |
The %cmmparams% example PostScript device for setting configuration parameters used by the PureColor CMM example. | |
file | cmm_params.h |
Interface to the %cmmparams% example PostScript device. | |
Functions | |
HqBool | purecolor_register_params (void) |
Register the CMM_PARAMS_DEVICE_TYPE PostScript device type. More... | |
static int32 | cmmSetParam (DEVICELIST *dev, DEVICEPARAM *param) |
Set a %cmmparams% device param with a new value. More... | |
static int32 | cmmStartParam (DEVICELIST *dev) |
Prepare the device for a set of calls to cmmGetParam() as part of currentdevparams . More... | |
static int32 | cmmGetParam (DEVICELIST *dev, DEVICEPARAM *param) |
Retrieve the current value of a %cmmparams% device param. More... | |
The %cmmparams%
example PostScript device for setting configuration parameters used by the PureColor CMM example.
Most of the PostScript device interface functions are inactive. The principle behaviour is in the cmmSetParam() function. It also implements the cmmStartParam() and cmmGetParam() functions to retrieve the parameters.
|
static |
Retrieve the current value of a %cmmparams%
device param.
dev | The current device. |
param | A structure in which to store the parameter value. If the paramname field is NULL , then store the next parameter in an iteration, otherwise store the value of the requested parameter. |
This routine has two functions. If the DEVICEPARAM::paramname field of the param argument is NULL
when it is called, the next parameter name and value in an iteration started by DEVICELIST_START_PARAM should be returned through the DEVICEPARAM structure. If the DEVICEPARAM::paramname field is not NULL
then the value of that specific parameter name should be returned through the DEVICEPARAM structure.
In the second case if the parameter name is not recognized the routine should return ParamIgnored, otherwise it should return ParamAccepted. If an error occurs, ParamError should be returned and the DEVICELIST_LAST_ERROR method should return an appropriate error code.
If not returning ParamIgnored, the DEVICEPARAM::type field must be set to one of DEVICEPARAM_type values. The appropriate union field and length if necessary should be set to the value of the parameter. If a string value is returned, the string value field should point to the device's local copy of the string. The RIP will copy the string into its own storage. If returning a composite object (an array or a dictionary), the implementation may allocate memory for the DEVICEPARAM array representing the composite object and store the memory pointer in the DEVICEPARAM::paramval.compobval field. The RIP will copy the value into its own storage as necessary. This memory should be freed by the device type implementation on the next call to DEVICELIST_GET_PARAM or DEVICELIST_START_PARAM. The client is required to call DEVICELIST_START_PARAM if the final call it made to DEVICELIST_GET_PARAM returned a composite object.
If returning the next parameter (DEVICEPARAM::paramname is NULL
on function entry) the DEVICEPARAM::paramname field should be set to point to the name of the parameter being returned, and the DEVICEPARAM::paramnamelen field set to the length of that name.
The Harlequin RIP SDK provides some utility routines to assist writing parameter methods:
|
static |
Set a %cmmparams%
device param with a new value.
dev | The current device. |
param | A structure describing the parameter to set and its value. |
The PostScript language operator setdevparams
will call this device routine. The param argument specifies the device parameter name and its value in the DEVICEPARAM structure. Parameters are always named by a string, specified by DEVICEPARAM::paramname and DEVICEPARAM::paramnamelen, and accessible through theIDevParamName() and theIDevParamNameLen() macros. Note that the parameter name is not necessarily zero-terminated, the parameter length should always be checked when accessing the parameter name.
The DEVICEPARAM::type field indicates the type of the parameter to set. This will be one of:
Strings set using this method are stored in the Harlequin Core internal memory which may be re-used; therefore, if the device needs to keep referring to the string, it must copy it into its own memory.
This method returns a code to indicate the success or failure of setting the parameter:
The following device parameters are valid for all devices, and are not passed to the device. They are handled internally by the Harlequin Core:
invalidaccess
error is generated if the device's type has not been set yet.The Harlequin RIP SDK provides some utility routines to assist writing parameter methods:
|
static |
Prepare the device for a set of calls to cmmGetParam() as part of currentdevparams
.
dev | The current device. |
This routine is called by the PostScript language operator currentdevparams
to determine how many parameters will be returned, and to start enumerating them. The number returned need not be the same as the number of device parameter names recognized by the device, because some device parameters can be write only, or a parameter may only be returned once a value has been set for it. The number excludes the parameters that are handled by the interpreter itself (/Password
, /DeviceType
, /Enable
). Following this call, DEVICELIST_GET_PARAM will be called multiple times with a NULL
DEVICEPARAM::paramname field to get each of the parameters.
If there are no such device parameters, 0 should be returned. If an error occurs, -1 should be returned.
HqBool purecolor_register_params | ( | void | ) |
Register the CMM_PARAMS_DEVICE_TYPE PostScript device type.
If compiled normally, the "clrip" application layer registers this devide during RIP startup. CMM module examples may be excluded from "clrip" by building with NO_CMMEG
defined.