app, libgimp, pdb, plug-ins: getting rid of some GimpRGB usage.

This is a first commit to really getting rid of GimpRGB within core and
PDB/plug-in code. This will make color conversion reliability a lot better as
GeglColor will handle conversions for us. The goal is that we should keep origin
color space (for instance when picking colors in a GimpPickable, or when storing
in the FG/BG colors or in paletters) until the last second and convert at use
only.
It's still very much work-in-progress.
This commit is contained in:
Jehan 2023-11-12 17:56:32 +01:00
parent 75efbf77d3
commit ecf4cfb3c5
24 changed files with 122 additions and 91 deletions

View File

@ -542,7 +542,7 @@ void
gimp_channel_select_by_color (GimpChannel *channel,
GList *drawables,
gboolean sample_merged,
const GimpRGB *color,
GeglColor *color,
gfloat threshold,
gboolean select_transparent,
GimpSelectCriterion select_criterion,

View File

@ -139,7 +139,7 @@ void gimp_channel_select_fuzzy (GimpChannel *channel,
void gimp_channel_select_by_color (GimpChannel *channel,
GList *drawables,
gboolean sample_merged,
const GimpRGB *color,
GeglColor *color,
gfloat threshold,
gboolean select_transparent,
GimpSelectCriterion select_criterion,

View File

@ -52,7 +52,7 @@ gimp_image_pick_color (GimpImage *image,
gdouble average_radius,
const Babl **sample_format,
gpointer pixel,
GimpRGB *color)
GeglColor **color)
{
GimpImage *pick_image = NULL;
GimpPickable *pickable;
@ -60,6 +60,7 @@ gimp_image_pick_color (GimpImage *image,
gboolean result;
g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
g_return_val_if_fail (color != NULL && GEGL_IS_COLOR (*color), FALSE);
for (iter = drawables; iter; iter = iter->next)
{
@ -177,7 +178,7 @@ gimp_image_pick_color (GimpImage *image,
}
if (! result || sample_average)
gimp_pickable_pixel_to_rgb (pickable, format, sample, color);
gegl_color_set_pixel (*color, format, sample);
result = TRUE;
}

View File

@ -29,7 +29,7 @@ gboolean gimp_image_pick_color (GimpImage *image,
gdouble average_radius,
const Babl **sample_format,
gpointer pixel,
GimpRGB *color);
GeglColor **color);
#endif /* __GIMP_IMAGE_PICK_COLOR_H__ */

View File

@ -194,7 +194,7 @@ gimp_pickable_contiguous_region_by_color (GimpPickable *pickable,
gfloat threshold,
gboolean select_transparent,
GimpSelectCriterion select_criterion,
const GimpRGB *color)
GeglColor *color)
{
/* Scan over the pickable's active layer, finding pixels within the
* specified threshold from the given R, G, & B values. If
@ -210,7 +210,7 @@ gimp_pickable_contiguous_region_by_color (GimpPickable *pickable,
gfloat start_col[MAX_CHANNELS];
g_return_val_if_fail (GIMP_IS_PICKABLE (pickable), NULL);
g_return_val_if_fail (color != NULL, NULL);
g_return_val_if_fail (GEGL_IS_COLOR (color), NULL);
/* increase the threshold by EPSILON, to allow for conversion errors,
* especially when threshold == 0 (see issue #1554.) we need to do this
@ -227,7 +227,7 @@ gimp_pickable_contiguous_region_by_color (GimpPickable *pickable,
format = choose_format (src_buffer, select_criterion,
&n_components, &has_alpha);
gimp_rgba_get_pixel (color, format, start_col);
gegl_color_get_pixel (color, format, start_col);
if (has_alpha)
{

View File

@ -33,7 +33,7 @@ GeglBuffer * gimp_pickable_contiguous_region_by_color (GimpPickabl
gfloat threshold,
gboolean select_transparent,
GimpSelectCriterion select_criterion,
const GimpRGB *color);
GeglColor *color);
GeglBuffer * gimp_pickable_contiguous_region_by_line_art (GimpPickable *pickable,
GimpLineArt *line_art,

View File

@ -251,23 +251,23 @@ gimp_pickable_get_pixel_average (GimpPickable *pickable,
memset (pixel, 0, babl_format_get_bytes_per_pixel (format));
}
gboolean
GeglColor *
gimp_pickable_get_color_at (GimpPickable *pickable,
gint x,
gint y,
GimpRGB *color)
gint y)
{
gdouble pixel[4];
GeglColor *color = NULL;
gdouble pixel[4];
g_return_val_if_fail (GIMP_IS_PICKABLE (pickable), FALSE);
g_return_val_if_fail (color != NULL, FALSE);
if (! gimp_pickable_get_pixel_at (pickable, x, y, NULL, pixel))
return FALSE;
if (gimp_pickable_get_pixel_at (pickable, x, y, NULL, pixel))
{
color = gegl_color_new ("black");
gegl_color_set_pixel (color, gimp_pickable_get_format (pickable), pixel);
}
gimp_pickable_pixel_to_rgb (pickable, NULL, pixel, color);
return TRUE;
return color;
}
gdouble
@ -287,6 +287,9 @@ gimp_pickable_get_opacity_at (GimpPickable *pickable,
return GIMP_OPACITY_TRANSPARENT;
}
/* TODO: this will have to be removed eventually and replaced with
* gegl_color_set_pixel(). We should not need GimpRGB anymore!
*/
void
gimp_pickable_pixel_to_rgb (GimpPickable *pickable,
const Babl *format,
@ -363,13 +366,13 @@ gimp_pickable_pick_color (GimpPickable *pickable,
gboolean sample_average,
gdouble average_radius,
gpointer pixel,
GimpRGB *color)
GeglColor **color)
{
const Babl *format;
gdouble sample[4];
g_return_val_if_fail (GIMP_IS_PICKABLE (pickable), FALSE);
g_return_val_if_fail (color != NULL, FALSE);
g_return_val_if_fail (color != NULL && GEGL_IS_COLOR (*color), FALSE);
format = gimp_pickable_get_format (pickable);
@ -394,7 +397,7 @@ gimp_pickable_pick_color (GimpPickable *pickable,
format, sample);
}
gimp_pickable_pixel_to_rgb (pickable, format, sample, color);
gegl_color_set_pixel (*color, format, sample);
return TRUE;
}

View File

@ -70,10 +70,9 @@ gboolean gimp_pickable_get_pixel_at (GimpPickable *pick
gint y,
const Babl *format,
gpointer pixel);
gboolean gimp_pickable_get_color_at (GimpPickable *pickable,
GeglColor * gimp_pickable_get_color_at (GimpPickable *pickable,
gint x,
gint y,
GimpRGB *color);
gint y);
gdouble gimp_pickable_get_opacity_at (GimpPickable *pickable,
gint x,
gint y);
@ -99,7 +98,7 @@ gboolean gimp_pickable_pick_color (GimpPickable *pick
gboolean sample_average,
gdouble average_radius,
gpointer pixel,
GimpRGB *color);
GeglColor **color);
#endif /* __GIMP_PICKABLE_H__ */

View File

@ -758,7 +758,7 @@ gimp_cursor_view_cursor_idle (GimpCursorView *view)
gchar buf[32];
const Babl *sample_format;
gdouble pixel[4];
GimpRGB color;
GeglColor *color;
gdouble xres;
gdouble yres;
gint int_x;
@ -791,6 +791,7 @@ gimp_cursor_view_cursor_idle (GimpCursorView *view)
int_x = (gint) floor (x);
int_y = (gint) floor (y);
color = gegl_color_new ("black");
if (gimp_image_pick_color (image, NULL,
int_x, int_y,
view->priv->shell->show_all,
@ -798,11 +799,15 @@ gimp_cursor_view_cursor_idle (GimpCursorView *view)
FALSE, 0.0,
&sample_format, pixel, &color))
{
GimpRGB rgb;
/* TODO: get rid of GimpRGB. */
gegl_color_get_rgba_with_space (color, &rgb.r, &rgb.g, &rgb.b, &rgb.a, NULL);
gimp_color_frame_set_color (GIMP_COLOR_FRAME (view->priv->color_frame_1),
FALSE, sample_format, pixel, &color,
FALSE, sample_format, pixel, &rgb,
int_x, int_y);
gimp_color_frame_set_color (GIMP_COLOR_FRAME (view->priv->color_frame_2),
FALSE, sample_format, pixel, &color,
FALSE, sample_format, pixel, &rgb,
int_x, int_y);
}
else
@ -817,6 +822,7 @@ gimp_cursor_view_cursor_idle (GimpCursorView *view)
view->priv->cursor_unit);
g_clear_object (&view->priv->cursor_image);
g_object_unref (color);
}
else
{

View File

@ -21,14 +21,11 @@
#include "stamp-pdbgen.h"
#include <cairo.h>
#include <gegl.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#include "libgimpbase/gimpbase.h"
#include "libgimpcolor/gimpcolor.h"
#include "libgimpmath/gimpmath.h"
#include "libgimpbase/gimpbase.h"
@ -657,7 +654,7 @@ image_pick_color_invoker (GimpProcedure *procedure,
gboolean sample_merged;
gboolean sample_average;
gdouble average_radius;
GimpRGB color = { 0.0, 0.0, 0.0, 1.0 };
GeglColor *color = NULL;
image = g_value_get_object (gimp_value_array_index (args, 0));
num_drawables = g_value_get_int (gimp_value_array_index (args, 1));
@ -711,6 +708,7 @@ image_pick_color_invoker (GimpProcedure *procedure,
if (sample_merged)
gimp_pickable_flush (GIMP_PICKABLE (image));
color = gegl_color_new ("black");
success = gimp_image_pick_color (image,
drawable_list,
(gint) x, (gint) y,
@ -730,7 +728,7 @@ image_pick_color_invoker (GimpProcedure *procedure,
error ? *error : NULL);
if (success)
gimp_value_set_rgb (gimp_value_array_index (return_vals, 1), &color);
g_value_take_object (gimp_value_array_index (return_vals, 1), color);
return return_vals;
}
@ -3576,12 +3574,11 @@ register_image_procs (GimpPDB *pdb)
0, G_MAXDOUBLE, 0,
GIMP_PARAM_READWRITE | GIMP_PARAM_NO_VALIDATE));
gimp_procedure_add_return_value (procedure,
gimp_param_spec_rgb ("color",
"color",
"The return color",
TRUE,
NULL,
GIMP_PARAM_READWRITE));
gegl_param_spec_color ("color",
"color",
"The return color",
NULL,
GIMP_PARAM_READWRITE));
gimp_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);

