563 lines
17 KiB
C
563 lines
17 KiB
C
|
/* LIBPIKA - The PIKA Library
|
||
|
* Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
|
||
|
*
|
||
|
* pikaimagecolorprofile_pdb.c
|
||
|
*
|
||
|
* This library is free software: you can redistribute it and/or
|
||
|
* modify it under the terms of the GNU Lesser General Public
|
||
|
* License as published by the Free Software Foundation; either
|
||
|
* version 3 of the License, or (at your option) any later version.
|
||
|
*
|
||
|
* This library is distributed in the hope that it will be useful,
|
||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||
|
* Lesser General Public License for more details.
|
||
|
*
|
||
|
* You should have received a copy of the GNU Lesser General Public
|
||
|
* License along with this library. If not, see
|
||
|
* <https://www.gnu.org/licenses/>.
|
||
|
*/
|
||
|
|
||
|
/* NOTE: This file is auto-generated by pdbgen.pl */
|
||
|
|
||
|
#include "config.h"
|
||
|
|
||
|
#include "stamp-pdbgen.h"
|
||
|
|
||
|
#include "pika.h"
|
||
|
|
||
|
|
||
|
/**
|
||
|
* SECTION: pikaimagecolorprofile
|
||
|
* @title: pikaimagecolorprofile
|
||
|
* @short_description: Operations on an image's color profile.
|
||
|
*
|
||
|
* Operations on an image's color profile.
|
||
|
**/
|
||
|
|
||
|
|
||
|
/**
|
||
|
* _pika_image_get_color_profile:
|
||
|
* @image: The image.
|
||
|
*
|
||
|
* Returns the image's color profile
|
||
|
*
|
||
|
* This procedure returns the image's color profile, or NULL if the
|
||
|
* image has no color profile assigned.
|
||
|
*
|
||
|
* Returns: (transfer full): The image's serialized color profile.
|
||
|
*
|
||
|
* Since: 2.10
|
||
|
**/
|
||
|
GBytes *
|
||
|
_pika_image_get_color_profile (PikaImage *image)
|
||
|
{
|
||
|
PikaValueArray *args;
|
||
|
PikaValueArray *return_vals;
|
||
|
GBytes *profile_data = NULL;
|
||
|
|
||
|
args = pika_value_array_new_from_types (NULL,
|
||
|
PIKA_TYPE_IMAGE, image,
|
||
|
G_TYPE_NONE);
|
||
|
|
||
|
return_vals = pika_pdb_run_procedure_array (pika_get_pdb (),
|
||
|
"pika-image-get-color-profile",
|
||
|
args);
|
||
|
pika_value_array_unref (args);
|
||
|
|
||
|
if (PIKA_VALUES_GET_ENUM (return_vals, 0) == PIKA_PDB_SUCCESS)
|
||
|
profile_data = PIKA_VALUES_DUP_BYTES (return_vals, 1);
|
||
|
|
||
|
pika_value_array_unref (return_vals);
|
||
|
|
||
|
return profile_data;
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* _pika_image_get_effective_color_profile:
|
||
|
* @image: The image.
|
||
|
*
|
||
|
* Returns the color profile that is used for the image
|
||
|
*
|
||
|
* This procedure returns the color profile that is actually used for
|
||
|
* this image, which is the profile returned by
|
||
|
* pika_image_get_color_profile() if the image has a profile assigned,
|
||
|
* or a generated default RGB or grayscale profile, according to the
|
||
|
* image's type.
|
||
|
*
|
||
|
* Returns: (transfer full): The image's serialized color profile.
|
||
|
*
|
||
|
* Since: 2.10
|
||
|
**/
|
||
|
GBytes *
|
||
|
_pika_image_get_effective_color_profile (PikaImage *image)
|
||
|
{
|
||
|
PikaValueArray *args;
|
||
|
PikaValueArray *return_vals;
|
||
|
GBytes *profile_data = NULL;
|
||
|
|
||
|
args = pika_value_array_new_from_types (NULL,
|
||
|
PIKA_TYPE_IMAGE, image,
|
||
|
G_TYPE_NONE);
|
||
|
|
||
|
return_vals = pika_pdb_run_procedure_array (pika_get_pdb (),
|
||
|
"pika-image-get-effective-color-profile",
|
||
|
args);
|
||
|
pika_value_array_unref (args);
|
||
|
|
||
|
if (PIKA_VALUES_GET_ENUM (return_vals, 0) == PIKA_PDB_SUCCESS)
|
||
|
profile_data = PIKA_VALUES_DUP_BYTES (return_vals, 1);
|
||
|
|
||
|
pika_value_array_unref (return_vals);
|
||
|
|
||
|
return profile_data;
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* _pika_image_set_color_profile:
|
||
|
* @image: The image.
|
||
|
* @color_profile: The new serialized color profile.
|
||
|
*
|
||
|
* Sets the image's color profile
|
||
|
*
|
||
|
* This procedure sets the image's color profile, or unsets it if NULL
|
||
|
* is passed as 'color_profile'. This procedure does no color
|
||
|
* conversion. However, it will change the pixel format of all layers
|
||
|
* to contain the babl space matching the profile. You must call this
|
||
|
* procedure before adding layers to the image.
|
||
|
*
|
||
|
* Returns: TRUE on success.
|
||
|
*
|
||
|
* Since: 2.10
|
||
|
**/
|
||
|
gboolean
|
||
|
_pika_image_set_color_profile (PikaImage *image,
|
||
|
GBytes *color_profile)
|
||
|
{
|
||
|
PikaValueArray *args;
|
||
|
PikaValueArray *return_vals;
|
||
|
gboolean success = TRUE;
|
||
|
|
||
|
args = pika_value_array_new_from_types (NULL,
|
||
|
PIKA_TYPE_IMAGE, image,
|
||
|
G_TYPE_BYTES, color_profile,
|
||
|
G_TYPE_NONE);
|
||
|
|
||
|
return_vals = pika_pdb_run_procedure_array (pika_get_pdb (),
|
||
|
"pika-image-set-color-profile",
|
||
|
args);
|
||
|
pika_value_array_unref (args);
|
||
|
|
||
|
success = PIKA_VALUES_GET_ENUM (return_vals, 0) == PIKA_PDB_SUCCESS;
|
||
|
|
||
|
pika_value_array_unref (return_vals);
|
||
|
|
||
|
return success;
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* pika_image_set_color_profile_from_file:
|
||
|
* @image: The image.
|
||
|
* @file: The file containing the new color profile.
|
||
|
*
|
||
|
* Sets the image's color profile from an ICC file
|
||
|
*
|
||
|
* This procedure sets the image's color profile from a file containing
|
||
|
* an ICC profile, or unsets it if NULL is passed as 'file'. This
|
||
|
* procedure does no color conversion. However, it will change the
|
||
|
* pixel format of all layers to contain the babl space matching the
|
||
|
* profile. You must call this procedure before adding layers to the
|
||
|
* image.
|
||
|
*
|
||
|
* Returns: TRUE on success.
|
||
|
*
|
||
|
* Since: 2.10
|
||
|
**/
|
||
|
gboolean
|
||
|
pika_image_set_color_profile_from_file (PikaImage *image,
|
||
|
GFile *file)
|
||
|
{
|
||
|
PikaValueArray *args;
|
||
|
PikaValueArray *return_vals;
|
||
|
gboolean success = TRUE;
|
||
|
|
||
|
args = pika_value_array_new_from_types (NULL,
|
||
|
PIKA_TYPE_IMAGE, image,
|
||
|
G_TYPE_FILE, file,
|
||
|
G_TYPE_NONE);
|
||
|
|
||
|
return_vals = pika_pdb_run_procedure_array (pika_get_pdb (),
|
||
|
"pika-image-set-color-profile-from-file",
|
||
|
args);
|
||
|
pika_value_array_unref (args);
|
||
|
|
||
|
success = PIKA_VALUES_GET_ENUM (return_vals, 0) == PIKA_PDB_SUCCESS;
|
||
|
|
||
|
pika_value_array_unref (return_vals);
|
||
|
|
||
|
return success;
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* _pika_image_get_simulation_profile:
|
||
|
* @image: The image.
|
||
|
*
|
||
|
* Returns the image's simulation color profile
|
||
|
*
|
||
|
* This procedure returns the image's simulation color profile, or NULL
|
||
|
* if the image has no simulation color profile assigned.
|
||
|
*
|
||
|
* Returns: (transfer full): The image's serialized simulation color profile.
|
||
|
*
|
||
|
* Since: 3.0
|
||
|
**/
|
||
|
GBytes *
|
||
|
_pika_image_get_simulation_profile (PikaImage *image)
|
||
|
{
|
||
|
PikaValueArray *args;
|
||
|
PikaValueArray *return_vals;
|
||
|
GBytes *profile_data = NULL;
|
||
|
|
||
|
args = pika_value_array_new_from_types (NULL,
|
||
|
PIKA_TYPE_IMAGE, image,
|
||
|
G_TYPE_NONE);
|
||
|
|
||
|
return_vals = pika_pdb_run_procedure_array (pika_get_pdb (),
|
||
|
"pika-image-get-simulation-profile",
|
||
|
args);
|
||
|
pika_value_array_unref (args);
|
||
|
|
||
|
if (PIKA_VALUES_GET_ENUM (return_vals, 0) == PIKA_PDB_SUCCESS)
|
||
|
profile_data = PIKA_VALUES_DUP_BYTES (return_vals, 1);
|
||
|
|
||
|
pika_value_array_unref (return_vals);
|
||
|
|
||
|
return profile_data;
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* _pika_image_set_simulation_profile:
|
||
|
* @image: The image.
|
||
|
* @color_profile: The new serialized simulation color profile.
|
||
|
*
|
||
|
* Sets the image's simulation color profile
|
||
|
*
|
||
|
* This procedure sets the image's simulation color profile, or unsets
|
||
|
* it if NULL is passed as 'color_profile'. This procedure does no
|
||
|
* color conversion.
|
||
|
*
|
||
|
* Returns: TRUE on success.
|
||
|
*
|
||
|
* Since: 3.0
|
||
|
**/
|
||
|
gboolean
|
||
|
_pika_image_set_simulation_profile (PikaImage *image,
|
||
|
GBytes *color_profile)
|
||
|
{
|
||
|
PikaValueArray *args;
|
||
|
PikaValueArray *return_vals;
|
||
|
gboolean success = TRUE;
|
||
|
|
||
|
args = pika_value_array_new_from_types (NULL,
|
||
|
PIKA_TYPE_IMAGE, image,
|
||
|
G_TYPE_BYTES, color_profile,
|
||
|
G_TYPE_NONE);
|
||
|
|
||
|
return_vals = pika_pdb_run_procedure_array (pika_get_pdb (),
|
||
|
"pika-image-set-simulation-profile",
|
||
|
args);
|
||
|
pika_value_array_unref (args);
|
||
|
|
||
|
success = PIKA_VALUES_GET_ENUM (return_vals, 0) == PIKA_PDB_SUCCESS;
|
||
|
|
||
|
pika_value_array_unref (return_vals);
|
||
|
|
||
|
return success;
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* pika_image_set_simulation_profile_from_file:
|
||
|
* @image: The image.
|
||
|
* @file: The file containing the new simulation color profile.
|
||
|
*
|
||
|
* Sets the image's simulation color profile from an ICC file
|
||
|
*
|
||
|
* This procedure sets the image's simulation color profile from a file
|
||
|
* containing an ICC profile, or unsets it if NULL is passed as 'file'.
|
||
|
* This procedure does no color conversion.
|
||
|
*
|
||
|
* Returns: TRUE on success.
|
||
|
*
|
||
|
* Since: 3.0
|
||
|
**/
|
||
|
gboolean
|
||
|
pika_image_set_simulation_profile_from_file (PikaImage *image,
|
||
|
GFile *file)
|
||
|
{
|
||
|
PikaValueArray *args;
|
||
|
PikaValueArray *return_vals;
|
||
|
gboolean success = TRUE;
|
||
|
|
||
|
args = pika_value_array_new_from_types (NULL,
|
||
|
PIKA_TYPE_IMAGE, image,
|
||
|
G_TYPE_FILE, file,
|
||
|
G_TYPE_NONE);
|
||
|
|
||
|
return_vals = pika_pdb_run_procedure_array (pika_get_pdb (),
|
||
|
"pika-image-set-simulation-profile-from-file",
|
||
|
args);
|
||
|
pika_value_array_unref (args);
|
||
|
|
||
|
success = PIKA_VALUES_GET_ENUM (return_vals, 0) == PIKA_PDB_SUCCESS;
|
||
|
|
||
|
pika_value_array_unref (return_vals);
|
||
|
|
||
|
return success;
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* pika_image_get_simulation_intent:
|
||
|
* @image: The image.
|
||
|
*
|
||
|
* Returns the image's simulation rendering intent
|
||
|
*
|
||
|
* This procedure returns the image's simulation rendering intent.
|
||
|
*
|
||
|
* Returns: The image's simulation rendering intent.
|
||
|
*
|
||
|
* Since: 3.0
|
||
|
**/
|
||
|
PikaColorRenderingIntent
|
||
|
pika_image_get_simulation_intent (PikaImage *image)
|
||
|
{
|
||
|
PikaValueArray *args;
|
||
|
PikaValueArray *return_vals;
|
||
|
PikaColorRenderingIntent intent = 0;
|
||
|
|
||
|
args = pika_value_array_new_from_types (NULL,
|
||
|
PIKA_TYPE_IMAGE, image,
|
||
|
G_TYPE_NONE);
|
||
|
|
||
|
return_vals = pika_pdb_run_procedure_array (pika_get_pdb (),
|
||
|
"pika-image-get-simulation-intent",
|
||
|
args);
|
||
|
pika_value_array_unref (args);
|
||
|
|
||
|
if (PIKA_VALUES_GET_ENUM (return_vals, 0) == PIKA_PDB_SUCCESS)
|
||
|
intent = PIKA_VALUES_GET_ENUM (return_vals, 1);
|
||
|
|
||
|
pika_value_array_unref (return_vals);
|
||
|
|
||
|
return intent;
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* pika_image_set_simulation_intent:
|
||
|
* @image: The image.
|
||
|
* @intent: A PikaColorRenderingIntent.
|
||
|
*
|
||
|
* Sets the image's simulation rendering intent
|
||
|
*
|
||
|
* This procedure sets the image's simulation rendering intent.
|
||
|
*
|
||
|
* Returns: TRUE on success.
|
||
|
*
|
||
|
* Since: 3.0
|
||
|
**/
|
||
|
gboolean
|
||
|
pika_image_set_simulation_intent (PikaImage *image,
|
||
|
PikaColorRenderingIntent intent)
|
||
|
{
|
||
|
PikaValueArray *args;
|
||
|
PikaValueArray *return_vals;
|
||
|
gboolean success = TRUE;
|
||
|
|
||
|
args = pika_value_array_new_from_types (NULL,
|
||
|
PIKA_TYPE_IMAGE, image,
|
||
|
PIKA_TYPE_COLOR_RENDERING_INTENT, intent,
|
||
|
G_TYPE_NONE);
|
||
|
|
||
|
return_vals = pika_pdb_run_procedure_array (pika_get_pdb (),
|
||
|
"pika-image-set-simulation-intent",
|
||
|
args);
|
||
|
pika_value_array_unref (args);
|
||
|
|
||
|
success = PIKA_VALUES_GET_ENUM (return_vals, 0) == PIKA_PDB_SUCCESS;
|
||
|
|
||
|
pika_value_array_unref (return_vals);
|
||
|
|
||
|
return success;
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* pika_image_get_simulation_bpc:
|
||
|
* @image: The image.
|
||
|
*
|
||
|
* Returns whether the image has Black Point Compensation enabled for
|
||
|
* its simulation
|
||
|
*
|
||
|
* This procedure returns whether the image has Black Point
|
||
|
* Compensation enabled for its simulation
|
||
|
*
|
||
|
* Returns: The Black Point Compensation status.
|
||
|
*
|
||
|
* Since: 3.0
|
||
|
**/
|
||
|
gboolean
|
||
|
pika_image_get_simulation_bpc (PikaImage *image)
|
||
|
{
|
||
|
PikaValueArray *args;
|
||
|
PikaValueArray *return_vals;
|
||
|
gboolean bpc = FALSE;
|
||
|
|
||
|
args = pika_value_array_new_from_types (NULL,
|
||
|
PIKA_TYPE_IMAGE, image,
|
||
|
G_TYPE_NONE);
|
||
|
|
||
|
return_vals = pika_pdb_run_procedure_array (pika_get_pdb (),
|
||
|
"pika-image-get-simulation-bpc",
|
||
|
args);
|
||
|
pika_value_array_unref (args);
|
||
|
|
||
|
if (PIKA_VALUES_GET_ENUM (return_vals, 0) == PIKA_PDB_SUCCESS)
|
||
|
bpc = PIKA_VALUES_GET_BOOLEAN (return_vals, 1);
|
||
|
|
||
|
pika_value_array_unref (return_vals);
|
||
|
|
||
|
return bpc;
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* pika_image_set_simulation_bpc:
|
||
|
* @image: The image.
|
||
|
* @bpc: The Black Point Compensation status.
|
||
|
*
|
||
|
* Sets whether the image has Black Point Compensation enabled for its
|
||
|
* simulation
|
||
|
*
|
||
|
* This procedure whether the image has Black Point Compensation
|
||
|
* enabled for its simulation
|
||
|
*
|
||
|
* Returns: TRUE on success.
|
||
|
*
|
||
|
* Since: 3.0
|
||
|
**/
|
||
|
gboolean
|
||
|
pika_image_set_simulation_bpc (PikaImage *image,
|
||
|
gboolean bpc)
|
||
|
{
|
||
|
PikaValueArray *args;
|
||
|
PikaValueArray *return_vals;
|
||
|
gboolean success = TRUE;
|
||
|
|
||
|
args = pika_value_array_new_from_types (NULL,
|
||
|
PIKA_TYPE_IMAGE, image,
|
||
|
G_TYPE_BOOLEAN, bpc,
|
||
|
G_TYPE_NONE);
|
||
|
|
||
|
return_vals = pika_pdb_run_procedure_array (pika_get_pdb (),
|
||
|
"pika-image-set-simulation-bpc",
|
||
|
args);
|
||
|
pika_value_array_unref (args);
|
||
|
|
||
|
success = PIKA_VALUES_GET_ENUM (return_vals, 0) == PIKA_PDB_SUCCESS;
|
||
|
|
||
|
pika_value_array_unref (return_vals);
|
||
|
|
||
|
return success;
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* _pika_image_convert_color_profile:
|
||
|
* @image: The image.
|
||
|
* @color_profile: The serialized color profile.
|
||
|
* @intent: Rendering intent.
|
||
|
* @bpc: Black point compensation.
|
||
|
*
|
||
|
* Convert the image's layers to a color profile
|
||
|
*
|
||
|
* This procedure converts from the image's color profile (or the
|
||
|
* default RGB or grayscale profile if none is set) to the given color
|
||
|
* profile. Only RGB and grayscale color profiles are accepted,
|
||
|
* according to the image's type.
|
||
|
*
|
||
|
* Returns: TRUE on success.
|
||
|
*
|
||
|
* Since: 2.10
|
||
|
**/
|
||
|
gboolean
|
||
|
_pika_image_convert_color_profile (PikaImage *image,
|
||
|
GBytes *color_profile,
|
||
|
PikaColorRenderingIntent intent,
|
||
|
gboolean bpc)
|
||
|
{
|
||
|
PikaValueArray *args;
|
||
|
PikaValueArray *return_vals;
|
||
|
gboolean success = TRUE;
|
||
|
|
||
|
args = pika_value_array_new_from_types (NULL,
|
||
|
PIKA_TYPE_IMAGE, image,
|
||
|
G_TYPE_BYTES, color_profile,
|
||
|
PIKA_TYPE_COLOR_RENDERING_INTENT, intent,
|
||
|
G_TYPE_BOOLEAN, bpc,
|
||
|
G_TYPE_NONE);
|
||
|
|
||
|
return_vals = pika_pdb_run_procedure_array (pika_get_pdb (),
|
||
|
"pika-image-convert-color-profile",
|
||
|
args);
|
||
|
pika_value_array_unref (args);
|
||
|
|
||
|
success = PIKA_VALUES_GET_ENUM (return_vals, 0) == PIKA_PDB_SUCCESS;
|
||
|
|
||
|
pika_value_array_unref (return_vals);
|
||
|
|
||
|
return success;
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* pika_image_convert_color_profile_from_file:
|
||
|
* @image: The image.
|
||
|
* @file: The file containing the new color profile.
|
||
|
* @intent: Rendering intent.
|
||
|
* @bpc: Black point compensation.
|
||
|
*
|
||
|
* Convert the image's layers to a color profile
|
||
|
*
|
||
|
* This procedure converts from the image's color profile (or the
|
||
|
* default RGB or grayscale profile if none is set) to an ICC profile
|
||
|
* specified by 'file'. Only RGB and grayscale color profiles are
|
||
|
* accepted, according to the image's type.
|
||
|
*
|
||
|
* Returns: TRUE on success.
|
||
|
*
|
||
|
* Since: 2.10
|
||
|
**/
|
||
|
gboolean
|
||
|
pika_image_convert_color_profile_from_file (PikaImage *image,
|
||
|
GFile *file,
|
||
|
PikaColorRenderingIntent intent,
|
||
|
gboolean bpc)
|
||
|
{
|
||
|
PikaValueArray *args;
|
||
|
PikaValueArray *return_vals;
|
||
|
gboolean success = TRUE;
|
||
|
|
||
|
args = pika_value_array_new_from_types (NULL,
|
||
|
PIKA_TYPE_IMAGE, image,
|
||
|
G_TYPE_FILE, file,
|
||
|
PIKA_TYPE_COLOR_RENDERING_INTENT, intent,
|
||
|
G_TYPE_BOOLEAN, bpc,
|
||
|
G_TYPE_NONE);
|
||
|
|
||
|
return_vals = pika_pdb_run_procedure_array (pika_get_pdb (),
|
||
|
"pika-image-convert-color-profile-from-file",
|
||
|
args);
|
||
|
pika_value_array_unref (args);
|
||
|
|
||
|
success = PIKA_VALUES_GET_ENUM (return_vals, 0) == PIKA_PDB_SUCCESS;
|
||
|
|
||
|
pika_value_array_unref (return_vals);
|
||
|
|
||
|
return success;
|
||
|
}
|