## GcmProfile

GcmProfile — A parser object that understands the ICC profile data format.

## Synopsis

    struct              GcmProfile;
    struct              GcmProfileClass;
    GcmProfile *        gcm_profile_new                     (void);
    gboolean            gcm_profile_parse                   (GcmProfile *profile,
                                                             GFile *file,
                                                             GError **error);
    gboolean            gcm_profile_parse_data              (GcmProfile *profile,
                                                             const guint8 *data,
                                                             gsize length,
                                                             GError **error);
    gboolean            gcm_profile_save                    (GcmProfile *profile,
                                                             const gchar *filename,
                                                             GError **error);
    gpointer            gcm_profile_get_handle              (GcmProfile *profile);
    const gchar *       gcm_profile_get_checksum            (GcmProfile *profile);
    gboolean            gcm_profile_get_can_delete          (GcmProfile *profile);
    GcmClut *           gcm_profile_generate_vcgt           (GcmProfile *profile,
                                                             guint size);
    GcmClut *           gcm_profile_generate_curve          (GcmProfile *profile,
                                                             guint size);
    gboolean            gcm_profile_set_vcgt_from_data      (GcmProfile *profile,
                                                             guint16 *red,
                                                             guint16 *green,
                                                             guint16 *blue,
                                                             guint size,
                                                             GError **error);
    gboolean            gcm_profile_set_whitepoint          (GcmProfile *profile,
                                                             const GcmColorXYZ *whitepoint,
                                                             GError **error);
    gboolean            gcm_profile_set_primaries           (GcmProfile *profile,
                                                             const GcmColorXYZ *red,
                                                             const GcmColorXYZ *green,
                                                             const GcmColorXYZ *blue,
                                                             GError **error);
    gboolean            gcm_profile_create_from_chroma      (GcmProfile *profile,
                                                             gdouble gamma,
                                                             const GcmColorYxy *red,
                                                             const GcmColorYxy *green,
                                                             const GcmColorYxy *blue,
                                                             const GcmColorYxy *white,
                                                             GError **error);
    gboolean            gcm_profile_guess_and_add_vcgt      (GcmProfile *profile,
                                                             GError **error);
    const gchar *       gcm_profile_get_description         (GcmProfile *profile);
    void                gcm_profile_set_description         (GcmProfile *profile,
                                                             const gchar *description);
    GFile *             gcm_profile_get_file                (GcmProfile *profile);
    void                gcm_profile_set_file                (GcmProfile *profile,
                                                             GFile *file);
    const gchar *       gcm_profile_get_filename            (GcmProfile *profile);
    const gchar *       gcm_profile_get_copyright           (GcmProfile *profile);
    void                gcm_profile_set_copyright           (GcmProfile *profile,
                                                             const gchar *copyright);
    const gchar *       gcm_profile_get_manufacturer        (GcmProfile *profile);
    void                gcm_profile_set_manufacturer        (GcmProfile *profile,
                                                             const gchar *manufacturer);
    const gchar *       gcm_profile_get_model               (GcmProfile *profile);
    void                gcm_profile_set_model               (GcmProfile *profile,
                                                             const gchar *model);
    const gchar *       gcm_profile_get_datetime            (GcmProfile *profile);
    void                gcm_profile_set_datetime            (GcmProfile *profile,
                                                             const gchar *datetime);
    guint               gcm_profile_get_size                (GcmProfile *profile);
    GcmProfileKind      gcm_profile_get_kind                (GcmProfile *profile);
    void                gcm_profile_set_kind                (GcmProfile *profile,
                                                             GcmProfileKind kind);
    GcmColorspace       gcm_profile_get_colorspace          (GcmProfile *profile);
    void                gcm_profile_set_colorspace          (GcmProfile *profile,
                                                             GcmColorspace colorspace);
    gboolean            gcm_profile_get_has_vcgt            (GcmProfile *profile);
    gboolean            gcm_profile_has_colorspace_description
                                                            (GcmProfile *profile);
    guint               gcm_profile_get_temperature         (GcmProfile *profile);
    const GcmColorXYZ * gcm_profile_get_red                 (GcmProfile *profile);
    const GcmColorXYZ * gcm_profile_get_green               (GcmProfile *profile);
    const GcmColorXYZ * gcm_profile_get_blue                (GcmProfile *profile);
    const GcmColorXYZ * gcm_profile_get_white               (GcmProfile *profile);
    const gchar *       gcm_profile_get_data                (GcmProfile *profile,
                                                             const gchar *key);
    void                gcm_profile_set_data                (GcmProfile *profile,
                                                             const gchar *key,
                                                             const gchar *data);
                        GcmProfilePrivate;