View File

@ -21,14 +21,11 @@
#include "stamp-pdbgen.h"
#include <cairo.h>
#include <gegl.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#include "libgimpbase/gimpbase.h"
#include "libgimpcolor/gimpcolor.h"
#include "libgimpbase/gimpbase.h"
@ -61,12 +58,12 @@ image_select_color_invoker (GimpProcedure *procedure,
GimpImage *image;
gint operation;
GimpDrawable *drawable;
GimpRGB color;
GeglColor *color;
image = g_value_get_object (gimp_value_array_index (args, 0));
operation = g_value_get_enum (gimp_value_array_index (args, 1));
drawable = g_value_get_object (gimp_value_array_index (args, 2));
gimp_value_get_rgb (gimp_value_array_index (args, 3), &color);
color = g_value_get_object (gimp_value_array_index (args, 3));
if (success)
{
@ -78,7 +75,7 @@ image_select_color_invoker (GimpProcedure *procedure,
GList *drawables = g_list_prepend (NULL, drawable);
gimp_channel_select_by_color (gimp_image_get_mask (image), drawables,
pdb_context->sample_merged,
&color,
color,
pdb_context->sample_threshold,
pdb_context->sample_transparent,
pdb_context->sample_criterion,
@ -398,12 +395,11 @@ register_image_select_procs (GimpPDB *pdb)
FALSE,
GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
gimp_param_spec_rgb ("color",
"color",
"The color to select",
FALSE,
NULL,
GIMP_PARAM_READWRITE));
gegl_param_spec_color ("color",
"color",
"The color to select",
NULL,
GIMP_PARAM_READWRITE));
gimp_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure);

View File

@ -106,7 +106,7 @@ gimp_by_color_select_tool_get_mask (GimpRegionSelectTool *region_select,
GList *drawables = gimp_image_get_selected_drawables (image);
GimpPickable *pickable;
GeglBuffer *mask = NULL;
GimpRGB srgb;
GeglColor *color;
gint x, y;
x = region_select->x;
@ -142,18 +142,15 @@ gimp_by_color_select_tool_get_mask (GimpRegionSelectTool *region_select,
g_list_free (drawables);
gimp_pickable_flush (pickable);
if (gimp_pickable_get_color_at (pickable, x, y, &srgb))
if ((color = gimp_pickable_get_color_at (pickable, x, y)) != NULL)
{
GimpRGB color;
gimp_pickable_srgb_to_image_color (pickable, &srgb, &color);
mask = gimp_pickable_contiguous_region_by_color (pickable,
sel_options->antialias,
options->threshold / 255.0,
options->select_transparent,
options->select_criterion,
&color);
color);
g_object_unref (color);
}
if (select_image)

View File

@ -106,7 +106,7 @@ static gboolean gimp_color_tool_real_pick (GimpColorTool *color_tool,
GimpDisplay *display,
const Babl **sample_format,
gpointer pixel,
GimpRGB *color);
GeglColor **color);
static void gimp_color_tool_real_picked (GimpColorTool *color_tool,
const GimpCoords *coords,
GimpDisplay *display,
@ -458,13 +458,14 @@ gimp_color_tool_real_pick (GimpColorTool *color_tool,
GimpDisplay *display,
const Babl **sample_format,
gpointer pixel,
GimpRGB *color)
GeglColor **color)
{
GimpDisplayShell *shell = gimp_display_get_shell (display);
GimpImage *image = gimp_display_get_image (display);
GList *drawables = gimp_image_get_selected_drawables (image);
g_return_val_if_fail (drawables != NULL, FALSE);
g_return_val_if_fail (color != NULL && GEGL_IS_COLOR (*color), FALSE);
return gimp_image_pick_color (image, drawables,
coords->x, coords->y,
@ -628,17 +629,24 @@ gimp_color_tool_pick (GimpColorTool *tool,
GimpColorToolClass *klass;
const Babl *sample_format;
gdouble pixel[4];
GimpRGB color;
GeglColor *color;
klass = GIMP_COLOR_TOOL_GET_CLASS (tool);
color = gegl_color_new ("black");
if (klass->pick &&
klass->pick (tool, coords, display, &sample_format, pixel, &color))
{
GimpRGB rgb;
gegl_color_get_rgba_with_space (color, &rgb.r, &rgb.g, &rgb.b, &rgb.a, NULL);
/* TODO: the "picked" signal should emit a GeglColor. */
g_signal_emit (tool, gimp_color_tool_signals[PICKED], 0,
coords, display, pick_state,
sample_format, pixel, &color);
sample_format, pixel, &rgb);
}
g_object_unref (color);
}

View File

@ -63,7 +63,7 @@ struct _GimpColorToolClass
GimpDisplay *display,
const Babl **sample_format,
gpointer pixel,
GimpRGB *color);
GeglColor **color);
/* signals */
void (* picked) (GimpColorTool *tool,

View File

@ -137,7 +137,7 @@ static gboolean gimp_filter_tool_pick_color (GimpColorTool *color_too
GimpDisplay *display,
const Babl **sample_format,
gpointer pixel,
GimpRGB *color);
GeglColor **color);
static void gimp_filter_tool_color_picked (GimpColorTool *color_tool,
const GimpCoords *coords,
GimpDisplay *display,
@ -828,13 +828,15 @@ gimp_filter_tool_pick_color (GimpColorTool *color_tool,
GimpDisplay *display,
const Babl **sample_format,
gpointer pixel,
GimpRGB *color)
GeglColor **color)
{
GimpTool *tool = GIMP_TOOL (color_tool);
GimpFilterTool *filter_tool = GIMP_FILTER_TOOL (color_tool);
gboolean picked;
g_return_val_if_fail (g_list_length (tool->drawables) == 1, FALSE);
g_return_val_if_fail (color != NULL && GEGL_IS_COLOR (*color), FALSE);
g_return_val_if_fail (sample_format != NULL, FALSE);
picked = GIMP_COLOR_TOOL_CLASS (parent_class)->pick (color_tool, coords,
display, sample_format,
@ -842,10 +844,7 @@ gimp_filter_tool_pick_color (GimpColorTool *color_tool,
if (! picked && filter_tool->pick_abyss)
{
color->r = 0.0;
color->g = 0.0;
color->b = 0.0;
color->a = 0.0;
gegl_color_set_rgba_with_space (*color, 0.0, 0.0, 0.0, 0.0, *sample_format);
picked = TRUE;
}

View File

@ -553,7 +553,7 @@ gimp_sample_point_editor_update (GimpSamplePointEditor *editor)
GimpSamplePoint *sample_point = list->data;
const Babl *format;
gdouble pixel[4];
GimpRGB color;
GeglColor *color;
GimpColorPickMode pick_mode;
gint x;
gint y;
@ -563,6 +563,7 @@ gimp_sample_point_editor_update (GimpSamplePointEditor *editor)
gimp_sample_point_get_position (sample_point, &x, &y);
color = gegl_color_new ("black");
if (gimp_image_pick_color (image_editor->image, NULL,
x, y,
FALSE,
@ -572,8 +573,12 @@ gimp_sample_point_editor_update (GimpSamplePointEditor *editor)
pixel,
&color))
{
GimpRGB rgb;
/* TODO: use GeglColor. */
gegl_color_get_rgba_with_space (color, &rgb.r, &rgb.g, &rgb.b, &rgb.a, NULL);
gimp_color_frame_set_color (color_frame, FALSE,
format, pixel, &color,
format, pixel, &rgb,
x, y);
}
else
@ -584,6 +589,8 @@ gimp_sample_point_editor_update (GimpSamplePointEditor *editor)
pick_mode = gimp_sample_point_get_pick_mode (sample_point);
gimp_color_frame_set_mode (color_frame, pick_mode);
g_object_unref (color);
}
}

View File

@ -248,7 +248,7 @@ gimp_selection_view_button_press (GtkWidget *widget,
GimpChannelOps operation;
GList *drawables;
gint x, y;
GimpRGB color;
GeglColor *color;
if (! image_editor->image)
return TRUE;
@ -274,6 +274,7 @@ gimp_selection_view_button_press (GtkWidget *widget,
x = gimp_image_get_width (image_editor->image) * bevent->x / renderer->width;
y = gimp_image_get_height (image_editor->image) * bevent->y / renderer->height;
color = gegl_color_new ("black");
if (gimp_image_pick_color (image_editor->image, drawables, x, y,
FALSE, options->sample_merged,
FALSE, 0.0,
@ -283,7 +284,7 @@ gimp_selection_view_button_press (GtkWidget *widget,
gimp_channel_select_by_color (gimp_image_get_mask (image_editor->image),
drawables,
options->sample_merged,
&color,
color,
options->threshold / 255.0,
options->select_transparent,
options->select_criterion,
@ -294,7 +295,9 @@ gimp_selection_view_button_press (GtkWidget *widget,
sel_options->feather_radius);
gimp_image_flush (image_editor->image);
}
g_list_free (drawables);
g_object_unref (color);
return TRUE;
}
@ -303,7 +306,8 @@ static void
gimp_selection_editor_drop_color (GtkWidget *widget,
gint x,
gint y,
const GimpRGB *color,
/* TODO: should drop a GeglColor */
const GimpRGB *rgb,
gpointer data)
{
GimpImageEditor *editor = GIMP_IMAGE_EDITOR (data);
@ -311,6 +315,7 @@ gimp_selection_editor_drop_color (GtkWidget *widget,
GimpSelectionOptions *sel_options;
GimpRegionSelectOptions *options;
GList *drawables;
GeglColor *color;
if (! editor->image)
return;
@ -328,6 +333,8 @@ gimp_selection_editor_drop_color (GtkWidget *widget,
if (! drawables)
return;
color = gegl_color_new ("black");
gegl_color_set_rgba_with_space (color, rgb->r, rgb->g, rgb->b, rgb->a, NULL);
gimp_channel_select_by_color (gimp_image_get_mask (editor->image),
drawables,
options->sample_merged,
@ -342,6 +349,7 @@ gimp_selection_editor_drop_color (GtkWidget *widget,
sel_options->feather_radius);
gimp_image_flush (editor->image);
g_list_free (drawables);
g_object_unref (color);
}
static void

View File

@ -723,7 +723,7 @@ gimp_image_floating_sel_attached_to (GimpImage *image)
* @sample_merged: Use the composite image, not the drawables.
* @sample_average: Average the color of all the pixels in a specified radius.
* @average_radius: The radius of pixels to average.
* @color: (out caller-allocates): The return color.
* @color: (out) (transfer full): The return color.
*
* Determine the color at the given coordinates
*
@ -754,7 +754,7 @@ gimp_image_pick_color (GimpImage *image,
gboolean sample_merged,
gboolean sample_average,
gdouble average_radius,
GimpRGB *color)
GeglColor **color)
{
GimpValueArray *args;
GimpValueArray *return_vals;
@ -777,10 +777,12 @@ gimp_image_pick_color (GimpImage *image,
args);
gimp_value_array_unref (args);
*color = NULL;
success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
if (success)
GIMP_VALUES_GET_RGB (return_vals, 1, &*color);
*color = g_value_dup_object (gimp_value_array_index (return_vals, 1));
gimp_value_array_unref (return_vals);

View File

@ -65,7 +65,7 @@ gboolean gimp_image_pick_color (GimpImage
gboolean sample_merged,
gboolean sample_average,
gdouble average_radius,
GimpRGB *color);
GeglColor **color);
GimpLayer* gimp_image_pick_correlate_layer (GimpImage *image,
gint x,
gint y);

View File

@ -71,7 +71,7 @@ gboolean
gimp_image_select_color (GimpImage *image,
GimpChannelOps operation,
GimpDrawable *drawable,
const GimpRGB *color)
GeglColor *color)
{
GimpValueArray *args;
GimpValueArray *return_vals;
@ -81,7 +81,7 @@ gimp_image_select_color (GimpImage *image,
GIMP_TYPE_IMAGE, image,
GIMP_TYPE_CHANNEL_OPS, operation,
GIMP_TYPE_DRAWABLE, drawable,
GIMP_TYPE_RGB, color,
GEGL_TYPE_COLOR, color,
G_TYPE_NONE);
return_vals = _gimp_pdb_run_procedure_array (gimp_get_pdb (),

View File

@ -35,7 +35,7 @@ G_BEGIN_DECLS
gboolean gimp_image_select_color (GimpImage *image,
GimpChannelOps operation,
GimpDrawable *drawable,
const GimpRGB *color);
GeglColor *color);
gboolean gimp_image_select_contiguous_color (GimpImage *image,
GimpChannelOps operation,
GimpDrawable *drawable,

View File

@ -457,7 +457,7 @@ HELP
);
@outargs = (
{ name => 'color', type => 'color', has_alpha => 1, void_ret => 1,
{ name => 'color', type => 'geglcolor', has_alpha => 1, void_ret => 1,
desc => 'The return color' }
);
@ -506,6 +506,7 @@ HELP
if (sample_merged)
gimp_pickable_flush (GIMP_PICKABLE (image));
color = gegl_color_new ("black");
success = gimp_image_pick_color (image,
drawable_list,
(gint) x, (gint) y,

View File

@ -51,7 +51,7 @@ HELP
desc => 'The selection operation' },
{ name => 'drawable', type => 'drawable',
desc => 'The affected drawable' },
{ name => 'color', type => 'color',
{ name => 'color', type => 'geglcolor',
desc => 'The color to select' }
);
@ -66,7 +66,7 @@ HELP
GList *drawables = g_list_prepend (NULL, drawable);
gimp_channel_select_by_color (gimp_image_get_mask (image), drawables,
pdb_context->sample_merged,
&color,
color,
pdb_context->sample_threshold,
pdb_context->sample_transparent,
pdb_context->sample_criterion,

View File

@ -1554,7 +1554,7 @@ drawText (GimpLayer *layer,
cairo_font_options_t *options;
gint x;
gint y;
GimpRGB color;
GimpRGB rgb;
GimpUnit unit;
gdouble size;
GimpTextHintStyle hinting;
@ -1587,13 +1587,20 @@ drawText (GimpLayer *layer,
/* When dealing with a gray/indexed image, the viewed color of the text layer
* can be different than the one kept in the memory */
if (type == GIMP_RGBA_IMAGE)
gimp_text_layer_get_color (GIMP_TEXT_LAYER (layer), &color);
{
gimp_text_layer_get_color (GIMP_TEXT_LAYER (layer), &rgb);
}
else
gimp_image_pick_color (gimp_item_get_image (GIMP_ITEM (layer)), 1,
(const GimpItem**) &layer, x, y, FALSE, FALSE, 0,
&color);
{
GeglColor *color;
cairo_set_source_rgba (cr, color.r, color.g, color.b, opacity);
gimp_image_pick_color (gimp_item_get_image (GIMP_ITEM (layer)), 1,
(const GimpItem**) &layer, x, y, FALSE, FALSE, 0,
&color);
gegl_color_get_rgba_with_space (color, &rgb.r, &rgb.g, &rgb.b, &rgb.a, NULL);
}
cairo_set_source_rgba (cr, rgb.r, rgb.g, rgb.b, opacity);
/* Hinting */
hinting = gimp_text_layer_get_hint_style (GIMP_TEXT_LAYER (layer));