cd-transform

## cd-transform cd-transform — An ICC transform |

## Synopsis

    #define             CD_TRANSFORM_ERROR
    #define             CD_TRANSFORM_TYPE_ERROR
    enum                CdTransformError;
    void                (*_cd_transform_reserved1)          (void);
    void                (*_cd_transform_reserved2)          (void);
    void                (*_cd_transform_reserved3)          (void);
    void                (*_cd_transform_reserved4)          (void);
    void                (*_cd_transform_reserved5)          (void);
    void                (*_cd_transform_reserved6)          (void);
    void                (*_cd_transform_reserved7)          (void);
    void                (*_cd_transform_reserved8)          (void);
    GQuark              cd_transform_error_quark            (void);
    CdTransform *       cd_transform_new                    (void);
    void                cd_transform_set_input_icc          (CdTransform *transform,
                                                             CdIcc *icc);
    void                cd_transform_set_input_pixel_format (CdTransform *transform,
                                                             CdPixelFormat pixel_format);
    CdIcc *             cd_transform_get_input_icc          (CdTransform *transform);
    CdPixelFormat       cd_transform_get_input_pixel_format (CdTransform *transform);
    void                cd_transform_set_output_icc         (CdTransform *transform,
                                                             CdIcc *icc);
    void                cd_transform_set_output_pixel_format
                                                            (CdTransform *transform,
                                                             CdPixelFormat pixel_format);
    CdIcc *             cd_transform_get_output_icc         (CdTransform *transform);
    CdPixelFormat       cd_transform_get_output_pixel_format
                                                            (CdTransform *transform);
    void                cd_transform_set_abstract_icc       (CdTransform *transform,
                                                             CdIcc *icc);
    CdIcc *             cd_transform_get_abstract_icc       (CdTransform *transform);
    void                cd_transform_set_rendering_intent   (CdTransform *transform,
                                                             CdRenderingIntent rendering_intent);
    CdRenderingIntent   cd_transform_get_rendering_intent   (CdTransform *transform);
    void                cd_transform_set_bpc                (CdTransform *transform,
                                                             gboolean bpc);
    gboolean            cd_transform_get_bpc                (CdTransform *transform);
    gboolean            cd_transform_process                (CdTransform *transform,
                                                             gpointer data_in,
                                                             gpointer data_out,
                                                             guint width,
                                                             guint height,
                                                             guint rowstride,
                                                             GCancellable *cancellable,
                                                             GError **error);

## Description

This object is a simple ICC transform that allows mapping of simple RGB spaces to other simple RGB spaces using one, two or three ICC profiles.

This object is not supposed to re-implement LCMS, and if you need anything more complicated then you are better off using lcms2 directly.

## Details

### CD_TRANSFORM_ERROR

    #define CD_TRANSFORM_ERROR		(cd_transform_error_quark ())

### CD_TRANSFORM_TYPE_ERROR

    #define CD_TRANSFORM_TYPE_ERROR		(cd_transform_error_get_type ())

### enum CdTransformError

    typedef enum {
    	CD_TRANSFORM_ERROR_FAILED_TO_SETUP_TRANSFORM,
    	CD_TRANSFORM_ERROR_INVALID_COLORSPACE,
    	CD_TRANSFORM_ERROR_LAST
    } CdTransformError;

The transform error code.

`CD_TRANSFORM_ERROR_FAILED_TO_SETUP_TRANSFORM` | Failed to setup transform
`CD_TRANSFORM_ERROR_INVALID_COLORSPACE` | Invalid colorspace
`CD_TRANSFORM_ERROR_LAST` |

Since 0.1.34

### _cd_transform_reserved1 ()

    void                (*_cd_transform_reserved1)          (void);

### _cd_transform_reserved2 ()

    void                (*_cd_transform_reserved2)          (void);

### _cd_transform_reserved3 ()

    void                (*_cd_transform_reserved3)          (void);

### _cd_transform_reserved4 ()

    void                (*_cd_transform_reserved4)          (void);

### _cd_transform_reserved5 ()

    void                (*_cd_transform_reserved5)          (void);

### _cd_transform_reserved6 ()

    void                (*_cd_transform_reserved6)          (void);

### _cd_transform_reserved7 ()

    void                (*_cd_transform_reserved7)          (void);

### _cd_transform_reserved8 ()

    void                (*_cd_transform_reserved8)          (void);

### cd_transform_error_quark ()

    GQuark              cd_transform_error_quark            (void);

Returns : | An error quark.

Since 0.1.34

### cd_transform_new ()

    CdTransform *       cd_transform_new                    (void);

Creates a new CdTransform object.

Returns : | a new CdTransform object.

Since 0.1.34

### cd_transform_set_input_icc ()

    void                cd_transform_set_input_icc          (CdTransform *transform,
                                                             CdIcc *icc);

Sets the input profile to use for the transform.

`transform` : | a CdTransform instance.
`icc` : | a CdIcc instance or `NULL`.

Since 1.0.0

