app: s/sprintf/g_snprintf/ in xcf_save_image()
[gimp.git] / libgimpcolor / gimpcolormanaged.c
blob91fdee88074781b831d7b98346d9c82a8c9cd4be
1 /* LIBGIMP - The GIMP Library
2 * Copyright (C) 1995-1997 Spencer Kimball and Peter Mattis
4 * GimpColorManaged interface
5 * Copyright (C) 2007 Sven Neumann <sven@gimp.org>
7 * This library is free software: you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 3 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Library General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library. If not, see
19 * <https://www.gnu.org/licenses/>.
22 #include "config.h"
24 #include <gio/gio.h>
25 #include <gegl.h>
27 #include "gimpcolortypes.h"
29 #include "gimpcolormanaged.h"
30 #include "gimpcolorprofile.h"
33 /**
34 * SECTION: gimpcolormanaged
35 * @title: GimpColorManaged
36 * @short_description: An interface dealing with color profiles.
38 * An interface dealing with color profiles.
39 **/
42 enum
44 PROFILE_CHANGED,
45 LAST_SIGNAL
49 G_DEFINE_INTERFACE (GimpColorManaged, gimp_color_managed, G_TYPE_OBJECT)
52 static guint gimp_color_managed_signals[LAST_SIGNAL] = { 0 };
55 /* private functions */
58 static void
59 gimp_color_managed_default_init (GimpColorManagedInterface *iface)
61 gimp_color_managed_signals[PROFILE_CHANGED] =
62 g_signal_new ("profile-changed",
63 G_TYPE_FROM_INTERFACE (iface),
64 G_SIGNAL_RUN_FIRST,
65 G_STRUCT_OFFSET (GimpColorManagedInterface,
66 profile_changed),
67 NULL, NULL,
68 g_cclosure_marshal_VOID__VOID,
69 G_TYPE_NONE, 0);
73 /* public functions */
76 /**
77 * gimp_color_managed_get_icc_profile:
78 * @managed: an object the implements the #GimpColorManaged interface
79 * @len: return location for the number of bytes in the profile data
81 * Return value: A pointer to a blob of data that represents an ICC
82 * color profile.
84 * Since: 2.4
85 **/
86 const guint8 *
87 gimp_color_managed_get_icc_profile (GimpColorManaged *managed,
88 gsize *len)
90 GimpColorManagedInterface *iface;
92 g_return_val_if_fail (GIMP_IS_COLOR_MANAGED (managed), NULL);
93 g_return_val_if_fail (len != NULL, NULL);
95 *len = 0;
97 iface = GIMP_COLOR_MANAGED_GET_INTERFACE (managed);
99 if (iface->get_icc_profile)
100 return iface->get_icc_profile (managed, len);
102 return NULL;
106 * gimp_color_managed_get_color_profile:
107 * @managed: an object the implements the #GimpColorManaged interface
109 * This function always returns a #GimpColorProfile and falls back to
110 * gimp_color_profile_new_rgb_srgb() if the method is not implemented.
112 * Return value: The @managed's #GimpColorProfile.
114 * Since: 2.10
116 GimpColorProfile *
117 gimp_color_managed_get_color_profile (GimpColorManaged *managed)
119 GimpColorManagedInterface *iface;
121 g_return_val_if_fail (GIMP_IS_COLOR_MANAGED (managed), NULL);
123 iface = GIMP_COLOR_MANAGED_GET_INTERFACE (managed);
125 if (iface->get_color_profile)
126 return iface->get_color_profile (managed);
128 return NULL;
132 * gimp_color_managed_profile_changed:
133 * @managed: an object the implements the #GimpColorManaged interface
135 * Emits the "profile-changed" signal.
137 * Since: 2.4
139 void
140 gimp_color_managed_profile_changed (GimpColorManaged *managed)
142 g_return_if_fail (GIMP_IS_COLOR_MANAGED (managed));
144 g_signal_emit (managed, gimp_color_managed_signals[PROFILE_CHANGED], 0);