The definition of an implementation of the custom color space interface. More...
#include "swccs.h"
Data Fields | |
| sw_api_info | info |
| Version number, name, display name, instance size. | |
| HqBool(* | init )(sw_ccs_api *implementation, const sw_ccs_init_params *params) |
| The init() method is called before any other calls to the implementation. More... | |
| void(* | finish )(sw_ccs_api *implementation) |
| The finish() method is called after all calls to the implementation or its instances. More... | |
| sw_ccs_result(* | construct )(sw_ccs_instance *instance) |
| This method is used to construct an instance of a custom color space implementation. More... | |
| void(* | destruct )(sw_ccs_instance *instance) |
| This method is used to destroy a custom color space instance. More... | |
| sw_ccs_custom_colorspace *(* | declare_custom_colorspace )(sw_ccs_instance *instance, uint32 index) |
| Declare support for a custom color space. More... | |
| sw_ccs_result(* | open_transform )(sw_ccs_instance *instance, uint32 index, sw_cmm_object_type object_type, sw_cmm_color_model color_model, uint32 *num_input_channels, uint32 *num_output_channels, sw_ccs_transform *handle) |
| Create a color transformation comprising one custom color space. More... | |
| void(* | close_transform )(sw_ccs_instance *instance, sw_ccs_transform transform) |
| Close a color transformation. More... | |
| sw_ccs_result(* | invoke_transform )(sw_ccs_instance *instance, sw_ccs_transform transform, float *input_data, float *output_data, uint32 num_pixels) |
| Invoke a color transformation. More... | |
| void(* | security )(sw_ccs_instance *instance, void *buffer, uint32 size) |
| A security challenge. | |
The definition of an implementation of the custom color space interface.
The RIP will construct a singleton instance for each implementation registered.
| void( * sw_ccs_api::close_transform) (sw_ccs_instance *instance, sw_ccs_transform transform) |
Close a color transformation.
| [in] | instance | The custom color space instance owning the color transform. |
| [in] | transform | A valid transform handle created by an open_transform() or open_transform() call on the same custom color space instance. The custom color space implementation should discard any resources associated with the transform. |
| sw_ccs_result( * sw_ccs_api::construct) (sw_ccs_instance *instance) |
This method is used to construct an instance of a custom color space implementation.
| [in,out] | instance | An incomplete instance of the sw_ccs_instance structure to complete. The RIP will allocate a structure of the size presented in the implementation's sw_ccs_api::info.instance_size field, fill in the implementation and callback API instance pointers (*), and then pass it to this routine. The construct() method is expected to fill in the remaining fields. The implementation may sub-class the instance to allocate private workspace by initialising the implementation's sw_ccs_api::info.instance_size larger than the size of the sw_ccs_instance structure, then downcasting the instance pointer in method calls. (*) The RIP will also fill in the params field with the optional params dictionary that is an optional parameter for setalternatecmm, provided the API version is at least SW_CCS_API_VERSION_20251001. |
| sw_ccs_custom_colorspace*( * sw_ccs_api::declare_custom_colorspace) (sw_ccs_instance *instance, uint32 index) |
Declare support for a custom color space.
This method is optional. If this method is not supported, then the open_custom_colorspace() method will never be called.
| [in] | instance | A custom color space instance. |
| index | A zero-based index used to identify the custom color spaces defined by the custom color space instance. When trying to set custom color spaces, the RIP will call this method with indices starting at 0, and increasing until either a match is found or this method returns NULL. |
NULL if the index is out of the range supported by the custom color space implementation. | void( * sw_ccs_api::destruct) (sw_ccs_instance *instance) |
This method is used to destroy a custom color space instance.
This method is optional.
The RIP will call the destructors individually for each instance shortly before terminating the RIP. The RIP may also destroy and re-construct custom color space instances in low-memory situations.
| [in] | instance | An instance of the sw_ccs_api implementation to destroy. |
| void( * sw_ccs_api::finish) ( sw_ccs_api *implementation) |
The finish() method is called after all calls to the implementation or its instances.
The implementation instances should not access any data owned by the RIP after this call, nor should they call any implementation or RIP callback API methods after this call. This method is optional; if not required, set to NULL.
| implementation | A registered custom color space implementation to finalise. |
| HqBool( * sw_ccs_api::init) ( sw_ccs_api *implementation, const sw_ccs_init_params *params) |
The init() method is called before any other calls to the implementation.
This method may be used to initialise any implementation-specific data. This method is optional; if not required, set to NULL.
| implementation | The registered custom color space implementation to be initialised. | |
| [in] | params | A structure containing callback APIs and parameters valid for the lifetime of the module. Any parameters that the implementation needs access to should be copied out of this structure into private storage for the registered implementation. |
| TRUE | Success, indicating that the implementation is fully initialised. |
| FALSE | Failure to initialize the implementation. If this is returned, the implementation will not be finalized. |
| sw_ccs_result( * sw_ccs_api::invoke_transform) (sw_ccs_instance *instance, sw_ccs_transform transform, float *input_data, float *output_data, uint32 num_pixels) |
Invoke a color transformation.
| [in] | instance | The custom color space instance owning the color transform. |
| [in] | transform | A valid transform handle created by an open_transform() call on the same custom color space instance. |
| [in] | input_data | An array of num_pixels sets of pixel-interleaved color values to transform. Colors are interleaved in the order specified by the input space of the first profile in the transform. |
| [out] | output_data | An array in which to store num_pixels sets of pixel-interleaved color values. Colors are interleaved in the order specified by the output space of the last profile in the transform. |
| num_pixels | The number of sets of input pixel colorvalues to convert from the input space to the output space of the transform. |
In all cases, both the input and output data should be pixel interleaved with each color value contained in a 32-bit IEEE floating value. The interleaving of the input data is in the same order as that expected by the first profile in a transform and the interleaving of the output data should be in the same order as produced by the last profile in the transform. It is the responsibility of the custom color space to marshal the data into and out of the format required for its internal use. As an example, if five pixels of RGB data were to be converted to CMYK, the RIP will arrange the input data as follows:
RGBRGBRGBRGBRGB
and invoke_transform() will produce this arrangement of output data:
CMYKCMYKCMYKCMYKCMYK
The number of channels for each pixel is derived from the first and last profiles in the transform as returned by open_transform().
The memory referenced by input_data and output_data is managed by the RIP and can be assumed to contain valid memory for the appropriate amount of data. The size, in bytes, allocated by the RIP to each is:
num_pixels * num_input_channels * sizeof(float)num_pixels * num_output_channels * sizeof(float) | sw_ccs_result( * sw_ccs_api::open_transform) (sw_ccs_instance *instance, uint32 index, sw_cmm_object_type object_type, sw_cmm_color_model color_model, uint32 *num_input_channels, uint32 *num_output_channels, sw_ccs_transform *handle) |
Create a color transformation comprising one custom color space.
| [in] | instance | The custom color space instance. |
| index | The zero-based index that identifies the desired custom color space, as established from declare_custom_colorspace(). | |
| [in] | object_type | One of the values of sw_cmm_object_type. |
| [in] | color_model | One of the values of sw_cmm_color_model. |
| [out] | num_input_channels | A location for the custom color space to fill in the number of color channels in the input space of the first profile in the transform. |
| [out] | num_output_channels | A location for the custom color space to fill in the number of color channels in the output space of the last profile in the transform. |
| [out] | handle | A pointer in which a CCS transform handle is stored by the custom color space implementation. This handle will be used to refer to the transform by close_transform() and invoke_transform() methods. |
NULL transform pointer should have been stored in handle. If the profile could not be opened, one of the SW_CCS_RESULT error codes is returned.If a valid transform handle is returned, the close_transform() method will be called to destroy the transform later.