### cd_transform_set_input_pixel_format ()

    void                cd_transform_set_input_pixel_format (CdTransform *transform,
                                                             CdPixelFormat pixel_format);

Sets the pixel format to use for the transform.

`transform` : | a CdTransform instance.
`pixel_format` : | The pixel format, e.g. `CD_PIXEL_FORMAT_RGBA_8`

Since 1.0.0

### cd_transform_get_input_icc ()

    CdIcc *             cd_transform_get_input_icc          (CdTransform *transform);

Gets the input profile to use for the transform.

`transform` : | a CdTransform instance.
Returns : | The input profile. [transfer none]

Since 1.0.0

### cd_transform_get_input_pixel_format ()

    CdPixelFormat       cd_transform_get_input_pixel_format (CdTransform *transform);

Gets the pixel format to use for the transform.

`transform` : | a CdTransform instance.
Returns : | the pixel format, e.g. `CD_PIXEL_FORMAT_RGBA_8`

Since 1.0.0

### cd_transform_set_output_icc ()

    void                cd_transform_set_output_icc         (CdTransform *transform,
                                                             CdIcc *icc);

Sets the output profile to use for the transform.

`transform` : | a CdTransform instance.
`icc` : | a CdIcc instance or `NULL`.

Since 1.0.0

### cd_transform_set_output_pixel_format ()

    void                cd_transform_set_output_pixel_format
                                                            (CdTransform *transform,
                                                             CdPixelFormat pixel_format);

Sets the pixel format to use for the transform.

`transform` : | a CdTransform instance.
`pixel_format` : | The pixel format, e.g. `CD_PIXEL_FORMAT_RGBA_8`

Since 1.0.0

### cd_transform_get_output_icc ()

    CdIcc *             cd_transform_get_output_icc         (CdTransform *transform);

Gets the input profile to use for the transform.

`transform` : | a CdTransform instance.
Returns : | The output profile. [transfer none]

Since 1.0.0

### cd_transform_get_output_pixel_format ()

    CdPixelFormat       cd_transform_get_output_pixel_format
                                                            (CdTransform *transform);

Gets the pixel format to use for the transform.

`transform` : | a CdTransform instance.
Returns : | the pixel format, e.g. `CD_PIXEL_FORMAT_RGBA_8`

Since 1.0.0

### cd_transform_set_abstract_icc ()

    void                cd_transform_set_abstract_icc       (CdTransform *transform,
                                                             CdIcc *icc);

Sets the abstract profile to use for the transform. This is typically only needed for soft-proofing.

`transform` : | a CdTransform instance.
`icc` : | a CdIcc instance or `NULL`.

Since 1.0.0

### cd_transform_get_abstract_icc ()

    CdIcc *             cd_transform_get_abstract_icc       (CdTransform *transform);

Gets the abstract profile to use for the transform.

`transform` : | a CdTransform instance.
Returns : | The abstract profile. [transfer none]

Since 1.0.0

### cd_transform_set_rendering_intent ()

    void                cd_transform_set_rendering_intent   (CdTransform *transform,
                                                             CdRenderingIntent rendering_intent);

Sets the rendering intent to use for the transform.

`transform` : | a CdTransform instance.
`rendering_intent` : | the rendering intent, e.g. `CD_RENDERING_INTENT_PERCEPTUAL`

Since 1.0.0

### cd_transform_get_rendering_intent ()

    CdRenderingIntent   cd_transform_get_rendering_intent   (CdTransform *transform);

Gets the rendering intent to use for the transform.

`transform` : | a CdTransform instance.
Returns : | The rendering intent, e.g. `CD_RENDERING_INTENT_PERCEPTUAL`

Since 1.0.0

### cd_transform_set_bpc ()

    void                cd_transform_set_bpc                (CdTransform *transform,
                                                             gboolean bpc);

Sets if black point compensation should be used for the transform.

`transform` : | a CdTransform instance.
`bpc` : | black point compensation

Since 1.0.0

### cd_transform_get_bpc ()

    gboolean            cd_transform_get_bpc                (CdTransform *transform);

Gets the rendering bpc to use for the transform.

`transform` : | a CdTransform instance.
Returns : | If black point compensation should be used for the transform.

Since 1.0.0

### cd_transform_process ()

    gboolean            cd_transform_process                (CdTransform *transform,
                                                             gpointer data_in,
                                                             gpointer data_out,
                                                             guint width,
                                                             guint height,
                                                             guint rowstride,
                                                             GCancellable *cancellable,
                                                             GError **error);

Processes a block of data through the transform. Once the transform has been setup it is cached and only re-created if any of the formats, input, output or abstract profiles are changed.

`transform` : | a CdTransform instance.
`data_in` : | the data buffer to convert
`data_out` : | the data buffer to return, which can be the same as `data_in`
`width` : | the width of `data_in`
`height` : | the height of `data_in`
`rowstride` : | the rowstride of `data_in`, typically the same as `width`
`cancellable` : | A `GError`, or `NULL`
`error` : | A `GCancellable`, or `NULL`
Returns : | `TRUE` if the pixels were successfully transformed.

Since 0.1.34