## Object Hierarchy

      GObject
       +----GcmProfile

## Properties

      "black"                    GcmColorXYZ*          : Read / Write
      "blue"                     GcmColorXYZ*          : Read / Write
      "can-delete"               gboolean              : Read
      "checksum"                 gchar*                : Read
      "colorspace"               guint                 : Read / Write
      "copyright"                gchar*                : Read / Write
      "datetime"                 gchar*                : Read / Write
      "description"              gchar*                : Read / Write
      "file"                     GFile*                : Read / Write
      "green"                    GcmColorXYZ*          : Read / Write
      "has-vcgt"                 gboolean              : Read / Write
      "kind"                     guint                 : Read / Write
      "manufacturer"             gchar*                : Read / Write
      "model"                    gchar*                : Read / Write
      "red"                      GcmColorXYZ*          : Read / Write
      "size"                     guint                 : Read / Write
      "temperature"              guint                 : Read
      "white"                    GcmColorXYZ*          : Read / Write

## Description

This object is a simple parser for the ICC binary profile data. If only understands a subset of the ICC profile, just enought to get some metadata and the LUT.

## Details

### struct GcmProfile

    struct GcmProfile;

### struct GcmProfileClass

    struct GcmProfileClass {
    	GObjectClass	 parent_class;

    	/* padding for future expansion */
    	void (*_gcm_reserved1) (void);
    	void (*_gcm_reserved2) (void);
    	void (*_gcm_reserved3) (void);
    	void (*_gcm_reserved4) (void);
    	void (*_gcm_reserved5) (void);
    };

### gcm_profile_new ()

    GcmProfile *        gcm_profile_new                     (void);

Returns : | a new GcmProfile object.

Since 2.91.1

### gcm_profile_parse ()

    gboolean            gcm_profile_parse                   (GcmProfile *profile,
                                                             GFile *file,
                                                             GError **error);

Parses a profile file, filling in all the details possible.

`profile` : | A valid GcmProfile
`file` : | A GFile pointing to a profile
`error` : | A GError, or `NULL`
Returns : | `TRUE` for success

Since 2.91.1

### gcm_profile_parse_data ()

    gboolean            gcm_profile_parse_data              (GcmProfile *profile,
                                                             const guint8 *data,
                                                             gsize length,
                                                             GError **error);

Parses profile data, filling in all the details possible.

`profile` : | A valid GcmProfile
`data` : | the data to parse
`length` : | the length of `data`
`error` : | A GError, or `NULL`
Returns : | `TRUE` for success

Since 2.91.1

### gcm_profile_save ()

    gboolean            gcm_profile_save                    (GcmProfile *profile,
                                                             const gchar *filename,
                                                             GError **error);

Saves the profile data to a file.

`profile` : | A valid GcmProfile
`filename` : | the data to parse
`error` : | A GError, or `NULL`
Returns : | `TRUE` for success

Since 2.91.1

### gcm_profile_get_handle ()

    gpointer            gcm_profile_get_handle              (GcmProfile *profile);

Returns : | Do not call `cmsCloseProfile()` on this value!

Since 2.91.1

### gcm_profile_get_checksum ()

    const gchar *       gcm_profile_get_checksum            (GcmProfile *profile);

