app, libgimp*, plug-ins, tools: settings custom check colors now space-invaded.

We pass 2 GeglColor through the wire now. Since it is passed very early
(when sharing the configuration), I had some issues with initialization
order of GEGL, and in particular when calling gegl_init() before
gegl_config() inside _gimp_config(), I had a bunch of such criticals:

> Plugin script-fu: GLib-GObject: CRITICAL: Two different plugins tried to register 'GeglOpPlugIn-transform-core'

Anyway in the end, I store the passed colors as raw bytes and strings in
the GPConfig object, and re-construct the GeglColor last minute in
_gimp_config().
This commit is contained in:
Jehan 2023-11-20 21:38:11 +01:00
parent 7d2d96a0da
commit b06fe36970
32 changed files with 575 additions and 229 deletions

View file

@ -1053,10 +1053,10 @@ view_actions_check_type_notify (GimpDisplayConfig *config,
GParamSpec *pspec, GParamSpec *pspec,
GimpActionGroup *group) GimpActionGroup *group)
{ {
gimp_action_group_set_action_color (group, "view-padding-color-light-check", GimpRGB rgb;
gimp_render_check_color1 (),
FALSE); gegl_color_get_pixel ((GeglColor *) gimp_render_check_color1 (), babl_format ("R'G'B'A double"), &rgb);
gimp_action_group_set_action_color (group, "view-padding-color-dark-check", gimp_action_group_set_action_color (group, "view-padding-color-light-check", &rgb, FALSE);
gimp_render_check_color2 (), gegl_color_get_pixel ((GeglColor *) gimp_render_check_color2 (), babl_format ("R'G'B'A double"), &rgb);
FALSE); gimp_action_group_set_action_color (group, "view-padding-color-dark-check", &rgb, FALSE);
} }

View file

