[gimp] Bug 766988 - Colors applied to images are not color managed
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] Bug 766988 - Colors applied to images are not color managed
- Date: Sun, 29 May 2016 17:41:33 +0000 (UTC)
commit b3c6163450ded272c01055cb6f8c3bf6a855e492
Author: Michael Natterer <mitch gimp org>
Date: Sun May 29 19:39:55 2016 +0200
Bug 766988 - Colors applied to images are not color managed
Color manage the applied pattern in gimp_fill_options_create_buffer()
so filling and stroking with a pattern look right.
app/core/gimpfilloptions.c | 68 +++++++++++++++++++++++++++++--------------
1 files changed, 46 insertions(+), 22 deletions(-)
---
diff --git a/app/core/gimpfilloptions.c b/app/core/gimpfilloptions.c
index dff7592..95366da 100644
--- a/app/core/gimpfilloptions.c
+++ b/app/core/gimpfilloptions.c
@@ -30,6 +30,8 @@
#include "core-types.h"
+#include "gegl/gimp-babl.h"
+#include "gegl/gimp-gegl-loops.h"
#include "gegl/gimp-gegl-utils.h"
#include "gimp.h"
@@ -393,8 +395,6 @@ gimp_fill_options_create_buffer (GimpFillOptions *options,
const GeglRectangle *rect)
{
GeglBuffer *buffer;
- GimpPattern *pattern = NULL;
- GimpRGB color;
g_return_val_if_fail (GIMP_IS_FILL_OPTIONS (options), NULL);
g_return_val_if_fail (gimp_fill_options_get_style (options) !=
@@ -404,36 +404,60 @@ gimp_fill_options_create_buffer (GimpFillOptions *options,
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), NULL);
g_return_val_if_fail (rect != NULL, NULL);
+ buffer = gegl_buffer_new (rect,
+ gimp_drawable_get_format_with_alpha (drawable));
+
switch (gimp_fill_options_get_style (options))
{
case GIMP_FILL_STYLE_SOLID:
- gimp_context_get_foreground (GIMP_CONTEXT (options), &color);
- gimp_palettes_add_color_history (GIMP_CONTEXT (options)->gimp, &color);
- gimp_pickable_srgb_to_image_color (GIMP_PICKABLE (drawable),
- &color, &color);
+ {
+ GimpRGB color;
+ GeglColor *gegl_color;
+
+ gimp_context_get_foreground (GIMP_CONTEXT (options), &color);
+ gimp_palettes_add_color_history (GIMP_CONTEXT (options)->gimp, &color);
+
+ gimp_pickable_srgb_to_image_color (GIMP_PICKABLE (drawable),
+ &color, &color);
+
+ gegl_color = gimp_gegl_color_new (&color);
+ gegl_buffer_set_color (buffer, NULL, gegl_color);
+ g_object_unref (gegl_color);
+ }
break;
case GIMP_FILL_STYLE_PATTERN:
- pattern = gimp_context_get_pattern (GIMP_CONTEXT (options));
- break;
- }
+ {
+ GimpPattern *pattern;
+ const Babl *format;
+ GeglBuffer *src_buffer;
+ GeglBuffer *dest_buffer;
+ GimpColorProfile *src_profile;
+ GimpColorProfile *dest_profile;
- buffer = gegl_buffer_new (rect,
- gimp_drawable_get_format_with_alpha (drawable));
+ pattern = gimp_context_get_pattern (GIMP_CONTEXT (options));
- if (pattern)
- {
- GeglBuffer *pattern_buffer = gimp_pattern_create_buffer (pattern);
+ src_buffer = gimp_pattern_create_buffer (pattern);
+ format = gegl_buffer_get_format (src_buffer);
- gegl_buffer_set_pattern (buffer, NULL, pattern_buffer, 0, 0);
- g_object_unref (pattern_buffer);
- }
- else
- {
- GeglColor *gegl_color = gimp_gegl_color_new (&color);
+ dest_buffer = gegl_buffer_new (gegl_buffer_get_extent (src_buffer),
+ gegl_buffer_get_format (src_buffer));
- gegl_buffer_set_color (buffer, NULL, gegl_color);
- g_object_unref (gegl_color);
+ src_profile = gimp_babl_format_get_color_profile (format);
+ dest_profile = gimp_color_managed_get_color_profile (GIMP_COLOR_MANAGED (drawable));
+
+ gimp_gegl_convert_color_profile (src_buffer, NULL, src_profile,
+ dest_buffer, NULL, dest_profile,
+ GIMP_COLOR_RENDERING_INTENT_PERCEPTUAL,
+ TRUE,
+ NULL);
+
+ gegl_buffer_set_pattern (buffer, NULL, dest_buffer, 0, 0);
+
+ g_object_unref (src_buffer);
+ g_object_unref (dest_buffer);
+ }
+ break;
}
return buffer;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]