Since 2.91.1

### gcm_profile_get_can_delete ()

    gboolean            gcm_profile_get_can_delete          (GcmProfile *profile);

Since 2.91.1

### gcm_profile_generate_vcgt ()

    GcmClut *           gcm_profile_generate_vcgt           (GcmProfile *profile,
                                                             guint size);

Generates a VCGT table of a specified size.

`profile` : | A valid GcmProfile
`size` : | the size of the table to generate
Returns : | A GcmClut object, or `NULL`. Free with `g_object_unref()`

Since 2.91.1

### gcm_profile_generate_curve ()

    GcmClut *           gcm_profile_generate_curve          (GcmProfile *profile,
                                                             guint size);

Generates a curve of a specified size.

`profile` : | A valid GcmProfile
`size` : | the size of the curve to generate
Returns : | A GcmClut object, or `NULL`. Free with `g_object_unref()`

Since 2.91.1

### gcm_profile_set_vcgt_from_data ()

    gboolean            gcm_profile_set_vcgt_from_data      (GcmProfile *profile,
                                                             guint16 *red,
                                                             guint16 *green,
                                                             guint16 *blue,
                                                             guint size,
                                                             GError **error);

Sets a VCGT curve of a specified size.

`profile` : | A valid GcmProfile
`red` : | red color data
`green` : | green color data
`blue` : | blue color data
`size` : | the size of the color curves.
Returns : | `TRUE` for success

Since 2.91.1

### gcm_profile_set_whitepoint ()

    gboolean            gcm_profile_set_whitepoint          (GcmProfile *profile,
                                                             const GcmColorXYZ *whitepoint,
                                                             GError **error);

Saves the whitepoint data to a file.

`profile` : | A valid GcmProfile
`whitepoint` : | the whitepoint
`error` : | A GError, or `NULL`
Returns : | `TRUE` for success

Since 2.91.1

### gcm_profile_set_primaries ()

    gboolean            gcm_profile_set_primaries           (GcmProfile *profile,
                                                             const GcmColorXYZ *red,
                                                             const GcmColorXYZ *green,
                                                             const GcmColorXYZ *blue,
                                                             GError **error);

Saves the primaries data to a file.

`profile` : | A valid GcmProfile
`red` : | the red primary
`green` : | the green primary
`blue` : | the blue primary
`error` : | A GError, or `NULL`
Returns : | `TRUE` for success

Since 2.91.1

### gcm_profile_create_from_chroma ()

    gboolean            gcm_profile_create_from_chroma      (GcmProfile *profile,
                                                             gdouble gamma,
                                                             const GcmColorYxy *red,
                                                             const GcmColorYxy *green,
                                                             const GcmColorYxy *blue,
                                                             const GcmColorYxy *white,
                                                             GError **error);

Saves the profile data to a file.

`profile` : | A valid GcmProfile
`red` : | primary color data
`green` : | primary color data
`blue` : | primary color data
`white` : | whitepoint data
`error` : | A GError, or `NULL`
Returns : | `TRUE` for success

Since 2.91.1

### gcm_profile_guess_and_add_vcgt ()

    gboolean            gcm_profile_guess_and_add_vcgt      (GcmProfile *profile,
                                                             GError **error);

Runs a grey image through the profile, to guess semi-correct VCGT curves

`profile` : | A valid GcmProfile
`error` : | A GError, or `NULL`
Returns : | `TRUE` for success

Since 2.91.1

### gcm_profile_get_description ()

    const gchar *       gcm_profile_get_description         (GcmProfile *profile);

Gets the profile description.

`profile` : | A valid GcmProfile
Returns : | The profile description as a string.

Since 2.91.1

### gcm_profile_set_description ()

    void                gcm_profile_set_description         (GcmProfile *profile,
                                                             const gchar *description);

Sets the description of the profile.

`profile` : | A valid GcmProfile
`description` : | the data location to read into