@ -115,7 +115,8 @@ static void
gimp_display_config_class_init (GimpDisplayConfigClass *klass) gimp_display_config_class_init (GimpDisplayConfigClass *klass)
{ {
GObjectClass *object_class = G_OBJECT_CLASS (klass); GObjectClass *object_class = G_OBJECT_CLASS (klass);
GimpRGB color = { 0, 0, 0, 0 }; GimpRGB xor_rgb = { 0, 0, 0, 0 };
GeglColor *color = gegl_color_new (NULL);
object_class->finalize = gimp_display_config_finalize; object_class->finalize = gimp_display_config_finalize;
object_class->set_property = gimp_display_config_set_property; object_class->set_property = gimp_display_config_set_property;
@ -137,18 +138,20 @@ gimp_display_config_class_init (GimpDisplayConfigClass *klass)
GIMP_CHECK_TYPE_GRAY_CHECKS, GIMP_CHECK_TYPE_GRAY_CHECKS,
GIMP_PARAM_STATIC_STRINGS); GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_PROP_RGB (object_class, PROP_TRANSPARENCY_CUSTOM_COLOR1, gegl_color_set_pixel (color, babl_format ("R'G'B'A double"), &GIMP_CHECKS_CUSTOM_COLOR1);
GIMP_CONFIG_PROP_COLOR (object_class, PROP_TRANSPARENCY_CUSTOM_COLOR1,
"transparency-custom-color1", "transparency-custom-color1",
_("Transparency custom color 1"), _("Transparency custom color 1"),
TRANSPARENCY_CUSTOM_COLOR1_BLURB, TRANSPARENCY_CUSTOM_COLOR1_BLURB,
FALSE, &GIMP_CHECKS_CUSTOM_COLOR1, color,
GIMP_PARAM_STATIC_STRINGS); GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_PROP_RGB (object_class, PROP_TRANSPARENCY_CUSTOM_COLOR2, gegl_color_set_pixel (color, babl_format ("R'G'B'A double"), &GIMP_CHECKS_CUSTOM_COLOR2);
GIMP_CONFIG_PROP_COLOR (object_class, PROP_TRANSPARENCY_CUSTOM_COLOR2,
"transparency-custom-color2", "transparency-custom-color2",
_("Transparency custom color 2"), _("Transparency custom color 2"),
TRANSPARENCY_CUSTOM_COLOR2_BLURB, TRANSPARENCY_CUSTOM_COLOR2_BLURB,
FALSE, &GIMP_CHECKS_CUSTOM_COLOR2, color,
GIMP_PARAM_STATIC_STRINGS); GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_PROP_INT (object_class, PROP_SNAP_DISTANCE, GIMP_CONFIG_PROP_INT (object_class, PROP_SNAP_DISTANCE,
@ -379,7 +382,7 @@ gimp_display_config_class_init (GimpDisplayConfigClass *klass)
GIMP_CONFIG_PROP_RGB (object_class, PROP_XOR_COLOR, GIMP_CONFIG_PROP_RGB (object_class, PROP_XOR_COLOR,
"xor-color", "xor-color",
NULL, NULL, NULL, NULL,
FALSE, &color, FALSE, &xor_rgb,
GIMP_PARAM_STATIC_STRINGS | GIMP_PARAM_STATIC_STRINGS |
GIMP_CONFIG_PARAM_IGNORE); GIMP_CONFIG_PARAM_IGNORE);
@ -400,11 +403,23 @@ gimp_display_config_class_init (GimpDisplayConfigClass *klass)
NULL, NULL, NULL, NULL,
G_TYPE_OBJECT, G_TYPE_OBJECT,
GIMP_PARAM_READWRITE)); GIMP_PARAM_READWRITE));
g_object_unref (color);
} }
static void static void
gimp_display_config_init (GimpDisplayConfig *config) gimp_display_config_init (GimpDisplayConfig *config)
{ {
GeglColor *color;
color = gegl_color_new (NULL);
gegl_color_set_pixel (color, babl_format ("R'G'B'A double"), &GIMP_CHECKS_CUSTOM_COLOR1);
config->transparency_custom_color1 = color;
color = gegl_color_new (NULL);
gegl_color_set_pixel (color, babl_format ("R'G'B'A double"), &GIMP_CHECKS_CUSTOM_COLOR2);
config->transparency_custom_color2 = color;
config->default_view = config->default_view =
g_object_new (GIMP_TYPE_DISPLAY_OPTIONS, NULL); g_object_new (GIMP_TYPE_DISPLAY_OPTIONS, NULL);
@ -431,6 +446,8 @@ gimp_display_config_finalize (GObject *object)
g_clear_object (&display_config->default_view); g_clear_object (&display_config->default_view);
g_clear_object (&display_config->default_fullscreen_view); g_clear_object (&display_config->default_fullscreen_view);
g_clear_object (&display_config->modifiers_manager); g_clear_object (&display_config->modifiers_manager);
g_clear_object (&display_config->transparency_custom_color1);
g_clear_object (&display_config->transparency_custom_color2);
G_OBJECT_CLASS (parent_class)->finalize (object); G_OBJECT_CLASS (parent_class)->finalize (object);
} }
@ -452,10 +469,12 @@ gimp_display_config_set_property (GObject *object,
display_config->transparency_type = g_value_get_enum (value); display_config->transparency_type = g_value_get_enum (value);
break; break;
case PROP_TRANSPARENCY_CUSTOM_COLOR1: case PROP_TRANSPARENCY_CUSTOM_COLOR1:
display_config->transparency_custom_color1 = *(GimpRGB *) g_value_get_boxed (value); g_clear_object (&display_config->transparency_custom_color1);
display_config->transparency_custom_color1 = gegl_color_duplicate (g_value_get_object (value));
break; break;
case PROP_TRANSPARENCY_CUSTOM_COLOR2: case PROP_TRANSPARENCY_CUSTOM_COLOR2:
display_config->transparency_custom_color2 = *(GimpRGB *) g_value_get_boxed (value); g_clear_object (&display_config->transparency_custom_color2);
display_config->transparency_custom_color2 = gegl_color_duplicate (g_value_get_object (value));
break; break;
case PROP_SNAP_DISTANCE: case PROP_SNAP_DISTANCE:
display_config->snap_distance = g_value_get_int (value); display_config->snap_distance = g_value_get_int (value);
@ -579,10 +598,10 @@ gimp_display_config_get_property (GObject *object,
g_value_set_enum (value, display_config->transparency_type); g_value_set_enum (value, display_config->transparency_type);
break; break;
case PROP_TRANSPARENCY_CUSTOM_COLOR1: case PROP_TRANSPARENCY_CUSTOM_COLOR1:
g_value_set_boxed (value, &display_config->transparency_custom_color1); g_value_set_object (value, display_config->transparency_custom_color1);
break; break;
case PROP_TRANSPARENCY_CUSTOM_COLOR2: case PROP_TRANSPARENCY_CUSTOM_COLOR2:
g_value_set_boxed (value, &display_config->transparency_custom_color2); g_value_set_object (value, display_config->transparency_custom_color2);
break; break;
case PROP_SNAP_DISTANCE: case PROP_SNAP_DISTANCE:
g_value_set_int (value, display_config->snap_distance); g_value_set_int (value, display_config->snap_distance);

View file

@ -43,8 +43,8 @@ struct _GimpDisplayConfig
GimpCheckSize transparency_size; GimpCheckSize transparency_size;
GimpCheckType transparency_type; GimpCheckType transparency_type;
GimpRGB transparency_custom_color1; GeglColor *transparency_custom_color1;
GimpRGB transparency_custom_color2; GeglColor *transparency_custom_color2;
gint snap_distance; gint snap_distance;
gint marching_ants_speed; gint marching_ants_speed;
gboolean resize_windows_on_zoom; gboolean resize_windows_on_zoom;

View file

@ -268,7 +268,7 @@ gimp_canvas_get_layout (GimpCanvas *canvas,
/** /**
* gimp_canvas_set_padding: * gimp_canvas_set_padding:
* @canvas: a #GimpCanvas widget * @canvas: a #GimpCanvas widget
* @color: a color in #GimpRGB format * @color: a color in #GeglColor format
* *
* Sets the background color of the canvas's window. This * Sets the background color of the canvas's window. This
* is the color the canvas is set to if it is cleared. * is the color the canvas is set to if it is cleared.
@ -276,13 +276,14 @@ gimp_canvas_get_layout (GimpCanvas *canvas,
void void
gimp_canvas_set_padding (GimpCanvas *canvas, gimp_canvas_set_padding (GimpCanvas *canvas,
GimpCanvasPaddingMode padding_mode, GimpCanvasPaddingMode padding_mode,
const GimpRGB *padding_color) GeglColor *padding_color)
{ {
g_return_if_fail (GIMP_IS_CANVAS (canvas)); g_return_if_fail (GIMP_IS_CANVAS (canvas));
g_return_if_fail (padding_color != NULL); g_return_if_fail (GEGL_IS_COLOR (padding_color));
canvas->padding_mode = padding_mode; canvas->padding_mode = padding_mode;
canvas->padding_color = *padding_color; g_clear_object (&canvas->padding_color);
canvas->padding_color = gegl_color_duplicate (padding_color);
gtk_widget_queue_draw (GTK_WIDGET (canvas)); gtk_widget_queue_draw (GTK_WIDGET (canvas));
} }

View file

@ -56,7 +56,7 @@ struct _GimpCanvas
PangoLayout *layout; PangoLayout *layout;
GimpCanvasPaddingMode padding_mode; GimpCanvasPaddingMode padding_mode;
GimpRGB padding_color; GeglColor *padding_color;
}; };
struct _GimpCanvasClass struct _GimpCanvasClass
@ -75,7 +75,7 @@ PangoLayout * gimp_canvas_get_layout (GimpCanvas *canvas,
void gimp_canvas_set_padding (GimpCanvas *canvas, void gimp_canvas_set_padding (GimpCanvas *canvas,
GimpCanvasPaddingMode padding_mode, GimpCanvasPaddingMode padding_mode,
const GimpRGB *padding_color); GeglColor *padding_color);
#endif /* __GIMP_CANVAS_H__ */ #endif /* __GIMP_CANVAS_H__ */

View file

@ -516,13 +516,12 @@ gimp_display_shell_set_padding (GimpDisplayShell *shell,
GimpMenuModel *model; GimpMenuModel *model;
GimpDisplayOptions *options; GimpDisplayOptions *options;
GeglColor *color; GeglColor *color;
GimpRGB rgb;
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell)); g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
g_return_if_fail (GEGL_IS_COLOR (padding_color)); g_return_if_fail (GEGL_IS_COLOR (padding_color));
options = appearance_get_options (shell); options = appearance_get_options (shell);
color = gegl_color_duplicate (padding_color); color = padding_color;
switch (padding_mode) switch (padding_mode)
{ {
@ -530,11 +529,11 @@ gimp_display_shell_set_padding (GimpDisplayShell *shell,
break; break;
case GIMP_CANVAS_PADDING_MODE_LIGHT_CHECK: case GIMP_CANVAS_PADDING_MODE_LIGHT_CHECK:
gegl_color_set_pixel (color, babl_format ("R'G'B'A double"), gimp_render_check_color1 ()); color = GEGL_COLOR (gimp_render_check_color1 ());
break; break;
case GIMP_CANVAS_PADDING_MODE_DARK_CHECK: case GIMP_CANVAS_PADDING_MODE_DARK_CHECK:
gegl_color_set_pixel (color, babl_format ("R'G'B'A double"), gimp_render_check_color2 ()); color = GEGL_COLOR (gimp_render_check_color2 ());
break; break;
case GIMP_CANVAS_PADDING_MODE_CUSTOM: case GIMP_CANVAS_PADDING_MODE_CUSTOM:
@ -542,22 +541,28 @@ gimp_display_shell_set_padding (GimpDisplayShell *shell,
break; break;
} }
color = gegl_color_duplicate (color);
g_object_set (options, g_object_set (options,
"padding-mode", padding_mode, "padding-mode", padding_mode,
"padding-color", color, "padding-color", color,
NULL); NULL);
gegl_color_get_pixel (color, babl_format ("R'G'B'A double"), &rgb);
gimp_canvas_set_padding (GIMP_CANVAS (shell->canvas), gimp_canvas_set_padding (GIMP_CANVAS (shell->canvas),
padding_mode, &rgb); padding_mode, color);
window = gimp_display_shell_get_window (shell); window = gimp_display_shell_get_window (shell);
model = gimp_image_window_get_menubar_model (window); model = gimp_image_window_get_menubar_model (window);
gegl_color_get_pixel (options->padding_color, babl_format ("R'G'B'A double"), &rgb);
if (padding_mode != GIMP_CANVAS_PADDING_MODE_DEFAULT) if (padding_mode != GIMP_CANVAS_PADDING_MODE_DEFAULT)
{
GimpRGB rgb;
gegl_color_get_pixel (options->padding_color, babl_format ("R'G'B'A double"), &rgb);
gimp_menu_model_set_color (model, "/View/Padding color", &rgb); gimp_menu_model_set_color (model, "/View/Padding color", &rgb);
}
else else
{
gimp_menu_model_set_color (model, "/View/Padding color", NULL); gimp_menu_model_set_color (model, "/View/Padding color", NULL);
}
g_object_unref (color); g_object_unref (color);
} }
@ -577,7 +582,7 @@ gimp_display_shell_get_padding (GimpDisplayShell *shell,
*padding_mode = options->padding_mode; *padding_mode = options->padding_mode;
if (padding_color) if (padding_color)
*padding_color = options->padding_color; *padding_color = gegl_color_duplicate (options->padding_color);
} }
void void

View file

@ -92,6 +92,7 @@ gimp_display_shell_canvas_realize (GtkWidget *canvas,
gimp_display_shell_get_padding (shell, &padding_mode, &padding_color); gimp_display_shell_get_padding (shell, &padding_mode, &padding_color);
gimp_display_shell_set_padding (shell, padding_mode, padding_color); gimp_display_shell_set_padding (shell, padding_mode, padding_color);
g_clear_object (&padding_color);
gtk_widget_get_allocation (canvas, &allocation); gtk_widget_get_allocation (canvas, &allocation);

View file

@ -89,7 +89,10 @@ gimp_display_shell_draw_background (GimpDisplayShell *shell,
if (canvas->padding_mode != GIMP_CANVAS_PADDING_MODE_DEFAULT) if (canvas->padding_mode != GIMP_CANVAS_PADDING_MODE_DEFAULT)
{ {
gimp_cairo_set_source_rgb (cr, &canvas->padding_color); GimpRGB rgb;
gegl_color_get_pixel (canvas->padding_color, babl_format ("R'G'B'A double"), &rgb);
gimp_cairo_set_source_rgb (cr, &rgb);
cairo_paint (cr); cairo_paint (cr);
} }
} }
@ -108,16 +111,18 @@ gimp_display_shell_draw_checkerboard (GimpDisplayShell *shell,
if (G_UNLIKELY (! shell->checkerboard)) if (G_UNLIKELY (! shell->checkerboard))
{ {
GimpCheckSize check_size; GimpCheckSize check_size;
GimpRGB rgb1;
GimpRGB rgb2;
g_object_get (shell->display->config, g_object_get (shell->display->config,
"transparency-size", &check_size, "transparency-size", &check_size,
NULL); NULL);
gegl_color_get_pixel (GEGL_COLOR (gimp_render_check_color1 ()), babl_format ("R'G'B'A double"), &rgb1);
gegl_color_get_pixel (GEGL_COLOR (gimp_render_check_color2 ()), babl_format ("R'G'B'A double"), &rgb2);
shell->checkerboard = shell->checkerboard =
gimp_cairo_checkerboard_create (cr, gimp_cairo_checkerboard_create (cr, 1 << (check_size + 2), &rgb1, &rgb2);
1 << (check_size + 2),
gimp_render_check_color1 (),
gimp_render_check_color2 ());
} }
cairo_translate (cr, - shell->offset_x, - shell->offset_y); cairo_translate (cr, - shell->offset_x, - shell->offset_y);

View file

@ -1070,6 +1070,8 @@ gimp_display_shell_check_notify_handler (GObject *config,
} }
gimp_display_shell_expose_full (shell); gimp_display_shell_expose_full (shell);
g_object_unref (padding_color);
} }
static void static void
@ -1151,7 +1153,8 @@ gimp_display_shell_padding_notify_handler (GObject *config,
else else
{ {
shell->fullscreen_options->padding_mode = padding_mode; shell->fullscreen_options->padding_mode = padding_mode;
shell->fullscreen_options->padding_color = padding_color; g_clear_object (&shell->fullscreen_options->padding_color);
shell->fullscreen_options->padding_color = gegl_color_duplicate (padding_color);
} }
} }
@ -1164,7 +1167,8 @@ gimp_display_shell_padding_notify_handler (GObject *config,
if (fullscreen) if (fullscreen)
{ {
shell->options->padding_mode = padding_mode; shell->options->padding_mode = padding_mode;
shell->options->padding_color = padding_color; g_clear_object (&shell->options->padding_color);
shell->options->padding_color = gegl_color_duplicate (padding_color);
} }
else else
{ {

View file

@ -178,6 +178,9 @@ gimp_plug_in_manager_call_run (GimpPlugInManager *manager,
gint display_id; gint display_id;
GObject *monitor; GObject *monitor;
GFile *icon_theme_dir; GFile *icon_theme_dir;
const Babl *format;
const guint8 *icc;
gint icc_length;
if (! gimp_plug_in_open (plug_in, GIMP_PLUG_IN_CALL_RUN, FALSE)) if (! gimp_plug_in_open (plug_in, GIMP_PLUG_IN_CALL_RUN, FALSE))
{ {
@ -210,8 +213,19 @@ gimp_plug_in_manager_call_run (GimpPlugInManager *manager,
-1); -1);
config.check_size = display_config->transparency_size; config.check_size = display_config->transparency_size;
config.check_type = display_config->transparency_type; config.check_type = display_config->transparency_type;
config.check_custom_color1 = display_config->transparency_custom_color1;
config.check_custom_color2 = display_config->transparency_custom_color2; format = gegl_color_get_format (display_config->transparency_custom_color1);
config.check_custom_encoding1 = (gchar *) babl_format_get_encoding (format);
config.check_custom_color1 = gegl_color_get_bytes (display_config->transparency_custom_color1, format);
icc = (const guint8 *) babl_space_get_icc (babl_format_get_space (format), &icc_length);
config.check_custom_icc1 = g_bytes_new (icc, (gsize) icc_length);
format = gegl_color_get_format (display_config->transparency_custom_color2);
config.check_custom_encoding2 = (gchar *) babl_format_get_encoding (format);
config.check_custom_color2 = gegl_color_get_bytes (display_config->transparency_custom_color2, format);
icc = (const guint8 *) babl_space_get_icc (babl_format_get_space (format), &icc_length);
config.check_custom_icc2 = g_bytes_new (icc, (gsize) icc_length);
config.show_help_button = (gui_config->use_help && config.show_help_button = (gui_config->use_help &&
gui_config->show_help_button); gui_config->show_help_button);
config.use_cpu_accel = manager->gimp->use_cpu_accel; config.use_cpu_accel = manager->gimp->use_cpu_accel;
@ -267,6 +281,10 @@ gimp_plug_in_manager_call_run (GimpPlugInManager *manager,
g_free (config.display_name); g_free (config.display_name);
g_free (config.icon_theme_dir); g_free (config.icon_theme_dir);
g_bytes_unref (config.check_custom_color1);
g_bytes_unref (config.check_custom_icc1);
g_bytes_unref (config.check_custom_color2);
g_bytes_unref (config.check_custom_icc2);
_gimp_gp_params_free (proc_run.params, proc_run.n_params, FALSE); _gimp_gp_params_free (proc_run.params, proc_run.n_params, FALSE);

View file

@ -37,8 +37,8 @@ static void gimp_render_setup_notify (gpointer config,
Gimp *gimp); Gimp *gimp);
static GimpRGB color1; static GeglColor *color1 = NULL;
static GimpRGB color2; static GeglColor *color2 = NULL;
void void
@ -46,6 +46,11 @@ gimp_render_init (Gimp *gimp)
{ {
g_return_if_fail (GIMP_IS_GIMP (gimp)); g_return_if_fail (GIMP_IS_GIMP (gimp));
color1 = gegl_color_new (NULL);
gegl_color_set_pixel (color1, babl_format ("R'G'B'A double"), &GIMP_CHECKS_CUSTOM_COLOR1);
color2 = gegl_color_new (NULL);
gegl_color_set_pixel (color2, babl_format ("R'G'B'A double"), &GIMP_CHECKS_CUSTOM_COLOR2);
g_signal_connect (gimp->config, "notify::transparency-type", g_signal_connect (gimp->config, "notify::transparency-type",
G_CALLBACK (gimp_render_setup_notify), G_CALLBACK (gimp_render_setup_notify),
gimp); gimp);
@ -69,18 +74,21 @@ gimp_render_exit (Gimp *gimp)
g_signal_handlers_disconnect_by_func (gimp->config, g_signal_handlers_disconnect_by_func (gimp->config,
gimp_render_setup_notify, gimp_render_setup_notify,
gimp); gimp);
g_clear_object (&color1);
g_clear_object (&color2);
} }
const GimpRGB * const GeglColor *
gimp_render_check_color1 (void) gimp_render_check_color1 (void)
{ {
return &color1; return color1;
} }
const GimpRGB * const GeglColor *
gimp_render_check_color2 (void) gimp_render_check_color2 (void)
{ {
return &color2; return color2;
} }
static void static void
@ -88,8 +96,8 @@ gimp_render_setup_notify (gpointer config,
GParamSpec *param_spec, GParamSpec *param_spec,
Gimp *gimp) Gimp *gimp)
{ {
GimpRGB *color1_custom; GeglColor *color1_custom = NULL;
GimpRGB *color2_custom; GeglColor *color2_custom = NULL;
GimpCheckType check_type; GimpCheckType check_type;
g_object_get (config, g_object_get (config,
@ -98,9 +106,11 @@ gimp_render_setup_notify (gpointer config,
"transparency-custom-color2", &color2_custom, "transparency-custom-color2", &color2_custom,
NULL); NULL);
color1 = *color1_custom; g_clear_object (&color1);
color2 = *color2_custom; g_clear_object (&color2);
color1 = color1_custom;
color2 = color2_custom;
gimp_checks_get_colors (check_type, &color1, &color2); gimp_checks_get_colors (check_type, &color1, &color2);
g_free (color1_custom); g_clear_object (&color1_custom);
g_free (color2_custom); g_clear_object (&color2_custom);
} }

View file

@ -22,8 +22,8 @@
void gimp_render_init (Gimp *gimp); void gimp_render_init (Gimp *gimp);
void gimp_render_exit (Gimp *gimp); void gimp_render_exit (Gimp *gimp);
const GimpRGB * gimp_render_check_color1 (void); const GeglColor * gimp_render_check_color1 (void);
const GimpRGB * gimp_render_check_color2 (void); const GeglColor * gimp_render_check_color2 (void);
#endif /* __GIMP_RENDER_H__ */ #endif /* __GIMP_RENDER_H__ */

View file

@ -773,10 +773,14 @@ gimp_view_renderer_real_draw (GimpViewRenderer *renderer,
if (content == CAIRO_CONTENT_COLOR_ALPHA) if (content == CAIRO_CONTENT_COLOR_ALPHA)
{ {
if (! renderer->priv->pattern) if (! renderer->priv->pattern)
renderer->priv->pattern = {
gimp_cairo_checkerboard_create (cr, GIMP_CHECK_SIZE_SM, GimpRGB rgb1;
gimp_render_check_color1 (), GimpRGB rgb2;
gimp_render_check_color2 ());
gegl_color_get_pixel ((GeglColor *) gimp_render_check_color1 (), babl_format ("R'G'B'A double"), &rgb1);
gegl_color_get_pixel ((GeglColor *) gimp_render_check_color2 (), babl_format ("R'G'B'A double"), &rgb2);
renderer->priv->pattern = gimp_cairo_checkerboard_create (cr, GIMP_CHECK_SIZE_SM, &rgb1, &rgb2);
}
cairo_set_source (cr, renderer->priv->pattern); cairo_set_source (cr, renderer->priv->pattern);
cairo_fill_preserve (cr); cairo_fill_preserve (cr);
@ -1149,10 +1153,14 @@ gimp_view_render_temp_buf_to_surface (GimpViewRenderer *renderer,
inside_bg == GIMP_VIEW_BG_CHECKS) inside_bg == GIMP_VIEW_BG_CHECKS)
{ {
if (! renderer->priv->pattern) if (! renderer->priv->pattern)
renderer->priv->pattern = {
gimp_cairo_checkerboard_create (cr, GIMP_CHECK_SIZE_SM, GimpRGB rgb1;
gimp_render_check_color1 (), GimpRGB rgb2;
gimp_render_check_color2 ());
gegl_color_get_pixel ((GeglColor *) gimp_render_check_color1 (), babl_format ("R'G'B'A double"), &rgb1);
gegl_color_get_pixel ((GeglColor *) gimp_render_check_color2 (), babl_format ("R'G'B'A double"), &rgb2);
renderer->priv->pattern = gimp_cairo_checkerboard_create (cr, GIMP_CHECK_SIZE_SM, &rgb1, &rgb2);
}
} }
switch (outside_bg) switch (outside_bg)

View file

@ -133,8 +133,8 @@ static gboolean _export_thumbnail = TRUE;
static gint32 _num_processors = 1; static gint32 _num_processors = 1;
static GimpCheckSize _check_size = GIMP_CHECK_SIZE_MEDIUM_CHECKS; static GimpCheckSize _check_size = GIMP_CHECK_SIZE_MEDIUM_CHECKS;
static GimpCheckType _check_type = GIMP_CHECK_TYPE_GRAY_CHECKS; static GimpCheckType _check_type = GIMP_CHECK_TYPE_GRAY_CHECKS;
static GimpRGB _check_custom_color1 = GIMP_CHECKS_CUSTOM_COLOR1; static GeglColor *_check_custom_color1 = NULL;
static GimpRGB _check_custom_color2 = GIMP_CHECKS_CUSTOM_COLOR2; static GeglColor *_check_custom_color2 = NULL;
static gint _default_display_id = -1; static gint _default_display_id = -1;
static gchar *_wm_class = NULL; static gchar *_wm_class = NULL;
static gchar *_display_name = NULL; static gchar *_display_name = NULL;
@ -533,6 +533,8 @@ gimp_main (GType plug_in_type,
gimp_close (); gimp_close ();
g_io_channel_unref (read_channel); g_io_channel_unref (read_channel);
g_io_channel_unref (write_channel); g_io_channel_unref (write_channel);
g_clear_object (&_check_custom_color1);
g_clear_object (&_check_custom_color2);
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }
@ -801,10 +803,10 @@ gimp_check_type (void)
* *
* Since: 3.0 * Since: 3.0
**/ **/
const GimpRGB * const GeglColor *
gimp_check_custom_color1 (void) gimp_check_custom_color1 (void)
{ {
return &_check_custom_color1; return (const GeglColor *) _check_custom_color1;
} }
/** /**
@ -819,10 +821,10 @@ gimp_check_custom_color1 (void)
* *
* Since: 3.0 * Since: 3.0
**/ **/
const GimpRGB * const GeglColor *
gimp_check_custom_color2 (void) gimp_check_custom_color2 (void)
{ {
return &_check_custom_color2; return (const GeglColor *) _check_custom_color2;
} }
/** /**
@ -1062,13 +1064,18 @@ _gimp_config (GPConfig *config)
{ {
GFile *file; GFile *file;
gchar *path; gchar *path;
gsize bpp;
const guint8 *pixel;
const guint8 *icc;
gsize icc_length;
const Babl *format = NULL;
const Babl *space = NULL;
_tile_width = config->tile_width; _tile_width = config->tile_width;
_tile_height = config->tile_height; _tile_height = config->tile_height;
_check_size = config->check_size; _check_size = config->check_size;
_check_type = config->check_type; _check_type = config->check_type;
_check_custom_color1 = config->check_custom_color1;
_check_custom_color2 = config->check_custom_color2;
_show_help_button = config->show_help_button ? TRUE : FALSE; _show_help_button = config->show_help_button ? TRUE : FALSE;
_export_color_profile = config->export_color_profile ? TRUE : FALSE; _export_color_profile = config->export_color_profile ? TRUE : FALSE;
_export_exif = config->export_exif ? TRUE : FALSE; _export_exif = config->export_exif ? TRUE : FALSE;
@ -1100,6 +1107,49 @@ _gimp_config (GPConfig *config)
"application-license", "GPL3", "application-license", "GPL3",
NULL); NULL);
/* XXX Running gegl_init() before gegl_config() is not appreciated by
* GEGL and generates a bunch of CRITICALs.
*/
babl_init ();
g_clear_object (&_check_custom_color1);
_check_custom_color1 = gegl_color_new (NULL);
pixel = g_bytes_get_data (config->check_custom_color1, &bpp);
icc = g_bytes_get_data (config->check_custom_icc1, &icc_length);
space = babl_space_from_icc ((const char *) icc, (int) icc_length,
BABL_ICC_INTENT_RELATIVE_COLORIMETRIC,
NULL);
format = babl_format_with_space (config->check_custom_encoding1, space);
if (bpp != babl_format_get_bytes_per_pixel (format))
{
g_warning ("%s: checker board color 1's format expects %d bpp but %ld bytes were passed.",
G_STRFUNC, babl_format_get_bytes_per_pixel (format), bpp);
gegl_color_set_pixel (_check_custom_color1, babl_format ("R'G'B'A double"), &GIMP_CHECKS_CUSTOM_COLOR1);
}
else
{
gegl_color_set_pixel (_check_custom_color1, format, pixel);
}
g_clear_object (&_check_custom_color2);
_check_custom_color2 = gegl_color_new (NULL);
pixel = g_bytes_get_data (config->check_custom_color2, &bpp);
icc = g_bytes_get_data (config->check_custom_icc2, &icc_length);
space = babl_space_from_icc ((const char *) icc, (int) icc_length,
BABL_ICC_INTENT_RELATIVE_COLORIMETRIC,
NULL);
format = babl_format_with_space (config->check_custom_encoding2, space);
if (bpp != babl_format_get_bytes_per_pixel (format))
{
g_warning ("%s: checker board color 2's format expects %d bpp but %ld bytes were passed.",
G_STRFUNC, babl_format_get_bytes_per_pixel (format), bpp);
gegl_color_set_pixel (_check_custom_color2, babl_format ("R'G'B'A double"), &GIMP_CHECKS_CUSTOM_COLOR2);
}
else
{
gegl_color_set_pixel (_check_custom_color2, format, pixel);
}
g_free (path); g_free (path);
g_object_unref (file); g_object_unref (file);

View file

@ -184,8 +184,8 @@ gboolean gimp_export_thumbnail (void) G_GNUC_CONST;
gint gimp_get_num_processors (void) G_GNUC_CONST; gint gimp_get_num_processors (void) G_GNUC_CONST;
GimpCheckSize gimp_check_size (void) G_GNUC_CONST; GimpCheckSize gimp_check_size (void) G_GNUC_CONST;
GimpCheckType gimp_check_type (void) G_GNUC_CONST; GimpCheckType gimp_check_type (void) G_GNUC_CONST;
const GimpRGB * gimp_check_custom_color1 (void) G_GNUC_CONST; const GeglColor * gimp_check_custom_color1 (void) G_GNUC_CONST;
const GimpRGB * gimp_check_custom_color2 (void) G_GNUC_CONST; const GeglColor * gimp_check_custom_color2 (void) G_GNUC_CONST;
GimpDisplay * gimp_default_display (void) G_GNUC_CONST; GimpDisplay * gimp_default_display (void) G_GNUC_CONST;
const gchar * gimp_wm_class (void) G_GNUC_CONST; const gchar * gimp_wm_class (void) G_GNUC_CONST;
const gchar * gimp_display_name (void) G_GNUC_CONST; const gchar * gimp_display_name (void) G_GNUC_CONST;

View file

@ -743,12 +743,7 @@ gimp_procedure_dialog_get_widget (GimpProcedureDialog *dialog,
} }
else if (G_PARAM_SPEC_TYPE (pspec) == GIMP_TYPE_PARAM_RGB) else if (G_PARAM_SPEC_TYPE (pspec) == GIMP_TYPE_PARAM_RGB)
{ {
if (widget_type == G_TYPE_NONE || widget_type == GIMP_TYPE_LABEL_COLOR) if (widget_type == G_TYPE_NONE || widget_type == GIMP_TYPE_COLOR_BUTTON)
{
widget = gimp_prop_label_color_new (G_OBJECT (dialog->priv->config),
property, TRUE);
}
else if (widget_type == GIMP_TYPE_COLOR_BUTTON)
{ {
widget = gimp_prop_color_select_new (G_OBJECT (dialog->priv->config), widget = gimp_prop_color_select_new (G_OBJECT (dialog->priv->config),
property, 20, 20, property, 20, 20,
@ -759,7 +754,12 @@ gimp_procedure_dialog_get_widget (GimpProcedureDialog *dialog,
} }
else if (G_PARAM_SPEC_TYPE (pspec) == GEGL_TYPE_PARAM_COLOR) else if (G_PARAM_SPEC_TYPE (pspec) == GEGL_TYPE_PARAM_COLOR)
{ {
if (widget_type == G_TYPE_NONE || widget_type == GIMP_TYPE_COLOR_AREA) if (widget_type == G_TYPE_NONE || widget_type == GIMP_TYPE_LABEL_COLOR)
{
widget = gimp_prop_label_color_new (G_OBJECT (dialog->priv->config),
property, TRUE);
}
else if (widget_type == GIMP_TYPE_COLOR_AREA)
{ {
widget = gimp_prop_color_area_new (G_OBJECT (dialog->priv->config), widget = gimp_prop_color_area_new (G_OBJECT (dialog->priv->config),
property, 20, 20, property, 20, 20,

View file

@ -21,6 +21,8 @@
#define __GIMP_BASE_H_INSIDE__ #define __GIMP_BASE_H_INSIDE__
#include <gegl.h>
#include <libgimpbase/gimpbasetypes.h> #include <libgimpbase/gimpbasetypes.h>
#include <libgimpbase/gimpchecks.h> #include <libgimpbase/gimpchecks.h>

View file

@ -21,6 +21,7 @@
#include "config.h" #include "config.h"
#include <gegl.h>
#include <glib-object.h> #include <glib-object.h>
#include "gimpbasetypes.h" #include "gimpbasetypes.h"
@ -61,63 +62,65 @@
**/ **/
void void
gimp_checks_get_colors (GimpCheckType type, gimp_checks_get_colors (GimpCheckType type,
GimpRGB *color1, GeglColor **color1,
GimpRGB *color2) GeglColor **color2)
{ {
g_return_if_fail (color1 != NULL || color2 != NULL); g_return_if_fail ((color1 != NULL && GEGL_IS_COLOR (*color1)) || (color2 != NULL && GEGL_IS_COLOR (*color2)));
if (color1) if (color1)
{ {
*color1 = gegl_color_duplicate (*color1);
switch (type) switch (type)
{ {
case GIMP_CHECK_TYPE_LIGHT_CHECKS: case GIMP_CHECK_TYPE_LIGHT_CHECKS:
*color1 = GIMP_CHECKS_LIGHT_COLOR_LIGHT; gegl_color_set_pixel (*color1, babl_format ("R'G'B'A double"), &GIMP_CHECKS_LIGHT_COLOR_LIGHT);
break; break;
case GIMP_CHECK_TYPE_DARK_CHECKS: case GIMP_CHECK_TYPE_DARK_CHECKS:
*color1 = GIMP_CHECKS_DARK_COLOR_LIGHT; gegl_color_set_pixel (*color1, babl_format ("R'G'B'A double"), &GIMP_CHECKS_DARK_COLOR_LIGHT);
break; break;
case GIMP_CHECK_TYPE_WHITE_ONLY: case GIMP_CHECK_TYPE_WHITE_ONLY:
*color1 = GIMP_CHECKS_WHITE_COLOR; gegl_color_set_pixel (*color1, babl_format ("R'G'B'A double"), &GIMP_CHECKS_WHITE_COLOR);
break; break;
case GIMP_CHECK_TYPE_GRAY_ONLY: case GIMP_CHECK_TYPE_GRAY_ONLY:
*color1 = GIMP_CHECKS_GRAY_COLOR; gegl_color_set_pixel (*color1, babl_format ("R'G'B'A double"), &GIMP_CHECKS_GRAY_COLOR);
break; break;
case GIMP_CHECK_TYPE_BLACK_ONLY: case GIMP_CHECK_TYPE_BLACK_ONLY:
*color1 = GIMP_CHECKS_BLACK_COLOR; gegl_color_set_pixel (*color1, babl_format ("R'G'B'A double"), &GIMP_CHECKS_BLACK_COLOR);
break; break;
case GIMP_CHECK_TYPE_CUSTOM_CHECKS: case GIMP_CHECK_TYPE_CUSTOM_CHECKS:
/* Keep the current value. */ /* Keep the current value. */
break; break;
default: default:
*color1 = GIMP_CHECKS_GRAY_COLOR_LIGHT; gegl_color_set_pixel (*color1, babl_format ("R'G'B'A double"), &GIMP_CHECKS_GRAY_COLOR_LIGHT);
break; break;
} }
} }
if (color2) if (color2)
{ {
*color2 = gegl_color_duplicate (*color2);
switch (type) switch (type)
{ {
case GIMP_CHECK_TYPE_LIGHT_CHECKS: case GIMP_CHECK_TYPE_LIGHT_CHECKS:
*color2 = GIMP_CHECKS_LIGHT_COLOR_DARK; gegl_color_set_pixel (*color2, babl_format ("R'G'B'A double"), &GIMP_CHECKS_LIGHT_COLOR_DARK);
break; break;
case GIMP_CHECK_TYPE_DARK_CHECKS: case GIMP_CHECK_TYPE_DARK_CHECKS:
*color2 = GIMP_CHECKS_DARK_COLOR_DARK; gegl_color_set_pixel (*color2, babl_format ("R'G'B'A double"), &GIMP_CHECKS_DARK_COLOR_DARK);
break; break;
case GIMP_CHECK_TYPE_WHITE_ONLY: case GIMP_CHECK_TYPE_WHITE_ONLY:
*color2 = GIMP_CHECKS_WHITE_COLOR; gegl_color_set_pixel (*color2, babl_format ("R'G'B'A double"), &GIMP_CHECKS_WHITE_COLOR);
break; break;
case GIMP_CHECK_TYPE_GRAY_ONLY: case GIMP_CHECK_TYPE_GRAY_ONLY:
*color2 = GIMP_CHECKS_GRAY_COLOR; gegl_color_set_pixel (*color2, babl_format ("R'G'B'A double"), &GIMP_CHECKS_GRAY_COLOR);
break; break;
case GIMP_CHECK_TYPE_BLACK_ONLY: case GIMP_CHECK_TYPE_BLACK_ONLY:
*color2 = GIMP_CHECKS_BLACK_COLOR; gegl_color_set_pixel (*color2, babl_format ("R'G'B'A double"), &GIMP_CHECKS_BLACK_COLOR);
break; break;
case GIMP_CHECK_TYPE_CUSTOM_CHECKS: case GIMP_CHECK_TYPE_CUSTOM_CHECKS:
/* Keep the current value. */ /* Keep the current value. */
break; break;
default: default:
*color2 = GIMP_CHECKS_GRAY_COLOR_DARK; gegl_color_set_pixel (*color2, babl_format ("R'G'B'A double"), &GIMP_CHECKS_GRAY_COLOR_DARK);
break; break;
} }
} }

View file

@ -136,8 +136,8 @@ G_BEGIN_DECLS
void gimp_checks_get_colors (GimpCheckType type, void gimp_checks_get_colors (GimpCheckType type,
GimpRGB *color1, GeglColor **color1,
GimpRGB *color2); GeglColor **color2);
G_END_DECLS G_END_DECLS

View file

@ -494,10 +494,16 @@ _gp_config_read (GIOChannel *channel,
if (! _gimp_wire_read_int8 (channel, if (! _gimp_wire_read_int8 (channel,
(guint8 *) &config->check_type, 1, user_data)) (guint8 *) &config->check_type, 1, user_data))
goto cleanup; goto cleanup;
if (! _gimp_wire_read_color (channel, &config->check_custom_color1, if (! _gimp_wire_read_gegl_color (channel,
&config->check_custom_color1,
&config->check_custom_icc1,
&config->check_custom_encoding1,
1, user_data)) 1, user_data))
goto cleanup; goto cleanup;
if (! _gimp_wire_read_color (channel, &config->check_custom_color2, if (! _gimp_wire_read_gegl_color (channel,
&config->check_custom_color2,
&config->check_custom_icc2,
&config->check_custom_encoding2,
1, user_data)) 1, user_data))
goto cleanup; goto cleanup;
if (! _gimp_wire_read_int8 (channel, if (! _gimp_wire_read_int8 (channel,
@ -574,6 +580,13 @@ _gp_config_read (GIOChannel *channel,
return; return;
cleanup: cleanup:
g_bytes_unref (config->check_custom_color1);
g_bytes_unref (config->check_custom_icc1);
g_free (config->check_custom_encoding1);
g_bytes_unref (config->check_custom_color2);
g_bytes_unref (config->check_custom_icc2);
g_free (config->check_custom_encoding2);
g_free (config->app_name); g_free (config->app_name);
g_free (config->wm_class); g_free (config->wm_class);
g_free (config->display_name); g_free (config->display_name);
@ -608,10 +621,16 @@ _gp_config_write (GIOChannel *channel,
(const guint8 *) &config->check_type, 1, (const guint8 *) &config->check_type, 1,
user_data)) user_data))
return; return;
if (! _gimp_wire_write_color (channel, &config->check_custom_color1, if (! _gimp_wire_write_gegl_color (channel,
&config->check_custom_color1,
&config->check_custom_icc1,
&config->check_custom_encoding1,
1, user_data)) 1, user_data))
return; return;
if (! _gimp_wire_write_color (channel, &config->check_custom_color2, if (! _gimp_wire_write_gegl_color (channel,
&config->check_custom_color2,
&config->check_custom_icc2,
&config->check_custom_encoding2,
1, user_data)) 1, user_data))
return; return;
if (! _gimp_wire_write_int8 (channel, if (! _gimp_wire_write_int8 (channel,
@ -692,6 +711,13 @@ _gp_config_destroy (GimpWireMessage *msg)
if (config) if (config)
{ {
g_bytes_unref (config->check_custom_color1);
g_bytes_unref (config->check_custom_icc1);
g_free (config->check_custom_encoding1);
g_bytes_unref (config->check_custom_color2);
g_bytes_unref (config->check_custom_icc2);
g_free (config->check_custom_encoding2);
g_free (config->app_name); g_free (config->app_name);
g_free (config->wm_class); g_free (config->wm_class);
g_free (config->display_name); g_free (config->display_name);

View file

@ -131,9 +131,18 @@ struct _GPConfig
gchar *swap_compression; gchar *swap_compression;
gint32 num_processors; gint32 num_processors;
/* since protocol version 0x010F: */ /* Since protocol version 0x0111:
GimpRGB check_custom_color1; * These values are used to represent 2 GeglColor objects but we avoid
GimpRGB check_custom_color2; * initializing GEGL in the wire protocol. This leads to extremely
* slow startup when initializing every plug-in. So we store them as
* bytes and encoding string and reconstruct the GeglColor in libgimp.
*/
GBytes *check_custom_color1;
GBytes *check_custom_icc1;
gchar *check_custom_encoding1;
GBytes *check_custom_color2;
GBytes *check_custom_icc2;
gchar *check_custom_encoding2;
}; };
struct _GPTileReq struct _GPTileReq

View file

@ -492,6 +492,62 @@ _gimp_wire_read_color (GIOChannel *channel,
(gdouble *) data, 4 * count, user_data); (gdouble *) data, 4 * count, user_data);
} }
gboolean
_gimp_wire_read_gegl_color (GIOChannel *channel,
GBytes **pixel_data,
GBytes **icc_data,
gchar **encoding,
gint count,
gpointer user_data)
{
gint i;
g_return_val_if_fail (count >= 0, FALSE);
for (i = 0; i < count; i++)
{
guint32 size;
guint8 pixel[40];
guint32 icc_length;
if (! _gimp_wire_read_int32 (channel,
&size, 1,
user_data) ||
size == 0 ||
size > 40 ||
! _gimp_wire_read_int8 (channel, pixel, size, user_data) ||
! _gimp_wire_read_string (channel, &(encoding[i]), 1, user_data) ||
! _gimp_wire_read_int32 (channel, &icc_length, 1, user_data))
{
g_clear_pointer (&(encoding[i]), g_free);
return FALSE;
}
/* Read space (profile data). */
icc_data[i] = NULL;
if (icc_length > 0)
{
guint8 *icc;
icc = g_new0 (guint8, icc_length);
if (! _gimp_wire_read_int8 (channel, icc, icc_length, user_data))
{
g_clear_pointer (&(encoding[i]), g_free);
g_clear_pointer (&icc, g_free);
return FALSE;
}
icc_data[i] = g_bytes_new_take (icc, size);
}
pixel_data[i] = g_bytes_new (pixel, size);
}
return TRUE;
}
gboolean gboolean
_gimp_wire_write_int64 (GIOChannel *channel, _gimp_wire_write_int64 (GIOChannel *channel,
const guint64 *data, const guint64 *data,
@ -673,6 +729,39 @@ _gimp_wire_write_color (GIOChannel *channel,
(gdouble *) data, 4 * count, user_data); (gdouble *) data, 4 * count, user_data);
} }
gboolean
_gimp_wire_write_gegl_color (GIOChannel *channel,
GBytes **pixel_data,
GBytes **icc_data,
gchar **encoding,
gint count,
gpointer user_data)
{
gint i;
g_return_val_if_fail (count >= 0, FALSE);
for (i = 0; i < count; i++)
{
const guint8 *pixel;
gsize bpp;
const guint8 *icc;
gsize icc_length;
pixel = g_bytes_get_data (pixel_data[i], &bpp);
icc = g_bytes_get_data (pixel_data[i], &icc_length);
if (! _gimp_wire_write_int32 (channel, (const guint32 *) &bpp, 1, user_data) ||
! _gimp_wire_write_int8 (channel, pixel, bpp, user_data) ||
! _gimp_wire_write_string (channel, &(encoding[i]), 1, user_data) ||
! _gimp_wire_write_int32 (channel, (const guint32 *) &icc_length, 1, user_data) ||
! _gimp_wire_write_int8 (channel, icc, icc_length, user_data))
return FALSE;
}
return TRUE;
}
static guint static guint
gimp_wire_hash (const guint32 *key) gimp_wire_hash (const guint32 *key)
{ {

View file

@ -111,6 +111,13 @@ G_GNUC_INTERNAL gboolean _gimp_wire_read_color (GIOChannel *channel,
GimpRGB *data, GimpRGB *data,
gint count, gint count,
gpointer user_data); gpointer user_data);
G_GNUC_INTERNAL gboolean
_gimp_wire_read_gegl_color (GIOChannel *channel,
GBytes **pixel_data,
GBytes **icc_data,
gchar **encoding,
gint count,
gpointer user_data);
G_GNUC_INTERNAL gboolean _gimp_wire_write_int64 (GIOChannel *channel, G_GNUC_INTERNAL gboolean _gimp_wire_write_int64 (GIOChannel *channel,
const guint64 *data, const guint64 *data,
gint count, gint count,
@ -139,6 +146,13 @@ G_GNUC_INTERNAL gboolean _gimp_wire_write_color (GIOChannel *channel,
const GimpRGB *data, const GimpRGB *data,
gint count, gint count,
gpointer user_data); gpointer user_data);
G_GNUC_INTERNAL gboolean
_gimp_wire_write_gegl_color (GIOChannel *channel,
GBytes **pixel_data,
GBytes **icc_data,
gchar **encoding,
gint count,
gpointer user_data);
G_END_DECLS G_END_DECLS

View file

@ -116,7 +116,7 @@ libgimpbase = library('gimpbase-' + gimp_api_version,
libgimpbase_sources, libgimpbase_sources,
include_directories: rootInclude, include_directories: rootInclude,
dependencies: [ dependencies: [
gexiv2, gio, math, gegl, gexiv2, gio, math,
# optionally depend on libexecinfo on platforms where it is not # optionally depend on libexecinfo on platforms where it is not
# internal to the libc. # internal to the libc.
opt_execinfo, opt_execinfo,

View file

@ -19,7 +19,7 @@ libgimpmodule = library('gimpmodule-' + gimp_api_version,
libgimpmodule_sources, libgimpmodule_sources,
include_directories: rootInclude, include_directories: rootInclude,
dependencies: [ dependencies: [
gio, glib, gmodule, gegl, gio, glib, gmodule,
], ],
c_args: [ '-DG_LOG_DOMAIN="LibGimpModule"', '-DGIMP_MODULE_COMPILATION', ], c_args: [ '-DG_LOG_DOMAIN="LibGimpModule"', '-DGIMP_MODULE_COMPILATION', ],
link_with: [ link_with: [

View file

@ -65,7 +65,7 @@ libgimpthumb = library('gimpthumb-'+ gimp_api_version,
libgimpthumb_sources, libgimpthumb_sources,
include_directories: rootInclude, include_directories: rootInclude,
dependencies: [ dependencies: [
glib, gobject, gdk_pixbuf, gio, gegl, glib, gobject, gdk_pixbuf, gio,
], ],
c_args: [ '-DG_LOG_DOMAIN="LibGimpThumb"', '-DGIMP_THUMB_COMPILATION', ], c_args: [ '-DG_LOG_DOMAIN="LibGimpThumb"', '-DGIMP_THUMB_COMPILATION', ],
link_with: [ link_with: [

View file

@ -78,6 +78,16 @@ static GtkWidget * gimp_label_color_populate (GimpLabeled *color,
gint *width, gint *width,
gint *height); gint *height);
static gboolean gimp_label_color_from_color_area (GBinding *binding,
const GValue *from_value,
GValue* to_value,
gpointer user_data);
static gboolean gimp_label_color_to_color_area (GBinding *binding,
const GValue *from_value,
GValue* to_value,
gpointer user_data);
G_DEFINE_TYPE_WITH_PRIVATE (GimpLabelColor, gimp_label_color, GIMP_TYPE_LABELED) G_DEFINE_TYPE_WITH_PRIVATE (GimpLabelColor, gimp_label_color, GIMP_TYPE_LABELED)
#define parent_class gimp_label_color_parent_class #define parent_class gimp_label_color_parent_class
@ -89,7 +99,6 @@ gimp_label_color_class_init (GimpLabelColorClass *klass)
{ {
GObjectClass *object_class = G_OBJECT_CLASS (klass); GObjectClass *object_class = G_OBJECT_CLASS (klass);
GimpLabeledClass *labeled_class = GIMP_LABELED_CLASS (klass); GimpLabeledClass *labeled_class = GIMP_LABELED_CLASS (klass);
GimpRGB black;
gimp_label_color_signals[VALUE_CHANGED] = gimp_label_color_signals[VALUE_CHANGED] =
g_signal_new ("value-changed", g_signal_new ("value-changed",
@ -105,6 +114,7 @@ gimp_label_color_class_init (GimpLabelColorClass *klass)
labeled_class->populate = gimp_label_color_populate; labeled_class->populate = gimp_label_color_populate;
babl_init ();
/** /**
* GimpLabelColor:value: * GimpLabelColor:value:
* *
@ -112,11 +122,10 @@ gimp_label_color_class_init (GimpLabelColorClass *klass)
* *
* Since: 3.0 * Since: 3.0
**/ **/
gimp_rgba_set (&black, 0.0, 0.0, 0.0, 1.0); object_props[PROP_VALUE] = gegl_param_spec_color_from_string ("value",
object_props[PROP_VALUE] = gimp_param_spec_rgb ("value",
"Color", "Color",
"The displayed color", "The displayed color",
TRUE, &black, "black",
GIMP_PARAM_READWRITE | GIMP_PARAM_READWRITE |
G_PARAM_CONSTRUCT); G_PARAM_CONSTRUCT);
@ -165,9 +174,12 @@ gimp_label_color_constructed (GObject *object)
* will allow config object to bind the "value" property of this * will allow config object to bind the "value" property of this
* widget, and therefore be updated automatically. * widget, and therefore be updated automatically.
*/ */
g_object_bind_property (G_OBJECT (priv->area), "color", g_object_bind_property_full (G_OBJECT (priv->area), "color",
G_OBJECT (color), "value", G_OBJECT (color), "value",
G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE); G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE,
gimp_label_color_from_color_area,
gimp_label_color_to_color_area,
NULL, NULL);
} }
static void static void
@ -183,24 +195,28 @@ gimp_label_color_set_property (GObject *object,
{ {
case PROP_VALUE: case PROP_VALUE:
{ {
GimpRGB *new_color; GeglColor *new_color;
GimpRGB *color; GeglColor *color;
GimpRGB *rgb;
new_color = g_value_get_boxed (value); new_color = g_value_get_object (value);
g_object_get (priv->area, g_object_get (priv->area,
"color", &color, "color", &rgb,
NULL); NULL);
color = gegl_color_new (NULL);
gegl_color_set_pixel (color, babl_format ("R'G'B'A double"), rgb);
/* Avoid looping forever since we have bound this widget's /* Avoid looping forever since we have bound this widget's
* "value" property with the color button "value" property. * "value" property with the color button "value" property.
*/ */
if (gimp_rgba_distance (color, new_color) >= GIMP_RGBA_EPSILON) if (! gimp_color_is_perceptually_identical (color, new_color))
{ {
g_object_set (priv->area, "color", new_color, NULL); gegl_color_get_pixel (new_color, babl_format ("R'G'B'A double"), rgb);
g_object_set (priv->area, "color", rgb, NULL);
g_signal_emit (object, gimp_label_color_signals[VALUE_CHANGED], 0); g_signal_emit (object, gimp_label_color_signals[VALUE_CHANGED], 0);
} }
g_boxed_free (GIMP_TYPE_RGB, color); g_object_unref (color);
} }
break; break;
case PROP_EDITABLE: case PROP_EDITABLE:
@ -208,7 +224,7 @@ gimp_label_color_set_property (GObject *object,
{ {
const gchar *dialog_title; const gchar *dialog_title;
GimpLabeled *labeled; GimpLabeled *labeled;
GimpRGB *color; GimpRGB *rgb;
GimpColorAreaType type; GimpColorAreaType type;
gboolean attached; gboolean attached;
@ -222,7 +238,7 @@ gimp_label_color_set_property (GObject *object,
attached = (gtk_widget_get_parent (priv->area) != NULL); attached = (gtk_widget_get_parent (priv->area) != NULL);
g_object_get (priv->area, g_object_get (priv->area,
"type", &type, "type", &type,
"color", &color, "color", &rgb,
NULL); NULL);
gtk_widget_destroy (priv->area); gtk_widget_destroy (priv->area);
@ -230,17 +246,18 @@ gimp_label_color_set_property (GObject *object,
priv->editable = g_value_get_boolean (value); priv->editable = g_value_get_boolean (value);
if (priv->editable) if (priv->editable)
priv->area = gimp_color_button_new (dialog_title, priv->area = gimp_color_button_new (dialog_title,
20, 20, color, type); 20, 20, rgb, type);
else else
priv->area = gimp_color_area_new (color, type, priv->area = gimp_color_area_new (rgb, type,
GDK_BUTTON1_MASK | GDK_BUTTON2_MASK); GDK_BUTTON1_MASK | GDK_BUTTON2_MASK);
g_boxed_free (GIMP_TYPE_RGB, color);
gtk_widget_set_size_request (priv->area, 20, 20); gtk_widget_set_size_request (priv->area, 20, 20);
g_object_bind_property (G_OBJECT (priv->area), "color", g_object_bind_property_full (G_OBJECT (priv->area), "color",
G_OBJECT (lcolor), "value", G_OBJECT (lcolor), "value",
G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE); G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE,
gimp_label_color_from_color_area,
gimp_label_color_to_color_area,
NULL, NULL);
if (attached) if (attached)
{ {
@ -269,7 +286,16 @@ gimp_label_color_get_property (GObject *object,
switch (property_id) switch (property_id)
{ {
case PROP_VALUE: case PROP_VALUE:
g_object_get_property (G_OBJECT (priv->area), "color", value); {
GimpRGB *rgb;
GeglColor *color = gegl_color_new (NULL);
g_object_get (priv->area,
"color", &rgb,
NULL);
gegl_color_set_pixel (color, babl_format ("R'G'B'A double"), rgb);
g_value_take_object (value, color);
}
break; break;
case PROP_EDITABLE: case PROP_EDITABLE:
g_value_set_boolean (value, priv->editable); g_value_set_boolean (value, priv->editable);
@ -301,6 +327,37 @@ gimp_label_color_populate (GimpLabeled *labeled,
return priv->area; return priv->area;
} }
static gboolean
gimp_label_color_from_color_area (GBinding *binding,
const GValue *from_value,
GValue* to_value,
gpointer user_data)
{
GimpRGB *rgb = g_value_get_boxed (from_value);
GeglColor *color = gegl_color_new (NULL);
gegl_color_set_pixel (color, babl_format ("R'G'B'A double"), rgb);
g_value_take_object (to_value, color);
return TRUE;
}
static gboolean
gimp_label_color_to_color_area (GBinding *binding,
const GValue *from_value,
GValue* to_value,
gpointer user_data)
{
GeglColor *color = g_value_get_object (from_value);
GimpRGB rgb;
gegl_color_get_pixel (color, babl_format ("R'G'B'A double"), &rgb);
g_value_set_boxed (to_value, &rgb);
return TRUE;
}
/* Public Functions */ /* Public Functions */
@ -327,7 +384,7 @@ gimp_label_color_populate (GimpLabeled *labeled,
**/ **/
GtkWidget * GtkWidget *
gimp_label_color_new (const gchar *label, gimp_label_color_new (const gchar *label,
const GimpRGB *color, GeglColor *color,
gboolean editable) gboolean editable)
{ {
GtkWidget *labeled; GtkWidget *labeled;
@ -350,9 +407,10 @@ gimp_label_color_new (const gchar *label,
**/ **/
void void
gimp_label_color_set_value (GimpLabelColor *color, gimp_label_color_set_value (GimpLabelColor *color,
const GimpRGB *value) GeglColor *value)
{ {
g_return_if_fail (GIMP_IS_LABEL_COLOR (color)); g_return_if_fail (GIMP_IS_LABEL_COLOR (color));
g_return_if_fail (GEGL_IS_COLOR (value));
g_object_set (color, g_object_set (color,
"value", value, "value", value,
@ -362,21 +420,27 @@ gimp_label_color_set_value (GimpLabelColor *color,
/** /**
* gimp_label_color_get_value: * gimp_label_color_get_value:
* @color: The #GtkLabelColor. * @color: The #GtkLabelColor.
* @value: (out callee-allocates): The color to assign to the color area.
* *
* This function returns the value shown by @color. * This function returns the value shown by @color.
*
* Returns: (transfer full): a copy of the [class@Gegl.Color] used by the widget.
**/ **/
void GeglColor *
gimp_label_color_get_value (GimpLabelColor *color, gimp_label_color_get_value (GimpLabelColor *color)
GimpRGB *value)
{ {
GimpLabelColorPrivate *priv = gimp_label_color_get_instance_private (color); GimpLabelColorPrivate *priv = gimp_label_color_get_instance_private (color);
GeglColor *value = NULL;
GeglColor *retval;
g_return_if_fail (GIMP_IS_LABEL_COLOR (color)); g_return_val_if_fail (GIMP_IS_LABEL_COLOR (color), NULL);
g_object_get (priv->area, g_object_get (priv->area,
"color", &value, "color", &value,
NULL); NULL);
retval = gegl_color_duplicate (value);
g_clear_object (&value);
return retval;
} }
/** /**

View file

@ -52,7 +52,7 @@ struct _GimpLabelColorClass
}; };
GtkWidget * gimp_label_color_new (const gchar *label, GtkWidget * gimp_label_color_new (const gchar *label,
const GimpRGB *color, GeglColor *color,
gboolean editable); gboolean editable);
/* TODO: it would be interesting for such a widget to have an API to /* TODO: it would be interesting for such a widget to have an API to
@ -61,9 +61,8 @@ GtkWidget * gimp_label_color_new (const gchar *label,
*/ */
void gimp_label_color_set_value (GimpLabelColor *color, void gimp_label_color_set_value (GimpLabelColor *color,
const GimpRGB *value); GeglColor *value);
void gimp_label_color_get_value (GimpLabelColor *color, GeglColor * gimp_label_color_get_value (GimpLabelColor *color);
GimpRGB *value);
void gimp_label_color_set_editable (GimpLabelColor *color, void gimp_label_color_set_editable (GimpLabelColor *color,
gboolean editable); gboolean editable);

View file

@ -60,23 +60,23 @@ enum
#define CHECK_R(priv, row, col) \ #define CHECK_R(priv, row, col) \
(((((priv)->offset_y + (row)) & size) ^ \ (((((priv)->offset_y + (row)) & size) ^ \
(((priv)->offset_x + (col)) & size)) ? r1 : r2) (((priv)->offset_x + (col)) & size)) ? rgb1[0] : rgb2[0])
#define CHECK_G(priv, row, col) \ #define CHECK_G(priv, row, col) \
(((((priv)->offset_y + (row)) & size) ^ \ (((((priv)->offset_y + (row)) & size) ^ \
(((priv)->offset_x + (col)) & size)) ? g1 : g2) (((priv)->offset_x + (col)) & size)) ? rgb1[1] : rgb2[1])
#define CHECK_B(priv, row, col) \ #define CHECK_B(priv, row, col) \
(((((priv)->offset_y + (row)) & size) ^ \ (((((priv)->offset_y + (row)) & size) ^ \
(((priv)->offset_x + (col)) & size)) ? b1 : b2) (((priv)->offset_x + (col)) & size)) ? rgb1[2] : rgb2[2])
struct _GimpPreviewAreaPrivate struct _GimpPreviewAreaPrivate
{ {
GimpCheckSize check_size; GimpCheckSize check_size;
GimpCheckType check_type; GimpCheckType check_type;
GimpRGB check_custom_color1; GeglColor *check_custom_color1;
GimpRGB check_custom_color2; GeglColor *check_custom_color2;
gint width; gint width;
gint height; gint height;
gint rowstride; gint rowstride;
@ -132,6 +132,15 @@ gimp_preview_area_class_init (GimpPreviewAreaClass *klass)
{ {
GObjectClass *object_class = G_OBJECT_CLASS (klass); GObjectClass *object_class = G_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
GeglColor *color1_default;
GeglColor *color2_default;
gegl_init (NULL, NULL);
color1_default = gegl_color_new (NULL);
gegl_color_set_pixel (color1_default, babl_format ("R'G'B'A double"), &GIMP_CHECKS_CUSTOM_COLOR1);
color2_default = gegl_color_new (NULL);
gegl_color_set_pixel (color2_default, babl_format ("R'G'B'A double"), &GIMP_CHECKS_CUSTOM_COLOR2);
object_class->dispose = gimp_preview_area_dispose; object_class->dispose = gimp_preview_area_dispose;
object_class->finalize = gimp_preview_area_finalize; object_class->finalize = gimp_preview_area_finalize;
@ -158,18 +167,21 @@ gimp_preview_area_class_init (GimpPreviewAreaClass *klass)
GIMP_PARAM_READWRITE)); GIMP_PARAM_READWRITE));
g_object_class_install_property (object_class, PROP_CHECK_CUSTOM_COLOR1, g_object_class_install_property (object_class, PROP_CHECK_CUSTOM_COLOR1,
g_param_spec_boxed ("check-custom-color1", gegl_param_spec_color ("check-custom-color1",
_("Custom Checks Color 1"), _("Custom Checks Color 1"),
"The first color of the checkerboard pattern indicating transparency", "The first color of the checkerboard pattern indicating transparency",
GIMP_TYPE_RGB, color1_default,
GIMP_PARAM_READWRITE)); GIMP_PARAM_READWRITE));
g_object_class_install_property (object_class, PROP_CHECK_CUSTOM_COLOR2, g_object_class_install_property (object_class, PROP_CHECK_CUSTOM_COLOR2,
g_param_spec_boxed ("check-custom-color2", gegl_param_spec_color ("check-custom-color2",
_("Custom Checks Color 2"), _("Custom Checks Color 2"),
"The second color of the checkerboard pattern indicating transparency", "The second color of the checkerboard pattern indicating transparency",
GIMP_TYPE_RGB, color2_default,
GIMP_PARAM_READWRITE)); GIMP_PARAM_READWRITE));
g_object_unref (color1_default);
g_object_unref (color2_default);
} }
static void static void
@ -183,8 +195,10 @@ gimp_preview_area_init (GimpPreviewArea *area)
priv->check_size = DEFAULT_CHECK_SIZE; priv->check_size = DEFAULT_CHECK_SIZE;
priv->check_type = DEFAULT_CHECK_TYPE; priv->check_type = DEFAULT_CHECK_TYPE;
priv->check_custom_color1 = GIMP_CHECKS_CUSTOM_COLOR1; priv->check_custom_color1 = gegl_color_new (NULL);
priv->check_custom_color2 = GIMP_CHECKS_CUSTOM_COLOR2; gegl_color_set_pixel (priv->check_custom_color1, babl_format ("R'G'B'A double"), &GIMP_CHECKS_CUSTOM_COLOR1);
priv->check_custom_color2 = gegl_color_new (NULL);
gegl_color_set_pixel (priv->check_custom_color2, babl_format ("R'G'B'A double"), &GIMP_CHECKS_CUSTOM_COLOR2);
priv->max_width = -1; priv->max_width = -1;
priv->max_height = -1; priv->max_height = -1;
@ -210,6 +224,8 @@ gimp_preview_area_finalize (GObject *object)
g_clear_pointer (&priv->buf, g_free); g_clear_pointer (&priv->buf, g_free);
g_clear_pointer (&priv->colormap, g_free); g_clear_pointer (&priv->colormap, g_free);
g_clear_object (&priv->check_custom_color1);
g_clear_object (&priv->check_custom_color2);
G_OBJECT_CLASS (parent_class)->finalize (object); G_OBJECT_CLASS (parent_class)->finalize (object);
} }
@ -231,10 +247,12 @@ gimp_preview_area_set_property (GObject *object,
priv->check_type = g_value_get_enum (value); priv->check_type = g_value_get_enum (value);
break; break;
case PROP_CHECK_CUSTOM_COLOR1: case PROP_CHECK_CUSTOM_COLOR1:
priv->check_custom_color1 = *(GimpRGB *) g_value_get_boxed (value); g_clear_object (&priv->check_custom_color1);
priv->check_custom_color1 = gegl_color_duplicate (g_value_get_object (value));
break; break;
case PROP_CHECK_CUSTOM_COLOR2: case PROP_CHECK_CUSTOM_COLOR2:
priv->check_custom_color2 = *(GimpRGB *) g_value_get_boxed (value); g_clear_object (&priv->check_custom_color2);
priv->check_custom_color2 = gegl_color_duplicate (g_value_get_object (value));
break; break;
default: default:
@ -260,10 +278,10 @@ gimp_preview_area_get_property (GObject *object,
g_value_set_enum (value, priv->check_type); g_value_set_enum (value, priv->check_type);
break; break;
case PROP_CHECK_CUSTOM_COLOR1: case PROP_CHECK_CUSTOM_COLOR1:
g_value_set_boxed (value, &priv->check_custom_color1); g_value_set_object (value, priv->check_custom_color1);
break; break;
case PROP_CHECK_CUSTOM_COLOR2: case PROP_CHECK_CUSTOM_COLOR2:
g_value_set_boxed (value, &priv->check_custom_color2); g_value_set_object (value, priv->check_custom_color2);
break; break;
default: default:
@ -517,14 +535,10 @@ gimp_preview_area_draw (GimpPreviewArea *area,
const guchar *src; const guchar *src;
guchar *dest; guchar *dest;
guint size; guint size;
GimpRGB color1; GeglColor *color1;
GimpRGB color2; GeglColor *color2;
guchar r1; guchar rgb1[3];
guchar g1; guchar rgb2[3];
guchar b1;
guchar r2;
guchar g2;
guchar b2;
gint row; gint row;
gint col; gint col;
@ -579,8 +593,10 @@ gimp_preview_area_draw (GimpPreviewArea *area,
color1 = priv->check_custom_color1; color1 = priv->check_custom_color1;
color2 = priv->check_custom_color2; color2 = priv->check_custom_color2;
gimp_checks_get_colors (priv->check_type, &color1, &color2); gimp_checks_get_colors (priv->check_type, &color1, &color2);
gimp_rgb_get_uchar (&color1, &r1, &g1, &b1); gegl_color_get_pixel (color1, babl_format ("R'G'B' u8"), rgb1);
gimp_rgb_get_uchar (&color2, &r2, &g2, &b2); gegl_color_get_pixel (color2, babl_format ("R'G'B' u8"), rgb2);
g_object_unref (color1);
g_object_unref (color2);
src = buf; src = buf;
dest = priv->buf + x * 3 + y * priv->rowstride; dest = priv->buf + x * 3 + y * priv->rowstride;
@ -804,14 +820,10 @@ gimp_preview_area_blend (GimpPreviewArea *area,
const guchar *src2; const guchar *src2;
guchar *dest; guchar *dest;
guint size; guint size;
GimpRGB color1; GeglColor *color1;
GimpRGB color2; GeglColor *color2;
guchar r1; guchar rgb1[3];
guchar g1; guchar rgb2[3];
guchar b1;
guchar r2;
guchar g2;
guchar b2;
gint row; gint row;
gint col; gint col;
gint i; gint i;
@ -887,8 +899,10 @@ gimp_preview_area_blend (GimpPreviewArea *area,
color1 = priv->check_custom_color1; color1 = priv->check_custom_color1;
color2 = priv->check_custom_color2; color2 = priv->check_custom_color2;
gimp_checks_get_colors (priv->check_type, &color1, &color2); gimp_checks_get_colors (priv->check_type, &color1, &color2);
gimp_rgb_get_uchar (&color1, &r1, &g1, &b1); gegl_color_get_pixel (color1, babl_format ("R'G'B' u8"), rgb1);
gimp_rgb_get_uchar (&color2, &r2, &g2, &b2); gegl_color_get_pixel (color2, babl_format ("R'G'B' u8"), rgb2);
g_object_unref (color1);
g_object_unref (color2);
src1 = buf1; src1 = buf1;
src2 = buf2; src2 = buf2;
@ -1215,14 +1229,10 @@ gimp_preview_area_mask (GimpPreviewArea *area,
const guchar *src_mask; const guchar *src_mask;
guchar *dest; guchar *dest;
guint size; guint size;
GimpRGB color1; GeglColor *color1;
GimpRGB color2; GeglColor *color2;
guchar r1; guchar rgb1[3];
guchar g1; guchar rgb2[3];
guchar b1;
guchar r2;
guchar g2;
guchar b2;
gint row; gint row;
gint col; gint col;
gint i; gint i;
@ -1286,8 +1296,10 @@ gimp_preview_area_mask (GimpPreviewArea *area,
color1 = priv->check_custom_color1; color1 = priv->check_custom_color1;
color2 = priv->check_custom_color2; color2 = priv->check_custom_color2;
gimp_checks_get_colors (priv->check_type, &color1, &color2); gimp_checks_get_colors (priv->check_type, &color1, &color2);
gimp_rgb_get_uchar (&color1, &r1, &g1, &b1); gegl_color_get_pixel (color1, babl_format ("R'G'B' u8"), rgb1);
gimp_rgb_get_uchar (&color2, &r2, &g2, &b2); gegl_color_get_pixel (color2, babl_format ("R'G'B' u8"), rgb2);
g_object_unref (color1);
g_object_unref (color2);
src1 = buf1; src1 = buf1;
src2 = buf2; src2 = buf2;

View file

@ -4255,10 +4255,10 @@ gimp_prop_label_color_new (GObject *config,
GParamSpec *param_spec; GParamSpec *param_spec;
GtkWidget *prop_widget; GtkWidget *prop_widget;
const gchar *label; const gchar *label;
GimpRGB *value; GeglColor *value;
param_spec = check_param_spec_w (config, property_name, param_spec = check_param_spec_w (config, property_name,
GIMP_TYPE_PARAM_RGB, G_STRFUNC); GEGL_TYPE_PARAM_COLOR, G_STRFUNC);
if (! param_spec) if (! param_spec)
return NULL; return NULL;
@ -4269,7 +4269,7 @@ gimp_prop_label_color_new (GObject *config,
label = g_param_spec_get_nick (param_spec); label = g_param_spec_get_nick (param_spec);
prop_widget = gimp_label_color_new (label, value, editable); prop_widget = gimp_label_color_new (label, value, editable);
g_free (value); g_clear_object (&value);
g_object_bind_property (config, property_name, g_object_bind_property (config, property_name,
prop_widget, "value", prop_widget, "value",

View file

@ -639,12 +639,16 @@ repaint_da (GtkWidget *darea,
gpointer data) gpointer data)
{ {
cairo_pattern_t *check; cairo_pattern_t *check;
GimpRGB light = *(gimp_check_custom_color1 ()); GeglColor *color1 = (GeglColor *) gimp_check_custom_color1 ();
GimpRGB dark = *(gimp_check_custom_color2 ()); GeglColor *color2 = (GeglColor *) gimp_check_custom_color2 ();
GimpRGB rgb1;
GimpRGB rgb2;
gimp_checks_get_colors (gimp_check_type (), &light, &dark); gimp_checks_get_colors (gimp_check_type (), &color1, &color2);
check = gimp_cairo_checkerboard_create (cr, 32, &light, &dark); gegl_color_get_pixel (color1, babl_format ("R'G'B'A double"), &rgb1);
gegl_color_get_pixel (color2, babl_format ("R'G'B'A double"), &rgb2);
check = gimp_cairo_checkerboard_create (cr, 32, &rgb1, &rgb2);
cairo_set_source (cr, check); cairo_set_source (cr, check);
cairo_paint (cr); cairo_paint (cr);
@ -653,6 +657,9 @@ repaint_da (GtkWidget *darea,
cairo_set_source_surface (cr, drawing_area_surface, 0, 0); cairo_set_source_surface (cr, drawing_area_surface, 0, 0);
cairo_paint (cr); cairo_paint (cr);
g_object_unref (color1);
g_object_unref (color2);
return FALSE; return FALSE;
} }

View file

@ -10,7 +10,7 @@ gimptool = executable('gimptool' + exec_ver,
'gimptool.c', 'gimptool.c',
include_directories: rootInclude, include_directories: rootInclude,
dependencies: [ dependencies: [
gtk3, gegl, gtk3,
], ],
link_with: [ link_with: [
libgimpbase, libgimpbase,
@ -25,7 +25,7 @@ gimp_test_clipboard = executable('gimp-test-clipboard' + exec_ver,
'gimp-test-clipboard.c', 'gimp-test-clipboard.c',
include_directories: rootInclude, include_directories: rootInclude,
dependencies: [ dependencies: [
gtk3, gegl, gtk3,
], ],
install: true, install: true,
) )