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/>.
27 #include "gimpcolortypes.h"
29 #include "gimpcolormanaged.h"
30 #include "gimpcolorprofile.h"
34 * SECTION: gimpcolormanaged
35 * @title: GimpColorManaged
36 * @short_description: An interface dealing with color profiles.
38 * An interface dealing with color profiles.
49 G_DEFINE_INTERFACE (GimpColorManaged
, gimp_color_managed
, G_TYPE_OBJECT
)
52 static guint gimp_color_managed_signals
[LAST_SIGNAL
] = { 0 };
55 /* private functions */
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
),
65 G_STRUCT_OFFSET (GimpColorManagedInterface
,
68 g_cclosure_marshal_VOID__VOID
,
73 /* public functions */
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
87 gimp_color_managed_get_icc_profile (GimpColorManaged
*managed
,
90 GimpColorManagedInterface
*iface
;
92 g_return_val_if_fail (GIMP_IS_COLOR_MANAGED (managed
), NULL
);
93 g_return_val_if_fail (len
!= NULL
, NULL
);
97 iface
= GIMP_COLOR_MANAGED_GET_INTERFACE (managed
);
99 if (iface
->get_icc_profile
)
100 return iface
->get_icc_profile (managed
, len
);
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.
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
);
132 * gimp_color_managed_profile_changed:
133 * @managed: an object the implements the #GimpColorManaged interface
135 * Emits the "profile-changed" signal.
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);