Bug 766988 - Colors applied to images are not color managed

Color manage colors applied when painting, and when filling, merging,
resizing and transforming drawables.
This commit is contained in:
Michael Natterer
2016-05-29 17:49:37 +02:00
parent d13ed2a42b
commit 4fefc3817c
11 changed files with 54 additions and 7 deletions

View File

@ -445,6 +445,8 @@ gimp_edit_fill (GimpImage *image,
{
case GIMP_FILL_STYLE_SOLID:
gimp_context_get_foreground (GIMP_CONTEXT (options), &color);
gimp_pickable_srgb_to_image_color (GIMP_PICKABLE (drawable),
&color, &color);
break;
case GIMP_FILL_STYLE_PATTERN:

View File

@ -153,6 +153,8 @@ gimp_drawable_bucket_fill (GimpDrawable *drawable,
{
case GIMP_FILL_STYLE_SOLID:
gimp_context_get_foreground (GIMP_CONTEXT (options), &color);
gimp_pickable_srgb_to_image_color (GIMP_PICKABLE (drawable),
&color, &color);
break;
case GIMP_FILL_STYLE_PATTERN:

View File

@ -36,6 +36,7 @@
#include "gimpfilloptions.h"
#include "gimpimage.h"
#include "gimppattern.h"
#include "gimppickable.h"
#include "gimpscanconvert.h"
#include "vectors/gimpvectors.h"
@ -71,6 +72,9 @@ gimp_drawable_fill (GimpDrawable *drawable,
{
GeglColor *gegl_color;
gimp_pickable_srgb_to_image_color (GIMP_PICKABLE (drawable),
&color, &color);
if (! gimp_drawable_has_alpha (drawable))
gimp_rgb_set_alpha (&color, 1.0);
@ -221,6 +225,8 @@ gimp_drawable_fill_scan_convert (GimpDrawable *drawable,
GeglColor *color;
gimp_context_get_foreground (context, &fg);
gimp_pickable_srgb_to_image_color (GIMP_PICKABLE (drawable),
&fg, &fg);
color = gimp_gegl_color_new (&fg);
gegl_buffer_set_color (base_buffer, NULL, color);

View File

@ -35,6 +35,7 @@
#include "gimpdrawable.h"
#include "gimpdrawable-offset.h"
#include "gimpimage.h"
#include "gimppickable.h"
#include "gimp-intl.h"
@ -97,6 +98,8 @@ gimp_drawable_offset (GimpDrawable *drawable,
GeglColor *color;
gimp_context_get_background (context, &bg);
gimp_pickable_srgb_to_image_color (GIMP_PICKABLE (drawable),
&bg, &bg);
color = gimp_gegl_color_new (&bg);
gegl_buffer_set_color (new_buffer, NULL, color);

View File

@ -210,9 +210,15 @@ gimp_drawable_transform_buffer_flip (GimpDrawable *drawable,
/* "Outside" a channel is transparency, not the bg color */
if (GIMP_IS_CHANNEL (drawable))
gimp_rgba_set (&bg, 0.0, 0.0, 0.0, 0.0);
{
gimp_rgba_set (&bg, 0.0, 0.0, 0.0, 0.0);
}
else
gimp_context_get_background (context, &bg);
{
gimp_context_get_background (context, &bg);
gimp_pickable_srgb_to_image_color (GIMP_PICKABLE (drawable),
&bg, &bg);
}
color = gimp_gegl_color_new (&bg);
gegl_buffer_set_color (new_buffer, NULL, color);
@ -418,9 +424,15 @@ gimp_drawable_transform_buffer_rotate (GimpDrawable *drawable,
/* "Outside" a channel is transparency, not the bg color */
if (GIMP_IS_CHANNEL (drawable))
gimp_rgba_set (&bg, 0.0, 0.0, 0.0, 0.0);
{
gimp_rgba_set (&bg, 0.0, 0.0, 0.0, 0.0);
}
else
gimp_context_get_background (context, &bg);
{
gimp_context_get_background (context, &bg);
gimp_pickable_srgb_to_image_color (GIMP_PICKABLE (drawable),
&bg, &bg);
}
color = gimp_gegl_color_new (&bg);
gegl_buffer_set_color (new_buffer, NULL, color);

View File

@ -586,9 +586,15 @@ gimp_drawable_resize (GimpItem *item,
GeglColor *col;
if (! gimp_drawable_has_alpha (drawable) && ! GIMP_IS_CHANNEL (drawable))
gimp_context_get_background (context, &bg);
{
gimp_context_get_background (context, &bg);
gimp_pickable_srgb_to_image_color (GIMP_PICKABLE (drawable),
&bg, &bg);
}
else
gimp_rgba_set (&bg, 0.0, 0.0, 0.0, 0.0);
{
gimp_rgba_set (&bg, 0.0, 0.0, 0.0, 0.0);
}
col = gimp_gegl_color_new (&bg);

View File

@ -47,6 +47,7 @@
#include "gimplayermask.h"
#include "gimpmarshal.h"
#include "gimpparasitelist.h"
#include "gimppickable.h"
#include "gimpundostack.h"
#include "gimp-intl.h"
@ -538,6 +539,8 @@ gimp_image_merge_layers (GimpImage *image,
/* get the background for compositing */
gimp_context_get_background (context, &bg);
gimp_pickable_srgb_to_image_color (GIMP_PICKABLE (layer),
&bg, &bg);
color = gimp_gegl_color_new (&bg);
gegl_buffer_set_color (gimp_drawable_get_buffer (GIMP_DRAWABLE (merge_layer)),

View File

@ -29,6 +29,7 @@
#include "core/gimpdrawable.h"
#include "core/gimpdynamics.h"
#include "core/gimpimage.h"
#include "core/gimppickable.h"
#include "core/gimpsymmetry.h"
#include "gimperaser.h"
@ -95,7 +96,8 @@ gimp_eraser_paint (GimpPaintCore *paint_core,
if (! gimp_drawable_has_alpha (drawable))
{
/* Erasing on a drawable without alpha is equivalent to
* drawing with background color. So let's save history. */
* drawing with background color. So let's save history.
*/
GimpContext *context = GIMP_CONTEXT (paint_options);
GimpRGB background;
@ -153,6 +155,8 @@ gimp_eraser_motion (GimpPaintCore *paint_core,
return;
gimp_context_get_background (context, &background);
gimp_pickable_srgb_to_image_color (GIMP_PICKABLE (drawable),
&background, &background);
color = gimp_gegl_color_new (&background);
if (options->anti_erase)

View File

@ -32,6 +32,7 @@
#include "core/gimpdrawable.h"
#include "core/gimpimage.h"
#include "core/gimpimage-undo.h"
#include "core/gimppickable.h"
#include "core/gimpsymmetry.h"
#include "core/gimptempbuf.h"
@ -398,6 +399,8 @@ gimp_ink_motion (GimpPaintCore *paint_core,
continue;
gimp_context_get_foreground (context, &foreground);
gimp_pickable_srgb_to_image_color (GIMP_PICKABLE (drawable),
&foreground, &foreground);
color = gimp_gegl_color_new (&foreground);
gegl_buffer_set_color (paint_buffer, NULL, color);

View File

@ -37,6 +37,7 @@
#include "core/gimpdrawable.h"
#include "core/gimperror.h"
#include "core/gimpmybrush.h"
#include "core/gimppickable.h"
#include "core/gimpsymmetry.h"
#include "gimpmybrushcore.h"
@ -315,6 +316,8 @@ gimp_mybrush_core_motion (GimpPaintCore *paint_core,
GimpHSV hsv;
gimp_context_get_foreground (context, &fg);
gimp_pickable_srgb_to_image_color (GIMP_PICKABLE (drawable),
&fg, &fg);
gimp_rgb_to_hsv (&fg, &hsv);
g_list_free_full (mybrush->private->brushes,

View File

@ -36,6 +36,7 @@
#include "core/gimpdynamics.h"
#include "core/gimpgradient.h"
#include "core/gimpimage.h"
#include "core/gimppickable.h"
#include "core/gimpsymmetry.h"
#include "core/gimptempbuf.h"
@ -240,6 +241,8 @@ _gimp_paintbrush_motion (GimpPaintCore *paint_core,
GeglColor *color;
gimp_context_get_foreground (context, &foreground);
gimp_pickable_srgb_to_image_color (GIMP_PICKABLE (drawable),
&foreground, &foreground);
color = gimp_gegl_color_new (&foreground);
gegl_buffer_set_color (paint_buffer, NULL, color);