Since 2.91.1

### gcm_profile_get_file ()

    GFile *             gcm_profile_get_file                (GcmProfile *profile);

Gets the file attached to this profile.

`profile` : | A valid GcmProfile
Returns : | A GFile, or `NULL`. Do not free.

Since 2.91.1

### gcm_profile_set_file ()

    void                gcm_profile_set_file                (GcmProfile *profile,
                                                             GFile *file);

Sets the file to be used when reading the profile.

`profile` : | A valid GcmProfile
`file` : | A GFile to read

Since 2.91.1

### gcm_profile_get_filename ()

    const gchar *       gcm_profile_get_filename            (GcmProfile *profile);

Gets the filename of the profile data, if one exists.

`profile` : | A valid GcmProfile
Returns : | A filename, or `NULL`

Since 2.91.1

### gcm_profile_get_copyright ()

    const gchar *       gcm_profile_get_copyright           (GcmProfile *profile);

Gets the copyright string for this profile.

`profile` : | A valid GcmProfile
Returns : | A string. Do not free.

Since 2.91.1

### gcm_profile_set_copyright ()

    void                gcm_profile_set_copyright           (GcmProfile *profile,
                                                             const gchar *copyright);

Sets the copyright string.

`profile` : | A valid GcmProfile
`copyright` : | the copyright string

Since 2.91.1

### gcm_profile_get_manufacturer ()

    const gchar *       gcm_profile_get_manufacturer        (GcmProfile *profile);

Gets the device manufacturer name.

`profile` : | A valid GcmProfile
Returns : | A string. Do not free.

Since 2.91.1

### gcm_profile_set_manufacturer ()

    void                gcm_profile_set_manufacturer        (GcmProfile *profile,
                                                             const gchar *manufacturer);

Sets the device manufacturer name.

`profile` : | A valid GcmProfile
`manufacturer` : | the profile manufacturer.

Since 2.91.1

### gcm_profile_get_model ()

    const gchar *       gcm_profile_get_model               (GcmProfile *profile);

Gets the device model name.

`profile` : | A valid GcmProfile
Returns : | A string. Do not free.

Since 2.91.1

### gcm_profile_set_model ()

    void                gcm_profile_set_model               (GcmProfile *profile,
                                                             const gchar *model);

Sets the device model name.

`profile` : | A valid GcmProfile
`model` : | the profile model.

Since 2.91.1

### gcm_profile_get_datetime ()

    const gchar *       gcm_profile_get_datetime            (GcmProfile *profile);

Gets the profile date and time.

`profile` : | A valid GcmProfile
Returns : | A string. Do not free.

Since 2.91.1

### gcm_profile_set_datetime ()

    void                gcm_profile_set_datetime            (GcmProfile *profile,
                                                             const gchar *datetime);

Sets the profile date and time.

`profile` : | A valid GcmProfile
`datetime` : | the profile date time.

Since 2.91.1

### gcm_profile_get_size ()

    guint               gcm_profile_get_size                (GcmProfile *profile);

Since 2.91.1

### gcm_profile_get_kind ()

    GcmProfileKind      gcm_profile_get_kind                (GcmProfile *profile);

Since 2.91.1

### gcm_profile_set_kind ()

    void                gcm_profile_set_kind                (GcmProfile *profile,
                                                             GcmProfileKind kind);

Since 2.91.1

### gcm_profile_get_colorspace ()

    GcmColorspace       gcm_profile_get_colorspace          (GcmProfile *profile);

Since 2.91.1

### gcm_profile_set_colorspace ()

    void                gcm_profile_set_colorspace          (GcmProfile *profile,
                                                             GcmColorspace colorspace);

Since 2.91.1

### gcm_profile_get_has_vcgt ()

    gboolean            gcm_profile_get_has_vcgt            (GcmProfile *profile);

Since 2.91.1

### gcm_profile_has_colorspace_description ()

    gboolean            gcm_profile_has_colorspace_description
                                                            (GcmProfile *profile);

