mirror of https://github.com/GNOME/gimp.git
implement the GimpColorManaged interface.
2007-06-14 Sven Neumann <sven@gimp.org> * app/core/gimpimage.c: implement the GimpColorManaged interface. svn path=/trunk/; revision=22777
This commit is contained in:
parent
81bc301c4d
commit
aaaf8605ae
|
@ -1,3 +1,7 @@
|
||||||
|
2007-06-14 Sven Neumann <sven@gimp.org>
|
||||||
|
|
||||||
|
* app/core/gimpimage.c: implement the GimpColorManaged interface.
|
||||||
|
|
||||||
2007-06-14 Sven Neumann <sven@gimp.org>
|
2007-06-14 Sven Neumann <sven@gimp.org>
|
||||||
|
|
||||||
* libgimpthumb/Makefile.am (gimp_thumbnail_list_LDADD): fixed
|
* libgimpthumb/Makefile.am (gimp_thumbnail_list_LDADD): fixed
|
||||||
|
|
|
@ -71,7 +71,7 @@
|
||||||
|
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
#define TRC(x) printf x
|
#define TRC(x) g_printerr x
|
||||||
#else
|
#else
|
||||||
#define TRC(x)
|
#define TRC(x)
|
||||||
#endif
|
#endif
|
||||||
|
@ -121,6 +121,8 @@ enum
|
||||||
|
|
||||||
/* local function prototypes */
|
/* local function prototypes */
|
||||||
|
|
||||||
|
static void gimp_color_managed_iface_init (GimpColorManagedInterface *iface);
|
||||||
|
|
||||||
static GObject *gimp_image_constructor (GType type,
|
static GObject *gimp_image_constructor (GType type,
|
||||||
guint n_params,
|
guint n_params,
|
||||||
GObjectConstructParam *params);
|
GObjectConstructParam *params);
|
||||||
|
@ -183,6 +185,9 @@ static void gimp_image_channel_name_changed (GimpChannel *channel,
|
||||||
static void gimp_image_channel_color_changed (GimpChannel *channel,
|
static void gimp_image_channel_color_changed (GimpChannel *channel,
|
||||||
GimpImage *image);
|
GimpImage *image);
|
||||||
|
|
||||||
|
const guint8 * gimp_image_get_icc_profile (GimpColorManaged *managed,
|
||||||
|
gsize *len);
|
||||||
|
|
||||||
|
|
||||||
static const gint valid_combinations[][MAX_CHANNELS + 1] =
|
static const gint valid_combinations[][MAX_CHANNELS + 1] =
|
||||||
{
|
{
|
||||||
|
@ -201,7 +206,9 @@ static const gint valid_combinations[][MAX_CHANNELS + 1] =
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
G_DEFINE_TYPE (GimpImage, gimp_image, GIMP_TYPE_VIEWABLE)
|
G_DEFINE_TYPE_WITH_CODE (GimpImage, gimp_image, GIMP_TYPE_VIEWABLE,
|
||||||
|
G_IMPLEMENT_INTERFACE (GIMP_TYPE_COLOR_MANAGED,
|
||||||
|
gimp_color_managed_iface_init))
|
||||||
|
|
||||||
#define parent_class gimp_image_parent_class
|
#define parent_class gimp_image_parent_class
|
||||||
|
|
||||||
|
@ -544,6 +551,12 @@ gimp_image_class_init (GimpImageClass *klass)
|
||||||
gimp_image_color_hash_init ();
|
gimp_image_color_hash_init ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gimp_color_managed_iface_init (GimpColorManagedInterface *iface)
|
||||||
|
{
|
||||||
|
iface->get_icc_profile = gimp_image_get_icc_profile;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gimp_image_init (GimpImage *image)
|
gimp_image_init (GimpImage *image)
|
||||||
{
|
{
|
||||||
|
@ -2314,19 +2327,19 @@ gimp_image_parasite_attach (GimpImage *image,
|
||||||
copy = *parasite;
|
copy = *parasite;
|
||||||
|
|
||||||
/* only set the dirty bit manually if we can be saved and the new
|
/* only set the dirty bit manually if we can be saved and the new
|
||||||
parasite differs from the current one and we aren't undoable */
|
* parasite differs from the current one and we aren't undoable
|
||||||
|
*/
|
||||||
if (gimp_parasite_is_undoable (©))
|
if (gimp_parasite_is_undoable (©))
|
||||||
gimp_image_undo_push_image_parasite (image,
|
gimp_image_undo_push_image_parasite (image,
|
||||||
_("Attach Parasite to Image"),
|
_("Attach Parasite to Image"),
|
||||||
©);
|
©);
|
||||||
|
|
||||||
/* We used to push an cantundo on te stack here. This made the undo stack
|
/* We used to push an cantundo on te stack here. This made the undo stack
|
||||||
unusable (NULL on the stack) and prevented people from undoing after a
|
* unusable (NULL on the stack) and prevented people from undoing after a
|
||||||
save (since most save plug-ins attach an undoable comment parasite).
|
* save (since most save plug-ins attach an undoable comment parasite).
|
||||||
Now we simply attach the parasite without pushing an undo. That way it's
|
* Now we simply attach the parasite without pushing an undo. That way
|
||||||
undoable but does not block the undo system. --Sven
|
* it's undoable but does not block the undo system. --Sven
|
||||||
*/
|
*/
|
||||||
|
|
||||||
gimp_parasite_list_add (image->parasites, ©);
|
gimp_parasite_list_add (image->parasites, ©);
|
||||||
|
|
||||||
if (gimp_parasite_has_flag (©, GIMP_PARASITE_ATTACH_PARENT))
|
if (gimp_parasite_has_flag (©, GIMP_PARASITE_ATTACH_PARENT))
|
||||||
|
@ -2337,6 +2350,9 @@ gimp_image_parasite_attach (GimpImage *image,
|
||||||
|
|
||||||
g_signal_emit (image, gimp_image_signals[PARASITE_ATTACHED], 0,
|
g_signal_emit (image, gimp_image_signals[PARASITE_ATTACHED], 0,
|
||||||
parasite->name);
|
parasite->name);
|
||||||
|
|
||||||
|
if (strcmp (parasite->name, "icc-profile") == 0)
|
||||||
|
gimp_color_managed_profile_changed (GIMP_COLOR_MANAGED (image));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -2360,6 +2376,9 @@ gimp_image_parasite_detach (GimpImage *image,
|
||||||
|
|
||||||
g_signal_emit (image, gimp_image_signals[PARASITE_DETACHED], 0,
|
g_signal_emit (image, gimp_image_signals[PARASITE_DETACHED], 0,
|
||||||
name);
|
name);
|
||||||
|
|
||||||
|
if (strcmp (name, "icc-profile") == 0)
|
||||||
|
gimp_color_managed_profile_changed (GIMP_COLOR_MANAGED (image));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -3736,3 +3755,21 @@ gimp_image_invalidate_channel_previews (GimpImage *image)
|
||||||
(GFunc) gimp_viewable_invalidate_preview,
|
(GFunc) gimp_viewable_invalidate_preview,
|
||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const guint8 *
|
||||||
|
gimp_image_get_icc_profile (GimpColorManaged *managed,
|
||||||
|
gsize *len)
|
||||||
|
{
|
||||||
|
const GimpParasite *parasite;
|
||||||
|
|
||||||
|
parasite = gimp_image_parasite_find (GIMP_IMAGE (managed), "icc-profile");
|
||||||
|
|
||||||
|
if (parasite)
|
||||||
|
{
|
||||||
|
*len = gimp_parasite_data_size (parasite);
|
||||||
|
|
||||||
|
return gimp_parasite_data (parasite);
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue