2015-06-05 18:51:46 +08:00
|
|
|
/* LIBGIMP - The GIMP Library
|
|
|
|
* Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
|
|
|
|
*
|
|
|
|
* gimpimagecolorprofile_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
|
2018-07-12 05:27:07 +08:00
|
|
|
* <https://www.gnu.org/licenses/>.
|
2015-06-05 18:51:46 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
/* NOTE: This file is auto-generated by pdbgen.pl */
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
#include "gimp.h"
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2019-07-31 16:04:43 +08:00
|
|
|
* SECTION: gimpimagecolorprofile
|
2015-06-05 18:51:46 +08:00
|
|
|
* @title: gimpimagecolorprofile
|
|
|
|
* @short_description: Operations on an image's color profile.
|
|
|
|
*
|
|
|
|
* Operations on an image's color profile.
|
|
|
|
**/
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* _gimp_image_get_color_profile:
|
|
|
|
* @image_ID: The image.
|
2019-08-01 04:51:35 +08:00
|
|
|
* @num_bytes: (out): Number of bytes in the color_profile array.
|
2015-06-05 18:51:46 +08:00
|
|
|
*
|
|
|
|
* Returns the image's color profile
|
|
|
|
*
|
2015-06-07 07:38:50 +08:00
|
|
|
* This procedure returns the image's color profile, or NULL if the
|
|
|
|
* image has no color profile assigned.
|
2015-06-05 18:51:46 +08:00
|
|
|
*
|
2019-08-05 04:09:04 +08:00
|
|
|
* Returns: (array length=num_bytes) (element-type guint8) (transfer full):
|
|
|
|
* The image's serialized color profile.
|
|
|
|
* The returned value must be freed with g_free().
|
2015-06-05 18:51:46 +08:00
|
|
|
*
|
|
|
|
* Since: 2.10
|
|
|
|
**/
|
|
|
|
guint8 *
|
|
|
|
_gimp_image_get_color_profile (gint32 image_ID,
|
|
|
|
gint *num_bytes)
|
|
|
|
{
|
2019-08-07 03:34:00 +08:00
|
|
|
GimpPDB *pdb = gimp_get_pdb ();
|
2019-07-30 16:51:16 +08:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2015-06-05 18:51:46 +08:00
|
|
|
guint8 *profile_data = NULL;
|
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
args = gimp_value_array_new_from_types (GIMP_TYPE_IMAGE_ID,
|
|
|
|
G_TYPE_NONE);
|
|
|
|
gimp_value_set_image_id (gimp_value_array_index (args, 0), image_ID);
|
|
|
|
|
2019-08-07 03:34:00 +08:00
|
|
|
if (pdb)
|
|
|
|
return_vals = gimp_pdb_run_procedure_array (pdb,
|
|
|
|
"gimp-image-get-color-profile",
|
|
|
|
args);
|
|
|
|
else
|
2019-08-07 03:44:26 +08:00
|
|
|
return_vals = gimp_run_procedure_array ("gimp-image-get-color-profile",
|
|
|
|
args);
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (args);
|
2015-06-05 18:51:46 +08:00
|
|
|
|
|
|
|
*num_bytes = 0;
|
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
|
2015-06-05 18:51:46 +08:00
|
|
|
{
|
2019-07-30 16:51:16 +08:00
|
|
|
*num_bytes = g_value_get_int (gimp_value_array_index (return_vals, 1));
|
|
|
|
profile_data = gimp_value_dup_int8_array (gimp_value_array_index (return_vals, 2));
|
2015-06-05 18:51:46 +08:00
|
|
|
}
|
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (return_vals);
|
2015-06-05 18:51:46 +08:00
|
|
|
|
|
|
|
return profile_data;
|
|
|
|
}
|
|
|
|
|
2015-06-07 07:38:50 +08:00
|
|
|
/**
|
|
|
|
* _gimp_image_get_effective_color_profile:
|
|
|
|
* @image_ID: The image.
|
2019-08-01 04:51:35 +08:00
|
|
|
* @num_bytes: (out): Number of bytes in the color_profile array.
|
2015-06-07 07:38:50 +08:00
|
|
|
*
|
|
|
|
* 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
|
|
|
|
* gimp_image_get_color_profile() if the image has a profile assigned,
|
2015-12-26 08:14:43 +08:00
|
|
|
* or a generated default RGB or grayscale profile, according to the
|
|
|
|
* image's type.
|
2015-06-07 07:38:50 +08:00
|
|
|
*
|
2019-08-05 04:09:04 +08:00
|
|
|
* Returns: (array length=num_bytes) (element-type guint8) (transfer full):
|
|
|
|
* The image's serialized color profile.
|
|
|
|
* The returned value must be freed with g_free().
|
2015-06-07 07:38:50 +08:00
|
|
|
*
|
|
|
|
* Since: 2.10
|
|
|
|
**/
|
|
|
|
guint8 *
|
|
|
|
_gimp_image_get_effective_color_profile (gint32 image_ID,
|
|
|
|
gint *num_bytes)
|
|
|
|
{
|
2019-08-07 03:34:00 +08:00
|
|
|
GimpPDB *pdb = gimp_get_pdb ();
|
2019-07-30 16:51:16 +08:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2015-06-07 07:38:50 +08:00
|
|
|
guint8 *profile_data = NULL;
|
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
args = gimp_value_array_new_from_types (GIMP_TYPE_IMAGE_ID,
|
|
|
|
G_TYPE_NONE);
|
|
|
|
gimp_value_set_image_id (gimp_value_array_index (args, 0), image_ID);
|
|
|
|
|
2019-08-07 03:34:00 +08:00
|
|
|
if (pdb)
|
|
|
|
return_vals = gimp_pdb_run_procedure_array (pdb,
|
|
|
|
"gimp-image-get-effective-color-profile",
|
|
|
|
args);
|
|
|
|
else
|
2019-08-07 03:44:26 +08:00
|
|
|
return_vals = gimp_run_procedure_array ("gimp-image-get-effective-color-profile",
|
|
|
|
args);
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (args);
|
2015-06-07 07:38:50 +08:00
|
|
|
|
|
|
|
*num_bytes = 0;
|
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
|
2015-06-07 07:38:50 +08:00
|
|
|
{
|
2019-07-30 16:51:16 +08:00
|
|
|
*num_bytes = g_value_get_int (gimp_value_array_index (return_vals, 1));
|
|
|
|
profile_data = gimp_value_dup_int8_array (gimp_value_array_index (return_vals, 2));
|
2015-06-07 07:38:50 +08:00
|
|
|
}
|
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (return_vals);
|
2015-06-07 07:38:50 +08:00
|
|
|
|
|
|
|
return profile_data;
|
|
|
|
}
|
2015-06-10 07:38:20 +08:00
|
|
|
|
2015-07-28 05:44:45 +08:00
|
|
|
/**
|
|
|
|
* _gimp_image_set_color_profile:
|
|
|
|
* @image_ID: The image.
|
|
|
|
* @num_bytes: Number of bytes in the color_profile array.
|
2019-08-01 04:51:35 +08:00
|
|
|
* @color_profile: (array length=num_bytes) (element-type guint8): The new serialized color profile.
|
2015-07-28 05:44:45 +08:00
|
|
|
*
|
|
|
|
* Sets the image's color profile
|
|
|
|
*
|
|
|
|
* This procedure sets the image's color profile, or unsets it if NULL
|
2015-07-29 05:01:18 +08:00
|
|
|
* is passed as 'color_profile'. This procedure does no color
|
Initial space invasion commit in GIMP
All babl formats now have a space equivalent to a color profile,
determining the format's primaries and TRCs. This commit makes GIMP
aware of this.
libgimp:
- enum GimpPrecision: rename GAMMA values to NON_LINEAR and keep GAMMA
as deprecated aliases, add PERCEPTUAL values so we now have LINEAR,
NON_LINEAR and PERCPTUAL for each encoding, matching the babl
encoding variants RGB, R'G'B' and R~G~B~.
- gimp_color_transform_can_gegl_copy() now returns TRUE if both
profiles can return a babl space, increasing the amount of fast babl
color conversions significantly.
- TODO: no solution yet for getting libgimp drawable proxy buffers in
the right format with space.
plug-ins:
- follow the GimpPrecision change.
- TODO: everything else unchanged and partly broken or sub-optimal,
like setting a new image's color profile too late.
app:
- add enum GimpTRCType { LINEAR, NON_LINEAR, PERCEPTUAL } as
replacement for all "linear" booleans.
- change gimp-babl functions to take babl spaces and GimpTRCType
parameters and support all sorts of new perceptual ~ formats.
- a lot of places changed in the early days of goat invasion didn't
take advantage of gimp-babl utility functions and constructed
formats manually. They all needed revisiting and many now use much
simpler code calling gimp-babl API.
- change gimp_babl_format_get_color_profile() to really extract a
newly allocated color profile from the format, and add
gimp_babl_get_builtin_color_profile() which does the same as
gimp_babl_format_get_color_profile() did before. Visited all callers
to decide whether they are looking for the format's actual profile,
or for one of the builtin profiles, simplifying code that only needs
builtin profiles.
- drawables have a new get_space_api(), get_linear() is now get_trc().
- images now have a "layer space" and an API to get it,
gimp_image_get_layer_format() returns formats in that space.
- an image's layer space is created from the image's color profile,
change gimpimage-color-profile to deal with that correctly
- change many babl_format() calls to babl_format_with_space() and take
the space from passed formats or drawables
- add function gimp_layer_fix_format_space() which replaces the
layer's buffer with one that has the image's layer format, but
doesn't change pixel values
- use gimp_layer_fix_format_space() to make sure layers loaded from
XCF and created by plug-ins have the right space when added to the
image, because it's impossible to always assign the right space upon
layer creation
- "assign color profile" and "discard color profile" now require use
of gimp_layer_fix_format_space() too because the profile is now
embedded in all formats via the space. Add
gimp_image_assign_color_profile() which does all that and call it
instead of a simple gimp_image_set_color_profile(), also from the
PDB set-color-profile functions, which are essentially "assign" and
"discard" calls.
- generally, make sure a new image's color profile is set before
adding layers to it, gimp_image_set_color_profile() is more than
before considered know-what-you-are-doing API.
- take special precaution in all places that call
gimp_drawable_convert_type(), we now must pass a new_profile from
all callers that convert layers within the same image (such as
image_convert_type, image_convert_precision), because the layer's
new space can't be determined from the image's layer format during
the call.
- change all "linear" properties to "trc", in all config objects like
for levels and curves, in the histogram, in the widgets. This results
in some GUI that now has three choices instead of two.
TODO: we might want to reduce that back to two later.
- keep "linear" boolean properties around as compat if needed for file
pasring, but always convert the parsed parsed boolean to
GimpTRCType.
- TODO: the image's "enable color management" switch is currently
broken, will fix that in another commit.
2018-07-21 20:23:01 +08:00
|
|
|
* 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.
|
2015-07-28 05:44:45 +08:00
|
|
|
*
|
|
|
|
* Returns: TRUE on success.
|
|
|
|
*
|
|
|
|
* Since: 2.10
|
|
|
|
**/
|
|
|
|
gboolean
|
|
|
|
_gimp_image_set_color_profile (gint32 image_ID,
|
|
|
|
gint num_bytes,
|
|
|
|
const guint8 *color_profile)
|
|
|
|
{
|
2019-08-07 03:34:00 +08:00
|
|
|
GimpPDB *pdb = gimp_get_pdb ();
|
2019-07-30 16:51:16 +08:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2015-07-28 05:44:45 +08:00
|
|
|
gboolean success = TRUE;
|
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
args = gimp_value_array_new_from_types (GIMP_TYPE_IMAGE_ID,
|
|
|
|
GIMP_TYPE_INT32,
|
|
|
|
GIMP_TYPE_INT8_ARRAY,
|
|
|
|
G_TYPE_NONE);
|
|
|
|
gimp_value_set_image_id (gimp_value_array_index (args, 0), image_ID);
|
|
|
|
g_value_set_int (gimp_value_array_index (args, 1), num_bytes);
|
|
|
|
gimp_value_set_int8_array (gimp_value_array_index (args, 2), color_profile, num_bytes);
|
|
|
|
|
2019-08-07 03:34:00 +08:00
|
|
|
if (pdb)
|
|
|
|
return_vals = gimp_pdb_run_procedure_array (pdb,
|
|
|
|
"gimp-image-set-color-profile",
|
|
|
|
args);
|
|
|
|
else
|
2019-08-07 03:44:26 +08:00
|
|
|
return_vals = gimp_run_procedure_array ("gimp-image-set-color-profile",
|
|
|
|
args);
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (args);
|
2015-07-28 05:44:45 +08:00
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
|
2015-07-28 05:44:45 +08:00
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (return_vals);
|
2015-07-28 05:44:45 +08:00
|
|
|
|
|
|
|
return success;
|
|
|
|
}
|
|
|
|
|
2015-07-29 05:01:18 +08:00
|
|
|
/**
|
|
|
|
* gimp_image_set_color_profile_from_file:
|
|
|
|
* @image_ID: The image.
|
|
|
|
* @uri: The URI of 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 'uri'. This
|
Initial space invasion commit in GIMP
All babl formats now have a space equivalent to a color profile,
determining the format's primaries and TRCs. This commit makes GIMP
aware of this.
libgimp:
- enum GimpPrecision: rename GAMMA values to NON_LINEAR and keep GAMMA
as deprecated aliases, add PERCEPTUAL values so we now have LINEAR,
NON_LINEAR and PERCPTUAL for each encoding, matching the babl
encoding variants RGB, R'G'B' and R~G~B~.
- gimp_color_transform_can_gegl_copy() now returns TRUE if both
profiles can return a babl space, increasing the amount of fast babl
color conversions significantly.
- TODO: no solution yet for getting libgimp drawable proxy buffers in
the right format with space.
plug-ins:
- follow the GimpPrecision change.
- TODO: everything else unchanged and partly broken or sub-optimal,
like setting a new image's color profile too late.
app:
- add enum GimpTRCType { LINEAR, NON_LINEAR, PERCEPTUAL } as
replacement for all "linear" booleans.
- change gimp-babl functions to take babl spaces and GimpTRCType
parameters and support all sorts of new perceptual ~ formats.
- a lot of places changed in the early days of goat invasion didn't
take advantage of gimp-babl utility functions and constructed
formats manually. They all needed revisiting and many now use much
simpler code calling gimp-babl API.
- change gimp_babl_format_get_color_profile() to really extract a
newly allocated color profile from the format, and add
gimp_babl_get_builtin_color_profile() which does the same as
gimp_babl_format_get_color_profile() did before. Visited all callers
to decide whether they are looking for the format's actual profile,
or for one of the builtin profiles, simplifying code that only needs
builtin profiles.
- drawables have a new get_space_api(), get_linear() is now get_trc().
- images now have a "layer space" and an API to get it,
gimp_image_get_layer_format() returns formats in that space.
- an image's layer space is created from the image's color profile,
change gimpimage-color-profile to deal with that correctly
- change many babl_format() calls to babl_format_with_space() and take
the space from passed formats or drawables
- add function gimp_layer_fix_format_space() which replaces the
layer's buffer with one that has the image's layer format, but
doesn't change pixel values
- use gimp_layer_fix_format_space() to make sure layers loaded from
XCF and created by plug-ins have the right space when added to the
image, because it's impossible to always assign the right space upon
layer creation
- "assign color profile" and "discard color profile" now require use
of gimp_layer_fix_format_space() too because the profile is now
embedded in all formats via the space. Add
gimp_image_assign_color_profile() which does all that and call it
instead of a simple gimp_image_set_color_profile(), also from the
PDB set-color-profile functions, which are essentially "assign" and
"discard" calls.
- generally, make sure a new image's color profile is set before
adding layers to it, gimp_image_set_color_profile() is more than
before considered know-what-you-are-doing API.
- take special precaution in all places that call
gimp_drawable_convert_type(), we now must pass a new_profile from
all callers that convert layers within the same image (such as
image_convert_type, image_convert_precision), because the layer's
new space can't be determined from the image's layer format during
the call.
- change all "linear" properties to "trc", in all config objects like
for levels and curves, in the histogram, in the widgets. This results
in some GUI that now has three choices instead of two.
TODO: we might want to reduce that back to two later.
- keep "linear" boolean properties around as compat if needed for file
pasring, but always convert the parsed parsed boolean to
GimpTRCType.
- TODO: the image's "enable color management" switch is currently
broken, will fix that in another commit.
2018-07-21 20:23:01 +08:00
|
|
|
* 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.
|
2015-07-29 05:01:18 +08:00
|
|
|
*
|
|
|
|
* Returns: TRUE on success.
|
|
|
|
*
|
|
|
|
* Since: 2.10
|
|
|
|
**/
|
|
|
|
gboolean
|
|
|
|
gimp_image_set_color_profile_from_file (gint32 image_ID,
|
|
|
|
const gchar *uri)
|
|
|
|
{
|
2019-08-07 03:34:00 +08:00
|
|
|
GimpPDB *pdb = gimp_get_pdb ();
|
2019-07-30 16:51:16 +08:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2015-07-29 05:01:18 +08:00
|
|
|
gboolean success = TRUE;
|
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
args = gimp_value_array_new_from_types (GIMP_TYPE_IMAGE_ID,
|
|
|
|
G_TYPE_STRING,
|
|
|
|
G_TYPE_NONE);
|
|
|
|
gimp_value_set_image_id (gimp_value_array_index (args, 0), image_ID);
|
|
|
|
g_value_set_string (gimp_value_array_index (args, 1), uri);
|
2015-07-29 05:01:18 +08:00
|
|
|
|
2019-08-07 03:34:00 +08:00
|
|
|
if (pdb)
|
|
|
|
return_vals = gimp_pdb_run_procedure_array (pdb,
|
|
|
|
"gimp-image-set-color-profile-from-file",
|
|
|
|
args);
|
|
|
|
else
|
2019-08-07 03:44:26 +08:00
|
|
|
return_vals = gimp_run_procedure_array ("gimp-image-set-color-profile-from-file",
|
|
|
|
args);
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (args);
|
2015-07-29 05:01:18 +08:00
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
|
|
|
|
|
|
|
|
gimp_value_array_unref (return_vals);
|
2015-07-29 05:01:18 +08:00
|
|
|
|
|
|
|
return success;
|
|
|
|
}
|
|
|
|
|
2015-06-10 07:38:20 +08:00
|
|
|
/**
|
|
|
|
* _gimp_image_convert_color_profile:
|
|
|
|
* @image_ID: The image.
|
|
|
|
* @num_bytes: Number of bytes in the color_profile array.
|
2019-08-01 04:51:35 +08:00
|
|
|
* @color_profile: (array length=num_bytes) (element-type guint8): The serialized color profile.
|
2015-06-10 07:38:20 +08:00
|
|
|
* @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
|
2015-12-26 08:14:43 +08:00
|
|
|
* 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.
|
2015-06-10 07:38:20 +08:00
|
|
|
*
|
|
|
|
* Returns: TRUE on success.
|
|
|
|
*
|
|
|
|
* Since: 2.10
|
|
|
|
**/
|
|
|
|
gboolean
|
|
|
|
_gimp_image_convert_color_profile (gint32 image_ID,
|
|
|
|
gint num_bytes,
|
|
|
|
const guint8 *color_profile,
|
|
|
|
GimpColorRenderingIntent intent,
|
|
|
|
gboolean bpc)
|
|
|
|
{
|
2019-08-07 03:34:00 +08:00
|
|
|
GimpPDB *pdb = gimp_get_pdb ();
|
2019-07-30 16:51:16 +08:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2015-06-10 07:38:20 +08:00
|
|
|
gboolean success = TRUE;
|
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
args = gimp_value_array_new_from_types (GIMP_TYPE_IMAGE_ID,
|
|
|
|
GIMP_TYPE_INT32,
|
|
|
|
GIMP_TYPE_INT8_ARRAY,
|
2019-07-31 00:45:10 +08:00
|
|
|
GIMP_TYPE_COLOR_RENDERING_INTENT,
|
2019-07-30 16:51:16 +08:00
|
|
|
G_TYPE_BOOLEAN,
|
|
|
|
G_TYPE_NONE);
|
|
|
|
gimp_value_set_image_id (gimp_value_array_index (args, 0), image_ID);
|
|
|
|
g_value_set_int (gimp_value_array_index (args, 1), num_bytes);
|
|
|
|
gimp_value_set_int8_array (gimp_value_array_index (args, 2), color_profile, num_bytes);
|
|
|
|
g_value_set_enum (gimp_value_array_index (args, 3), intent);
|
|
|
|
g_value_set_boolean (gimp_value_array_index (args, 4), bpc);
|
|
|
|
|
2019-08-07 03:34:00 +08:00
|
|
|
if (pdb)
|
|
|
|
return_vals = gimp_pdb_run_procedure_array (pdb,
|
|
|
|
"gimp-image-convert-color-profile",
|
|
|
|
args);
|
|
|
|
else
|
2019-08-07 03:44:26 +08:00
|
|
|
return_vals = gimp_run_procedure_array ("gimp-image-convert-color-profile",
|
|
|
|
args);
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (args);
|
2015-06-10 07:38:20 +08:00
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
|
2015-06-10 07:38:20 +08:00
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (return_vals);
|
2015-06-10 07:38:20 +08:00
|
|
|
|
|
|
|
return success;
|
|
|
|
}
|
2015-07-29 05:11:54 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* gimp_image_convert_color_profile_from_file:
|
|
|
|
* @image_ID: The image.
|
|
|
|
* @uri: The URI of 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
|
2015-12-26 08:14:43 +08:00
|
|
|
* default RGB or grayscale profile if none is set) to an ICC profile
|
2016-06-26 04:54:10 +08:00
|
|
|
* specified by 'uri'. Only RGB and grayscale color profiles are
|
2015-12-26 08:14:43 +08:00
|
|
|
* accepted, according to the image's type.
|
2015-07-29 05:11:54 +08:00
|
|
|
*
|
|
|
|
* Returns: TRUE on success.
|
|
|
|
*
|
|
|
|
* Since: 2.10
|
|
|
|
**/
|
|
|
|
gboolean
|
|
|
|
gimp_image_convert_color_profile_from_file (gint32 image_ID,
|
|
|
|
const gchar *uri,
|
|
|
|
GimpColorRenderingIntent intent,
|
|
|
|
gboolean bpc)
|
|
|
|
{
|
2019-08-07 03:34:00 +08:00
|
|
|
GimpPDB *pdb = gimp_get_pdb ();
|
2019-07-30 16:51:16 +08:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2015-07-29 05:11:54 +08:00
|
|
|
gboolean success = TRUE;
|
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
args = gimp_value_array_new_from_types (GIMP_TYPE_IMAGE_ID,
|
|
|
|
G_TYPE_STRING,
|
2019-07-31 00:45:10 +08:00
|
|
|
GIMP_TYPE_COLOR_RENDERING_INTENT,
|
2019-07-30 16:51:16 +08:00
|
|
|
G_TYPE_BOOLEAN,
|
|
|
|
G_TYPE_NONE);
|
|
|
|
gimp_value_set_image_id (gimp_value_array_index (args, 0), image_ID);
|
|
|
|
g_value_set_string (gimp_value_array_index (args, 1), uri);
|
|
|
|
g_value_set_enum (gimp_value_array_index (args, 2), intent);
|
|
|
|
g_value_set_boolean (gimp_value_array_index (args, 3), bpc);
|
|
|
|
|
2019-08-07 03:34:00 +08:00
|
|
|
if (pdb)
|
|
|
|
return_vals = gimp_pdb_run_procedure_array (pdb,
|
|
|
|
"gimp-image-convert-color-profile-from-file",
|
|
|
|
args);
|
|
|
|
else
|
2019-08-07 03:44:26 +08:00
|
|
|
return_vals = gimp_run_procedure_array ("gimp-image-convert-color-profile-from-file",
|
|
|
|
args);
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (args);
|
2015-07-29 05:11:54 +08:00
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;
|
2015-07-29 05:11:54 +08:00
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (return_vals);
|
2015-07-29 05:11:54 +08:00
|
|
|
|
|
|
|
return success;
|
|
|
|
}
|