/* PIKA - Photo and Image Kooker Application * a rebranding of The GNU Image Manipulation Program (created with heckimp) * A derived work which may be trivial. However, any changes may be (C)2023 by Aldercone Studio * * Original copyright, applying to most contents (license remains unchanged): * Copyright (C) 1995-2003 Spencer Kimball and Peter Mattis * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ /* NOTE: This file is auto-generated by pdbgen.pl. */ #include "config.h" #include "stamp-pdbgen.h" #include #include #include #include "libpikacolor/pikacolor.h" #include "libpikabase/pikabase.h" #include "pdb-types.h" #include "core/pikaimage-color-profile.h" #include "core/pikaimage.h" #include "core/pikaparamspecs.h" #include "pikapdb.h" #include "pikaprocedure.h" #include "internal-procs.h" #include "pika-intl.h" static PikaValueArray * image_get_color_profile_invoker (PikaProcedure *procedure, Pika *pika, PikaContext *context, PikaProgress *progress, const PikaValueArray *args, GError **error) { gboolean success = TRUE; PikaValueArray *return_vals; PikaImage *image; GBytes *profile_data = NULL; image = g_value_get_object (pika_value_array_index (args, 0)); if (success) { PikaColorProfile *profile; profile = pika_image_get_color_profile (image); if (profile) { const guint8 *data; gsize length; data = pika_color_profile_get_icc_profile (profile, &length); profile_data = g_bytes_new (data, length); } } return_vals = pika_procedure_get_return_values (procedure, success, error ? *error : NULL); if (success) g_value_take_boxed (pika_value_array_index (return_vals, 1), profile_data); return return_vals; } static PikaValueArray * image_get_effective_color_profile_invoker (PikaProcedure *procedure, Pika *pika, PikaContext *context, PikaProgress *progress, const PikaValueArray *args, GError **error) { gboolean success = TRUE; PikaValueArray *return_vals; PikaImage *image; GBytes *profile_data = NULL; image = g_value_get_object (pika_value_array_index (args, 0)); if (success) { PikaColorProfile *profile; profile = pika_color_managed_get_color_profile (PIKA_COLOR_MANAGED (image)); if (profile) { const guint8 *data; gsize length; data = pika_color_profile_get_icc_profile (profile, &length); profile_data = g_bytes_new (data, length); } } return_vals = pika_procedure_get_return_values (procedure, success, error ? *error : NULL); if (success) g_value_take_boxed (pika_value_array_index (return_vals, 1), profile_data); return return_vals; } static PikaValueArray * image_set_color_profile_invoker (PikaProcedure *procedure, Pika *pika, PikaContext *context, PikaProgress *progress, const PikaValueArray *args, GError **error) { gboolean success = TRUE; PikaImage *image; GBytes *color_profile; image = g_value_get_object (pika_value_array_index (args, 0)); color_profile = g_value_get_boxed (pika_value_array_index (args, 1)); if (success) { if (color_profile) { PikaColorProfile *profile; profile = pika_color_profile_new_from_icc_profile (g_bytes_get_data (color_profile, NULL), g_bytes_get_size (color_profile), error); if (profile) { success = pika_image_assign_color_profile (image, profile, progress, error); g_object_unref (profile); } else success = FALSE; } else { success = pika_image_assign_color_profile (image, NULL, progress, error); } } return pika_procedure_get_return_values (procedure, success, error ? *error : NULL); } static PikaValueArray * image_set_color_profile_from_file_invoker (PikaProcedure *procedure, Pika *pika, PikaContext *context, PikaProgress *progress, const PikaValueArray *args, GError **error) { gboolean success = TRUE; PikaImage *image; GFile *file; image = g_value_get_object (pika_value_array_index (args, 0)); file = g_value_get_object (pika_value_array_index (args, 1)); if (success) { if (file) { PikaColorProfile *profile; profile = pika_color_profile_new_from_file (file, error); if (profile) { success = pika_image_assign_color_profile (image, profile, progress, error); g_object_unref (profile); } else success = FALSE; } else { success = pika_image_assign_color_profile (image, NULL, progress, error); } } return pika_procedure_get_return_values (procedure, success, error ? *error : NULL); } static PikaValueArray * image_get_simulation_profile_invoker (PikaProcedure *procedure, Pika *pika, PikaContext *context, PikaProgress *progress, const PikaValueArray *args, GError **error) { gboolean success = TRUE; PikaValueArray *return_vals; PikaImage *image; GBytes *profile_data = NULL; image = g_value_get_object (pika_value_array_index (args, 0)); if (success) { PikaColorProfile *profile; profile = pika_image_get_simulation_profile (image); if (profile) { const guint8 *data; gsize length; data = pika_color_profile_get_icc_profile (profile, &length); profile_data = g_bytes_new (data, length); } } return_vals = pika_procedure_get_return_values (procedure, success, error ? *error : NULL); if (success) g_value_take_boxed (pika_value_array_index (return_vals, 1), profile_data); return return_vals; } static PikaValueArray * image_set_simulation_profile_invoker (PikaProcedure *procedure, Pika *pika, PikaContext *context, PikaProgress *progress, const PikaValueArray *args, GError **error) { gboolean success = TRUE; PikaImage *image; GBytes *color_profile; image = g_value_get_object (pika_value_array_index (args, 0)); color_profile = g_value_get_boxed (pika_value_array_index (args, 1)); if (success) { if (color_profile) { PikaColorProfile *profile; profile = pika_color_profile_new_from_icc_profile (g_bytes_get_data (color_profile, NULL), g_bytes_get_size (color_profile), error); if (profile) { pika_image_set_simulation_profile (image, profile); g_object_unref (profile); } else { success = FALSE; } } else { pika_image_set_simulation_profile (image, NULL); } } return pika_procedure_get_return_values (procedure, success, error ? *error : NULL); } static PikaValueArray * image_set_simulation_profile_from_file_invoker (PikaProcedure *procedure, Pika *pika, PikaContext *context, PikaProgress *progress, const PikaValueArray *args, GError **error) { gboolean success = TRUE; PikaImage *image; GFile *file; image = g_value_get_object (pika_value_array_index (args, 0)); file = g_value_get_object (pika_value_array_index (args, 1)); if (success) { if (file) { PikaColorProfile *profile; profile = pika_color_profile_new_from_file (file, error); if (profile) { pika_image_set_simulation_profile (image, profile); g_object_unref (profile); } else { success = FALSE; } } else { pika_image_set_simulation_profile (image, NULL); } } return pika_procedure_get_return_values (procedure, success, error ? *error : NULL); } static PikaValueArray * image_get_simulation_intent_invoker (PikaProcedure *procedure, Pika *pika, PikaContext *context, PikaProgress *progress, const PikaValueArray *args, GError **error) { gboolean success = TRUE; PikaValueArray *return_vals; PikaImage *image; gint intent = 0; image = g_value_get_object (pika_value_array_index (args, 0)); if (success) { intent = pika_image_get_simulation_intent (image); } return_vals = pika_procedure_get_return_values (procedure, success, error ? *error : NULL); if (success) g_value_set_enum (pika_value_array_index (return_vals, 1), intent); return return_vals; } static PikaValueArray * image_set_simulation_intent_invoker (PikaProcedure *procedure, Pika *pika, PikaContext *context, PikaProgress *progress, const PikaValueArray *args, GError **error) { gboolean success = TRUE; PikaImage *image; gint intent; image = g_value_get_object (pika_value_array_index (args, 0)); intent = g_value_get_enum (pika_value_array_index (args, 1)); if (success) { pika_image_set_simulation_intent (image, intent); } return pika_procedure_get_return_values (procedure, success, error ? *error : NULL); } static PikaValueArray * image_get_simulation_bpc_invoker (PikaProcedure *procedure, Pika *pika, PikaContext *context, PikaProgress *progress, const PikaValueArray *args, GError **error) { gboolean success = TRUE; PikaValueArray *return_vals; PikaImage *image; gboolean bpc = FALSE; image = g_value_get_object (pika_value_array_index (args, 0)); if (success) { bpc = pika_image_get_simulation_bpc (image); } return_vals = pika_procedure_get_return_values (procedure, success, error ? *error : NULL); if (success) g_value_set_boolean (pika_value_array_index (return_vals, 1), bpc); return return_vals; } static PikaValueArray * image_set_simulation_bpc_invoker (PikaProcedure *procedure, Pika *pika, PikaContext *context, PikaProgress *progress, const PikaValueArray *args, GError **error) { gboolean success = TRUE; PikaImage *image; gboolean bpc; image = g_value_get_object (pika_value_array_index (args, 0)); bpc = g_value_get_boolean (pika_value_array_index (args, 1)); if (success) { pika_image_set_simulation_bpc (image, bpc); } return pika_procedure_get_return_values (procedure, success, error ? *error : NULL); } static PikaValueArray * image_convert_color_profile_invoker (PikaProcedure *procedure, Pika *pika, PikaContext *context, PikaProgress *progress, const PikaValueArray *args, GError **error) { gboolean success = TRUE; PikaImage *image; GBytes *color_profile; gint intent; gboolean bpc; image = g_value_get_object (pika_value_array_index (args, 0)); color_profile = g_value_get_boxed (pika_value_array_index (args, 1)); intent = g_value_get_enum (pika_value_array_index (args, 2)); bpc = g_value_get_boolean (pika_value_array_index (args, 3)); if (success) { if (color_profile) { PikaColorProfile *profile; profile = pika_color_profile_new_from_icc_profile (g_bytes_get_data (color_profile, NULL), g_bytes_get_size (color_profile), error); if (profile) { success = pika_image_convert_color_profile (image, profile, intent, bpc, progress, error); g_object_unref (profile); } else success = FALSE; } else success = FALSE; } return pika_procedure_get_return_values (procedure, success, error ? *error : NULL); } static PikaValueArray * image_convert_color_profile_from_file_invoker (PikaProcedure *procedure, Pika *pika, PikaContext *context, PikaProgress *progress, const PikaValueArray *args, GError **error) { gboolean success = TRUE; PikaImage *image; GFile *file; gint intent; gboolean bpc; image = g_value_get_object (pika_value_array_index (args, 0)); file = g_value_get_object (pika_value_array_index (args, 1)); intent = g_value_get_enum (pika_value_array_index (args, 2)); bpc = g_value_get_boolean (pika_value_array_index (args, 3)); if (success) { if (file) { PikaColorProfile *profile; profile = pika_color_profile_new_from_file (file, error); if (profile) { success = pika_image_convert_color_profile (image, profile, intent, bpc, progress, error); g_object_unref (profile); } else success = FALSE; } else success = FALSE; } return pika_procedure_get_return_values (procedure, success, error ? *error : NULL); } void register_image_color_profile_procs (PikaPDB *pdb) { PikaProcedure *procedure; /* * pika-image-get-color-profile */ procedure = pika_procedure_new (image_get_color_profile_invoker); pika_object_set_static_name (PIKA_OBJECT (procedure), "pika-image-get-color-profile"); pika_procedure_set_static_help (procedure, "Returns the image's color profile", "This procedure returns the image's color profile, or NULL if the image has no color profile assigned.", NULL); pika_procedure_set_static_attribution (procedure, "Michael Natterer ", "Michael Natterer", "2015"); pika_procedure_add_argument (procedure, pika_param_spec_image ("image", "image", "The image", FALSE, PIKA_PARAM_READWRITE)); pika_procedure_add_return_value (procedure, g_param_spec_boxed ("profile-data", "profile data", "The image's serialized color profile.", G_TYPE_BYTES, PIKA_PARAM_READWRITE)); pika_pdb_register_procedure (pdb, procedure); g_object_unref (procedure); /* * pika-image-get-effective-color-profile */ procedure = pika_procedure_new (image_get_effective_color_profile_invoker); pika_object_set_static_name (PIKA_OBJECT (procedure), "pika-image-get-effective-color-profile"); pika_procedure_set_static_help (procedure, "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.", NULL); pika_procedure_set_static_attribution (procedure, "Michael Natterer ", "Michael Natterer", "2015"); pika_procedure_add_argument (procedure, pika_param_spec_image ("image", "image", "The image", FALSE, PIKA_PARAM_READWRITE)); pika_procedure_add_return_value (procedure, g_param_spec_boxed ("profile-data", "profile data", "The image's serialized color profile.", G_TYPE_BYTES, PIKA_PARAM_READWRITE)); pika_pdb_register_procedure (pdb, procedure); g_object_unref (procedure); /* * pika-image-set-color-profile */ procedure = pika_procedure_new (image_set_color_profile_invoker); pika_object_set_static_name (PIKA_OBJECT (procedure), "pika-image-set-color-profile"); pika_procedure_set_static_help (procedure, "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.", NULL); pika_procedure_set_static_attribution (procedure, "Michael Natterer ", "Michael Natterer", "2015"); pika_procedure_add_argument (procedure, pika_param_spec_image ("image", "image", "The image", FALSE, PIKA_PARAM_READWRITE)); pika_procedure_add_argument (procedure, g_param_spec_boxed ("color-profile", "color profile", "The new serialized color profile", G_TYPE_BYTES, PIKA_PARAM_READWRITE)); pika_pdb_register_procedure (pdb, procedure); g_object_unref (procedure); /* * pika-image-set-color-profile-from-file */ procedure = pika_procedure_new (image_set_color_profile_from_file_invoker); pika_object_set_static_name (PIKA_OBJECT (procedure), "pika-image-set-color-profile-from-file"); pika_procedure_set_static_help (procedure, "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.", NULL); pika_procedure_set_static_attribution (procedure, "Michael Natterer ", "Michael Natterer", "2015"); pika_procedure_add_argument (procedure, pika_param_spec_image ("image", "image", "The image", FALSE, PIKA_PARAM_READWRITE)); pika_procedure_add_argument (procedure, g_param_spec_object ("file", "file", "The file containing the new color profile", G_TYPE_FILE, PIKA_PARAM_READWRITE)); pika_pdb_register_procedure (pdb, procedure); g_object_unref (procedure); /* * pika-image-get-simulation-profile */ procedure = pika_procedure_new (image_get_simulation_profile_invoker); pika_object_set_static_name (PIKA_OBJECT (procedure), "pika-image-get-simulation-profile"); pika_procedure_set_static_help (procedure, "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.", NULL); pika_procedure_set_static_attribution (procedure, "Alex S.", "Alex S.", "2022"); pika_procedure_add_argument (procedure, pika_param_spec_image ("image", "image", "The image", FALSE, PIKA_PARAM_READWRITE)); pika_procedure_add_return_value (procedure, g_param_spec_boxed ("profile-data", "profile data", "The image's serialized simulation color profile.", G_TYPE_BYTES, PIKA_PARAM_READWRITE)); pika_pdb_register_procedure (pdb, procedure); g_object_unref (procedure); /* * pika-image-set-simulation-profile */ procedure = pika_procedure_new (image_set_simulation_profile_invoker); pika_object_set_static_name (PIKA_OBJECT (procedure), "pika-image-set-simulation-profile"); pika_procedure_set_static_help (procedure, "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.", NULL); pika_procedure_set_static_attribution (procedure, "Alex S.", "Alex S.", "2022"); pika_procedure_add_argument (procedure, pika_param_spec_image ("image", "image", "The image", FALSE, PIKA_PARAM_READWRITE)); pika_procedure_add_argument (procedure, g_param_spec_boxed ("color-profile", "color profile", "The new serialized simulation color profile", G_TYPE_BYTES, PIKA_PARAM_READWRITE)); pika_pdb_register_procedure (pdb, procedure); g_object_unref (procedure); /* * pika-image-set-simulation-profile-from-file */ procedure = pika_procedure_new (image_set_simulation_profile_from_file_invoker); pika_object_set_static_name (PIKA_OBJECT (procedure), "pika-image-set-simulation-profile-from-file"); pika_procedure_set_static_help (procedure, "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.", NULL); pika_procedure_set_static_attribution (procedure, "Alex S.", "Alex S.", "2022"); pika_procedure_add_argument (procedure, pika_param_spec_image ("image", "image", "The image", FALSE, PIKA_PARAM_READWRITE)); pika_procedure_add_argument (procedure, g_param_spec_object ("file", "file", "The file containing the new simulation color profile", G_TYPE_FILE, PIKA_PARAM_READWRITE)); pika_pdb_register_procedure (pdb, procedure); g_object_unref (procedure); /* * pika-image-get-simulation-intent */ procedure = pika_procedure_new (image_get_simulation_intent_invoker); pika_object_set_static_name (PIKA_OBJECT (procedure), "pika-image-get-simulation-intent"); pika_procedure_set_static_help (procedure, "Returns the image's simulation rendering intent", "This procedure returns the image's simulation rendering intent.", NULL); pika_procedure_set_static_attribution (procedure, "Alex S.", "Alex S.", "2022"); pika_procedure_add_argument (procedure, pika_param_spec_image ("image", "image", "The image", FALSE, PIKA_PARAM_READWRITE)); pika_procedure_add_return_value (procedure, g_param_spec_enum ("intent", "intent", "The image's simulation rendering intent.", PIKA_TYPE_COLOR_RENDERING_INTENT, PIKA_COLOR_RENDERING_INTENT_PERCEPTUAL, PIKA_PARAM_READWRITE)); pika_pdb_register_procedure (pdb, procedure); g_object_unref (procedure); /* * pika-image-set-simulation-intent */ procedure = pika_procedure_new (image_set_simulation_intent_invoker); pika_object_set_static_name (PIKA_OBJECT (procedure), "pika-image-set-simulation-intent"); pika_procedure_set_static_help (procedure, "Sets the image's simulation rendering intent", "This procedure sets the image's simulation rendering intent.", NULL); pika_procedure_set_static_attribution (procedure, "Alex S.", "Alex S.", "2022"); pika_procedure_add_argument (procedure, pika_param_spec_image ("image", "image", "The image", FALSE, PIKA_PARAM_READWRITE)); pika_procedure_add_argument (procedure, g_param_spec_enum ("intent", "intent", "A PikaColorRenderingIntent", PIKA_TYPE_COLOR_RENDERING_INTENT, PIKA_COLOR_RENDERING_INTENT_PERCEPTUAL, PIKA_PARAM_READWRITE)); pika_pdb_register_procedure (pdb, procedure); g_object_unref (procedure); /* * pika-image-get-simulation-bpc */ procedure = pika_procedure_new (image_get_simulation_bpc_invoker); pika_object_set_static_name (PIKA_OBJECT (procedure), "pika-image-get-simulation-bpc"); pika_procedure_set_static_help (procedure, "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", NULL); pika_procedure_set_static_attribution (procedure, "Alex S.", "Alex S.", "2022"); pika_procedure_add_argument (procedure, pika_param_spec_image ("image", "image", "The image", FALSE, PIKA_PARAM_READWRITE)); pika_procedure_add_return_value (procedure, g_param_spec_boolean ("bpc", "bpc", "The Black Point Compensation status.", FALSE, PIKA_PARAM_READWRITE)); pika_pdb_register_procedure (pdb, procedure); g_object_unref (procedure); /* * pika-image-set-simulation-bpc */ procedure = pika_procedure_new (image_set_simulation_bpc_invoker); pika_object_set_static_name (PIKA_OBJECT (procedure), "pika-image-set-simulation-bpc"); pika_procedure_set_static_help (procedure, "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", NULL); pika_procedure_set_static_attribution (procedure, "Alex S.", "Alex S.", "2022"); pika_procedure_add_argument (procedure, pika_param_spec_image ("image", "image", "The image", FALSE, PIKA_PARAM_READWRITE)); pika_procedure_add_argument (procedure, g_param_spec_boolean ("bpc", "bpc", "The Black Point Compensation status.", FALSE, PIKA_PARAM_READWRITE)); pika_pdb_register_procedure (pdb, procedure); g_object_unref (procedure); /* * pika-image-convert-color-profile */ procedure = pika_procedure_new (image_convert_color_profile_invoker); pika_object_set_static_name (PIKA_OBJECT (procedure), "pika-image-convert-color-profile"); pika_procedure_set_static_help (procedure, "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.", NULL); pika_procedure_set_static_attribution (procedure, "Michael Natterer ", "Michael Natterer", "2015"); pika_procedure_add_argument (procedure, pika_param_spec_image ("image", "image", "The image", FALSE, PIKA_PARAM_READWRITE)); pika_procedure_add_argument (procedure, g_param_spec_boxed ("color-profile", "color profile", "The serialized color profile", G_TYPE_BYTES, PIKA_PARAM_READWRITE)); pika_procedure_add_argument (procedure, g_param_spec_enum ("intent", "intent", "Rendering intent", PIKA_TYPE_COLOR_RENDERING_INTENT, PIKA_COLOR_RENDERING_INTENT_PERCEPTUAL, PIKA_PARAM_READWRITE)); pika_procedure_add_argument (procedure, g_param_spec_boolean ("bpc", "bpc", "Black point compensation", FALSE, PIKA_PARAM_READWRITE)); pika_pdb_register_procedure (pdb, procedure); g_object_unref (procedure); /* * pika-image-convert-color-profile-from-file */ procedure = pika_procedure_new (image_convert_color_profile_from_file_invoker); pika_object_set_static_name (PIKA_OBJECT (procedure), "pika-image-convert-color-profile-from-file"); pika_procedure_set_static_help (procedure, "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.", NULL); pika_procedure_set_static_attribution (procedure, "Michael Natterer ", "Michael Natterer", "2015"); pika_procedure_add_argument (procedure, pika_param_spec_image ("image", "image", "The image", FALSE, PIKA_PARAM_READWRITE)); pika_procedure_add_argument (procedure, g_param_spec_object ("file", "file", "The file containing the new color profile", G_TYPE_FILE, PIKA_PARAM_READWRITE)); pika_procedure_add_argument (procedure, g_param_spec_enum ("intent", "intent", "Rendering intent", PIKA_TYPE_COLOR_RENDERING_INTENT, PIKA_COLOR_RENDERING_INTENT_PERCEPTUAL, PIKA_PARAM_READWRITE)); pika_procedure_add_argument (procedure, g_param_spec_boolean ("bpc", "bpc", "Black point compensation", FALSE, PIKA_PARAM_READWRITE)); pika_pdb_register_procedure (pdb, procedure); g_object_unref (procedure); }