Finds out if the profile contains a colorspace description.

`profile` : | A valid GcmProfile
Returns : | `TRUE` if the description mentions the profile colorspace explicity, e.g. "Adobe RGB" for `GCM_COLORSPACE_RGB`.

Since 2.91.1

### gcm_profile_get_temperature ()

    guint               gcm_profile_get_temperature         (GcmProfile *profile);

Gets the profile color temperature, rounded to the nearest 100K.

`profile` : | A valid GcmProfile
Returns : | The color temperature in Kelvins, or 0 for error.

Since 2.91.1

### gcm_profile_get_red ()

    const GcmColorXYZ * gcm_profile_get_red                 (GcmProfile *profile);

Gets the monitor red chromaticity value.

`profile` : | a valid GcmProfile instance
Returns : | the GcmColorXYZ value

Since 2.91.1

### gcm_profile_get_green ()

    const GcmColorXYZ * gcm_profile_get_green               (GcmProfile *profile);

Gets the monitor green chromaticity value.

`profile` : | a valid GcmProfile instance
Returns : | the GcmColorXYZ value

Since 2.91.1

### gcm_profile_get_blue ()

    const GcmColorXYZ * gcm_profile_get_blue                (GcmProfile *profile);

Gets the monitor red chromaticity value.

`profile` : | a valid GcmProfile instance
Returns : | the GcmColorXYZ value

Since 2.91.1

### gcm_profile_get_white ()

    const GcmColorXYZ * gcm_profile_get_white               (GcmProfile *profile);

Gets the monitor white chromaticity value.

`profile` : | a valid GcmProfile instance
Returns : | the GcmColorXYZ value

Since 2.91.1

### gcm_profile_get_data ()

    const gchar *       gcm_profile_get_data                (GcmProfile *profile,
                                                             const gchar *key);

Sets an item of data from the profile dictionary, overwriting it if it already exists.

`profile` : | A valid GcmProfile
`key` : | the dictionary key

Since 2.91.2

### gcm_profile_set_data ()

    void                gcm_profile_set_data                (GcmProfile *profile,
                                                             const gchar *key,
                                                             const gchar *data);

### GcmProfilePrivate

    typedef struct _GcmProfilePrivate GcmProfilePrivate;

Private GcmProfile data

## Property Details

### The `"black"` property

      "black"                    GcmColorXYZ*          : Read / Write

### The `"blue"` property

      "blue"                     GcmColorXYZ*          : Read / Write

### The `"can-delete"` property

      "can-delete"               gboolean              : Read

Default value: FALSE

### The `"checksum"` property

      "checksum"                 gchar*                : Read

Default value: NULL

### The `"colorspace"` property

      "colorspace"               guint                 : Read / Write

Default value: 0

### The `"copyright"` property

      "copyright"                gchar*                : Read / Write

Default value: NULL

### The `"datetime"` property

      "datetime"                 gchar*                : Read / Write

Default value: NULL

### The `"description"` property

      "description"              gchar*                : Read / Write

Default value: NULL

### The `"file"` property

      "file"                     GFile*                : Read / Write

### The `"green"` property

      "green"                    GcmColorXYZ*          : Read / Write

### The `"has-vcgt"` property

      "has-vcgt"                 gboolean              : Read / Write

Default value: FALSE

### The `"kind"` property

      "kind"                     guint                 : Read / Write

Default value: 0

### The `"manufacturer"` property

      "manufacturer"             gchar*                : Read / Write

Default value: NULL

### The `"model"` property

      "model"                    gchar*                : Read / Write

Default value: NULL

### The `"red"` property

      "red"                      GcmColorXYZ*          : Read / Write

### The `"size"` property

      "size"                     guint                 : Read / Write

Default value: 0

### The `"temperature"` property

      "temperature"              guint                 : Read

Default value: 0

### The `"white"` property

      "white"                    GcmColorXYZ*          : Read / Write