diff --git a/app/core/gimpbrush.c b/app/core/gimpbrush.c index 1d04c88be6..fc72fc3ba8 100644 --- a/app/core/gimpbrush.c +++ b/app/core/gimpbrush.c @@ -26,8 +26,6 @@ #include "core-types.h" -#include "config/gimpguiconfig.h" - #include "gimp.h" #include "gimpbezierdesc.h" #include "gimpbrush.h" @@ -81,7 +79,8 @@ static gboolean gimp_brush_get_size (GimpViewable *vie static GimpTempBuf * gimp_brush_get_new_preview (GimpViewable *viewable, GimpContext *context, gint width, - gint height); + gint height, + GeglColor *color); static gchar * gimp_brush_get_description (GimpViewable *viewable, gchar **tooltip); @@ -274,7 +273,8 @@ static GimpTempBuf * gimp_brush_get_new_preview (GimpViewable *viewable, GimpContext *context, gint width, - gint height) + gint height, + GeglColor *color) { GimpBrush *brush = GIMP_BRUSH (viewable); const GimpTempBuf *mask_buf = brush->priv->mask; @@ -370,13 +370,10 @@ gimp_brush_get_new_preview (GimpViewable *viewable, } else { - GimpGuiConfig *config; - guint8 rgb[3] = {0, 0, 0}; + guint8 rgb[3] = {0, 0, 0}; - config = GIMP_GUI_CONFIG (context->gimp->config); - - if (config->theme_scheme == GIMP_THEME_DARK) - rgb[0] = rgb[1] = rgb[2] = 255; + if (color != NULL) + gegl_color_get_pixel (color, babl_format ("R'G'B' u8"), rgb); for (y = 0; y < mask_height; y++) { diff --git a/app/core/gimpbuffer.c b/app/core/gimpbuffer.c index 63f44e0b31..eb25f8b306 100644 --- a/app/core/gimpbuffer.c +++ b/app/core/gimpbuffer.c @@ -61,11 +61,13 @@ static gboolean gimp_buffer_get_popup_size (GimpViewable *viewable, static GimpTempBuf * gimp_buffer_get_new_preview (GimpViewable *viewable, GimpContext *context, gint width, - gint height); + gint height, + GeglColor *color); static GdkPixbuf * gimp_buffer_get_new_pixbuf (GimpViewable *viewable, GimpContext *context, gint width, - gint height); + gint height, + GeglColor *color); static gchar * gimp_buffer_get_description (GimpViewable *viewable, gchar **tooltip); @@ -224,7 +226,8 @@ static GimpTempBuf * gimp_buffer_get_new_preview (GimpViewable *viewable, GimpContext *context, gint width, - gint height) + gint height, + GeglColor *color G_GNUC_UNUSED) { GimpBuffer *buffer = GIMP_BUFFER (viewable); const Babl *format = gimp_buffer_get_format (buffer); @@ -258,7 +261,8 @@ static GdkPixbuf * gimp_buffer_get_new_pixbuf (GimpViewable *viewable, GimpContext *context, gint width, - gint height) + gint height, + GeglColor *color G_GNUC_UNUSED) { GimpBuffer *buffer = GIMP_BUFFER (viewable); GdkPixbuf *pixbuf; diff --git a/app/core/gimpcurve.c b/app/core/gimpcurve.c index f5ef5b925d..bca8a30b64 100644 --- a/app/core/gimpcurve.c +++ b/app/core/gimpcurve.c @@ -86,7 +86,8 @@ static gboolean gimp_curve_get_popup_size (GimpViewable *viewable, static GimpTempBuf * gimp_curve_get_new_preview (GimpViewable *viewable, GimpContext *context, gint width, - gint height); + gint height, + GeglColor *color); static gchar * gimp_curve_get_description (GimpViewable *viewable, gchar **tooltip); @@ -521,7 +522,8 @@ static GimpTempBuf * gimp_curve_get_new_preview (GimpViewable *viewable, GimpContext *context, gint width, - gint height) + gint height, + GeglColor *color G_GNUC_UNUSED) { return NULL; } diff --git a/app/core/gimpdrawable-preview.c b/app/core/gimpdrawable-preview.c index aafb71a8d0..a00db1fcb3 100644 --- a/app/core/gimpdrawable-preview.c +++ b/app/core/gimpdrawable-preview.c @@ -112,7 +112,8 @@ GimpTempBuf * gimp_drawable_get_new_preview (GimpViewable *viewable, GimpContext *context, gint width, - gint height) + gint height, + GeglColor *color G_GNUC_UNUSED) { GimpItem *item = GIMP_ITEM (viewable); GimpImage *image = gimp_item_get_image (item); @@ -132,7 +133,8 @@ GdkPixbuf * gimp_drawable_get_new_pixbuf (GimpViewable *viewable, GimpContext *context, gint width, - gint height) + gint height, + GeglColor *color G_GNUC_UNUSED) { GimpItem *item = GIMP_ITEM (viewable); GimpImage *image = gimp_item_get_image (item); diff --git a/app/core/gimpdrawable-preview.h b/app/core/gimpdrawable-preview.h index 31f8adee8c..de3b2de193 100644 --- a/app/core/gimpdrawable-preview.h +++ b/app/core/gimpdrawable-preview.h @@ -25,11 +25,13 @@ GimpTempBuf * gimp_drawable_get_new_preview (GimpViewable *viewable, GimpContext *context, gint width, - gint height); + gint height, + GeglColor *color); GdkPixbuf * gimp_drawable_get_new_pixbuf (GimpViewable *viewable, GimpContext *context, gint width, - gint height); + gint height, + GeglColor *color); /* * normal functions (no virtuals) diff --git a/app/core/gimpgradient.c b/app/core/gimpgradient.c index c47e0eab06..624af4b460 100644 --- a/app/core/gimpgradient.c +++ b/app/core/gimpgradient.c @@ -60,7 +60,8 @@ static gboolean gimp_gradient_get_popup_size (GimpViewable *viewa static GimpTempBuf * gimp_gradient_get_new_preview (GimpViewable *viewable, GimpContext *context, gint width, - gint height); + gint height, + GeglColor *color); static const gchar * gimp_gradient_get_extension (GimpData *data); static void gimp_gradient_copy (GimpData *data, @@ -213,7 +214,8 @@ static GimpTempBuf * gimp_gradient_get_new_preview (GimpViewable *viewable, GimpContext *context, gint width, - gint height) + gint height, + GeglColor *color G_GNUC_UNUSED) { GimpGradient *gradient = GIMP_GRADIENT (viewable); GimpGradientSegment *seg = NULL; diff --git a/app/core/gimpimage-preview.c b/app/core/gimpimage-preview.c index 32f326f265..809eb84b9e 100644 --- a/app/core/gimpimage-preview.c +++ b/app/core/gimpimage-preview.c @@ -121,7 +121,8 @@ GimpTempBuf * gimp_image_get_new_preview (GimpViewable *viewable, GimpContext *context, gint width, - gint height) + gint height, + GeglColor *color G_GNUC_UNUSED) { GimpImage *image = GIMP_IMAGE (viewable); const Babl *format; @@ -150,7 +151,8 @@ GdkPixbuf * gimp_image_get_new_pixbuf (GimpViewable *viewable, GimpContext *context, gint width, - gint height) + gint height, + GeglColor *color G_GNUC_UNUSED) { GimpImage *image = GIMP_IMAGE (viewable); GdkPixbuf *pixbuf; diff --git a/app/core/gimpimage-preview.h b/app/core/gimpimage-preview.h index f8b22c0a43..7c36365c4d 100644 --- a/app/core/gimpimage-preview.h +++ b/app/core/gimpimage-preview.h @@ -41,11 +41,13 @@ gboolean gimp_image_get_popup_size (GimpViewable *viewable, GimpTempBuf * gimp_image_get_new_preview (GimpViewable *viewable, GimpContext *context, gint width, - gint height); + gint height, + GeglColor *color); GdkPixbuf * gimp_image_get_new_pixbuf (GimpViewable *viewable, GimpContext *context, gint width, - gint height); + gint height, + GeglColor *color); #endif /* __GIMP_IMAGE_PREVIEW_H__ */ diff --git a/app/core/gimpimagefile.c b/app/core/gimpimagefile.c index 528b112cd6..04aa04b873 100644 --- a/app/core/gimpimagefile.c +++ b/app/core/gimpimagefile.c @@ -84,7 +84,8 @@ static void gimp_imagefile_name_changed (GimpObject *object); static GdkPixbuf * gimp_imagefile_get_new_pixbuf (GimpViewable *viewable, GimpContext *context, gint width, - gint height); + gint height, + GeglColor *color); static gchar * gimp_imagefile_get_description (GimpViewable *viewable, gchar **tooltip); @@ -224,7 +225,8 @@ static GdkPixbuf * gimp_imagefile_get_new_pixbuf (GimpViewable *viewable, GimpContext *context, gint width, - gint height) + gint height, + GeglColor *color G_GNUC_UNUSED) { GimpImagefile *imagefile = GIMP_IMAGEFILE (viewable); @@ -1061,7 +1063,7 @@ gimp_imagefile_save_thumb (GimpImagefile *imagefile, pixbuf = gimp_viewable_get_new_pixbuf (GIMP_VIEWABLE (image), /* random context, unused */ gimp_get_user_context (image->gimp), - width, height); + width, height, NULL); /* when layer previews are disabled, we won't get a pixbuf */ if (! pixbuf) diff --git a/app/core/gimpimageproxy.c b/app/core/gimpimageproxy.c index 2f9d4b608c..7f159c8f58 100644 --- a/app/core/gimpimageproxy.c +++ b/app/core/gimpimageproxy.c @@ -93,11 +93,13 @@ static gboolean gimp_image_proxy_get_popup_size (GimpViewabl static GimpTempBuf * gimp_image_proxy_get_new_preview (GimpViewable *viewable, GimpContext *context, gint width, - gint height); + gint height, + GeglColor *color); static GdkPixbuf * gimp_image_proxy_get_new_pixbuf (GimpViewable *viewable, GimpContext *context, gint width, - gint height); + gint height, + GeglColor *color); static gchar * gimp_image_proxy_get_description (GimpViewable *viewable, gchar **tooltip); @@ -373,7 +375,8 @@ static GimpTempBuf * gimp_image_proxy_get_new_preview (GimpViewable *viewable, GimpContext *context, gint width, - gint height) + gint height, + GeglColor *color G_GNUC_UNUSED) { GimpImageProxy *image_proxy = GIMP_IMAGE_PROXY (viewable); GimpImage *image = image_proxy->priv->image; @@ -414,7 +417,8 @@ static GdkPixbuf * gimp_image_proxy_get_new_pixbuf (GimpViewable *viewable, GimpContext *context, gint width, - gint height) + gint height, + GeglColor *color G_GNUC_UNUSED) { GimpImageProxy *image_proxy = GIMP_IMAGE_PROXY (viewable); GimpImage *image = image_proxy->priv->image; diff --git a/app/core/gimppalette.c b/app/core/gimppalette.c index 240eb76c3e..e178fbd5a9 100644 --- a/app/core/gimppalette.c +++ b/app/core/gimppalette.c @@ -75,7 +75,8 @@ static gboolean gimp_palette_get_popup_size (GimpViewable *vie static GimpTempBuf * gimp_palette_get_new_preview (GimpViewable *viewable, GimpContext *context, gint width, - gint height); + gint height, + GeglColor *color); static gchar * gimp_palette_get_description (GimpViewable *viewable, gchar **tooltip); static const gchar * gimp_palette_get_extension (GimpData *data); @@ -239,7 +240,8 @@ static GimpTempBuf * gimp_palette_get_new_preview (GimpViewable *viewable, GimpContext *context, gint width, - gint height) + gint height, + GeglColor *color G_GNUC_UNUSED) { GimpPalette *palette = GIMP_PALETTE (viewable); GimpTempBuf *temp_buf; diff --git a/app/core/gimppattern.c b/app/core/gimppattern.c index 1ab86305e3..076e6932b3 100644 --- a/app/core/gimppattern.c +++ b/app/core/gimppattern.c @@ -49,7 +49,8 @@ static gboolean gimp_pattern_get_size (GimpViewable *viewa static GimpTempBuf * gimp_pattern_get_new_preview (GimpViewable *viewable, GimpContext *context, gint width, - gint height); + gint height, + GeglColor *color); static gchar * gimp_pattern_get_description (GimpViewable *viewable, gchar **tooltip); @@ -141,7 +142,8 @@ static GimpTempBuf * gimp_pattern_get_new_preview (GimpViewable *viewable, GimpContext *context, gint width, - gint height) + gint height, + GeglColor *color G_GNUC_UNUSED) { GimpPattern *pattern = GIMP_PATTERN (viewable); GimpTempBuf *temp_buf; diff --git a/app/core/gimpundo.c b/app/core/gimpundo.c index 14527c6ed1..d04b578d50 100644 --- a/app/core/gimpundo.c +++ b/app/core/gimpundo.c @@ -82,7 +82,8 @@ static gboolean gimp_undo_get_popup_size (GimpViewable *viewabl static GimpTempBuf * gimp_undo_get_new_preview (GimpViewable *viewable, GimpContext *context, gint width, - gint height); + gint height, + GeglColor *color); static void gimp_undo_real_pop (GimpUndo *undo, GimpUndoMode undo_mode, @@ -301,7 +302,8 @@ static GimpTempBuf * gimp_undo_get_new_preview (GimpViewable *viewable, GimpContext *context, gint width, - gint height) + gint height, + GeglColor *color) { GimpUndo *undo = GIMP_UNDO (viewable); @@ -491,7 +493,7 @@ gimp_undo_create_preview_private (GimpUndo *undo, } undo->preview = gimp_viewable_get_new_preview (preview_viewable, context, - width, height); + width, height, NULL); gimp_viewable_invalidate_preview (GIMP_VIEWABLE (undo)); } diff --git a/app/core/gimpviewable.c b/app/core/gimpviewable.c index 19ccba0b5f..5b267c738b 100644 --- a/app/core/gimpviewable.c +++ b/app/core/gimpviewable.c @@ -100,7 +100,8 @@ static void gimp_viewable_real_ancestry_changed (GimpViewable *viewable); static GdkPixbuf * gimp_viewable_real_get_new_pixbuf (GimpViewable *viewable, GimpContext *context, gint width, - gint height); + gint height, + GeglColor *color); static void gimp_viewable_real_get_preview_size (GimpViewable *viewable, gint size, gboolean popup, @@ -402,13 +403,14 @@ static GdkPixbuf * gimp_viewable_real_get_new_pixbuf (GimpViewable *viewable, GimpContext *context, gint width, - gint height) + gint height, + GeglColor *color) { GimpViewablePrivate *private = GET_PRIVATE (viewable); GdkPixbuf *pixbuf = NULL; GimpTempBuf *temp_buf; - temp_buf = gimp_viewable_get_preview (viewable, context, width, height); + temp_buf = gimp_viewable_get_preview (viewable, context, width, height, color); if (temp_buf) { @@ -827,6 +829,8 @@ gimp_viewable_get_popup_size (GimpViewable *viewable, * @context: The context to render the preview for. * @width: desired width for the preview * @height: desired height for the preview + * @color: desired foreground color for the preview when the type of + * @viewable support recolorization. * * Gets a preview for a viewable object, by running through a variety * of methods until it finds one that works. First, if an @@ -838,6 +842,12 @@ gimp_viewable_get_popup_size (GimpViewable *viewable, * method, and executes it, caching the result. If everything fails, * %NULL is returned. * + * When a drawable can be recolored (for instance a generated or mask + * brush), then @color will be used. Note that in many cases, viewables + * cannot be recolored (e.g. images, layers or color brushes). + * When setting @color to %NULL on a recolorable viewable, the used + * color may be anything. + * * Returns: (nullable): A #GimpTempBuf containing the preview image, or %NULL if * none can be found or created. **/ @@ -845,7 +855,8 @@ GimpTempBuf * gimp_viewable_get_preview (GimpViewable *viewable, GimpContext *context, gint width, - gint height) + gint height, + GeglColor *color) { GimpViewablePrivate *private = GET_PRIVATE (viewable); GimpViewableClass *viewable_class; @@ -862,7 +873,7 @@ gimp_viewable_get_preview (GimpViewable *viewable, viewable_class = GIMP_VIEWABLE_GET_CLASS (viewable); if (viewable_class->get_preview) - temp_buf = viewable_class->get_preview (viewable, context, width, height); + temp_buf = viewable_class->get_preview (viewable, context, width, height, color); if (temp_buf) return temp_buf; @@ -880,7 +891,7 @@ gimp_viewable_get_preview (GimpViewable *viewable, if (viewable_class->get_new_preview) temp_buf = viewable_class->get_new_preview (viewable, context, - width, height); + width, height, color); private->preview_temp_buf = temp_buf; @@ -892,6 +903,8 @@ gimp_viewable_get_preview (GimpViewable *viewable, * @viewable: The viewable object to get a preview for. * @width: desired width for the preview * @height: desired height for the preview + * @color: desired foreground color for the preview when the type of + * @viewable support recolorization. * * Gets a new preview for a viewable object. Similar to * gimp_viewable_get_preview(), except that it tries things in a @@ -906,7 +919,8 @@ GimpTempBuf * gimp_viewable_get_new_preview (GimpViewable *viewable, GimpContext *context, gint width, - gint height) + gint height, + GeglColor *color) { GimpViewableClass *viewable_class; GimpTempBuf *temp_buf = NULL; @@ -923,14 +937,14 @@ gimp_viewable_get_new_preview (GimpViewable *viewable, if (viewable_class->get_new_preview) temp_buf = viewable_class->get_new_preview (viewable, context, - width, height); + width, height, color); if (temp_buf) return temp_buf; if (viewable_class->get_preview) temp_buf = viewable_class->get_preview (viewable, context, - width, height); + width, height, color); if (temp_buf) return gimp_temp_buf_copy (temp_buf); @@ -982,6 +996,8 @@ gimp_viewable_get_dummy_preview (GimpViewable *viewable, * @context: The context to render the preview for. * @width: desired width for the preview * @height: desired height for the preview + * @color: desired foreground color for the preview when the type of + * @viewable support recolorization. * * Gets a preview for a viewable object, by running through a variety * of methods until it finds one that works. First, if an @@ -1000,7 +1016,8 @@ GdkPixbuf * gimp_viewable_get_pixbuf (GimpViewable *viewable, GimpContext *context, gint width, - gint height) + gint height, + GeglColor *color) { GimpViewablePrivate *private = GET_PRIVATE (viewable); GimpViewableClass *viewable_class; @@ -1017,7 +1034,7 @@ gimp_viewable_get_pixbuf (GimpViewable *viewable, viewable_class = GIMP_VIEWABLE_GET_CLASS (viewable); if (viewable_class->get_pixbuf) - pixbuf = viewable_class->get_pixbuf (viewable, context, width, height); + pixbuf = viewable_class->get_pixbuf (viewable, context, width, height, color); if (pixbuf) return pixbuf; @@ -1034,7 +1051,7 @@ gimp_viewable_get_pixbuf (GimpViewable *viewable, } if (viewable_class->get_new_pixbuf) - pixbuf = viewable_class->get_new_pixbuf (viewable, context, width, height); + pixbuf = viewable_class->get_new_pixbuf (viewable, context, width, height, color); private->preview_pixbuf = pixbuf; @@ -1047,6 +1064,8 @@ gimp_viewable_get_pixbuf (GimpViewable *viewable, * @context: The context to render the preview for. * @width: desired width for the pixbuf * @height: desired height for the pixbuf + * @color: desired foreground color for the preview when the type of + * @viewable support recolorization. * * Gets a new preview for a viewable object. Similar to * gimp_viewable_get_pixbuf(), except that it tries things in a @@ -1061,7 +1080,8 @@ GdkPixbuf * gimp_viewable_get_new_pixbuf (GimpViewable *viewable, GimpContext *context, gint width, - gint height) + gint height, + GeglColor *color) { GimpViewableClass *viewable_class; GdkPixbuf *pixbuf = NULL; @@ -1077,13 +1097,13 @@ gimp_viewable_get_new_pixbuf (GimpViewable *viewable, viewable_class = GIMP_VIEWABLE_GET_CLASS (viewable); if (viewable_class->get_new_pixbuf) - pixbuf = viewable_class->get_new_pixbuf (viewable, context, width, height); + pixbuf = viewable_class->get_new_pixbuf (viewable, context, width, height, color); if (pixbuf) return pixbuf; if (viewable_class->get_pixbuf) - pixbuf = viewable_class->get_pixbuf (viewable, context, width, height); + pixbuf = viewable_class->get_pixbuf (viewable, context, width, height, color); if (pixbuf) return gdk_pixbuf_copy (pixbuf); diff --git a/app/core/gimpviewable.h b/app/core/gimpviewable.h index 249750ec17..66d19feeb8 100644 --- a/app/core/gimpviewable.h +++ b/app/core/gimpviewable.h @@ -79,19 +79,23 @@ struct _GimpViewableClass GimpTempBuf * (* get_preview) (GimpViewable *viewable, GimpContext *context, gint width, - gint height); + gint height, + GeglColor *fg_color); GimpTempBuf * (* get_new_preview) (GimpViewable *viewable, GimpContext *context, gint width, - gint height); + gint height, + GeglColor *fg_color); GdkPixbuf * (* get_pixbuf) (GimpViewable *viewable, GimpContext *context, gint width, - gint height); + gint height, + GeglColor *fg_color); GdkPixbuf * (* get_new_pixbuf) (GimpViewable *viewable, GimpContext *context, gint width, - gint height); + gint height, + GeglColor *fg_color); gchar * (* get_description) (GimpViewable *viewable, gchar **tooltip); @@ -144,11 +148,13 @@ gboolean gimp_viewable_get_popup_size (GimpViewable *viewable, GimpTempBuf * gimp_viewable_get_preview (GimpViewable *viewable, GimpContext *context, gint width, - gint height); + gint height, + GeglColor *fg_color); GimpTempBuf * gimp_viewable_get_new_preview (GimpViewable *viewable, GimpContext *context, gint width, - gint height); + gint height, + GeglColor *fg_color); GimpTempBuf * gimp_viewable_get_dummy_preview (GimpViewable *viewable, gint width, @@ -158,11 +164,13 @@ GimpTempBuf * gimp_viewable_get_dummy_preview (GimpViewable *viewable, GdkPixbuf * gimp_viewable_get_pixbuf (GimpViewable *viewable, GimpContext *context, gint width, - gint height); + gint height, + GeglColor *color); GdkPixbuf * gimp_viewable_get_new_pixbuf (GimpViewable *viewable, GimpContext *context, gint width, - gint height); + gint height, + GeglColor *color); GdkPixbuf * gimp_viewable_get_dummy_pixbuf (GimpViewable *viewable, gint width, diff --git a/app/dialogs/metadata-rotation-import-dialog.c b/app/dialogs/metadata-rotation-import-dialog.c index 38db4c788f..dc50f30f2d 100644 --- a/app/dialogs/metadata-rotation-import-dialog.c +++ b/app/dialogs/metadata-rotation-import-dialog.c @@ -163,7 +163,7 @@ gimp_image_metadata_rotate_dialog (GimpImage *image, gimp_pickable_flush (GIMP_PICKABLE (image)); pixbuf = gimp_viewable_get_pixbuf (GIMP_VIEWABLE (image), context, - width, height); + width, height, NULL); if (pixbuf) { GdkPixbuf *rotated; diff --git a/app/dialogs/resize-dialog.c b/app/dialogs/resize-dialog.c index e516b8731f..40990ca070 100644 --- a/app/dialogs/resize-dialog.c +++ b/app/dialogs/resize-dialog.c @@ -429,7 +429,7 @@ resize_dialog_new (GimpViewable *viewable, gimp_viewable_get_preview_size (viewable, 200, TRUE, TRUE, &width, &height); pixbuf = gimp_viewable_get_pixbuf (viewable, context, - width, height); + width, height, NULL); if (pixbuf) gimp_offset_area_set_pixbuf (GIMP_OFFSET_AREA (private->area), pixbuf); diff --git a/app/pdb/drawable-cmds.c b/app/pdb/drawable-cmds.c index 4187f3c293..bae6322a70 100644 --- a/app/pdb/drawable-cmds.c +++ b/app/pdb/drawable-cmds.c @@ -980,7 +980,7 @@ drawable_thumbnail_invoker (GimpProcedure *procedure, if (image->gimp->config->layer_previews) buf = gimp_viewable_get_new_preview (GIMP_VIEWABLE (drawable), context, - width, height); + width, height, NULL); else buf = gimp_viewable_get_dummy_preview (GIMP_VIEWABLE (drawable), width, height, diff --git a/app/pdb/image-cmds.c b/app/pdb/image-cmds.c index 48e0d8cebc..449c9fd53a 100644 --- a/app/pdb/image-cmds.c +++ b/app/pdb/image-cmds.c @@ -1849,7 +1849,7 @@ image_thumbnail_invoker (GimpProcedure *procedure, gimp_pickable_flush (GIMP_PICKABLE (image)); buf = gimp_viewable_get_new_preview (GIMP_VIEWABLE (image), context, - width, height); + width, height, NULL); if (buf) { diff --git a/app/text/gimpfont.c b/app/text/gimpfont.c index 8400e1bc07..cc8d2876fc 100644 --- a/app/text/gimpfont.c +++ b/app/text/gimpfont.c @@ -133,7 +133,8 @@ static gboolean gimp_font_get_popup_size (GimpViewable *viewab static GimpTempBuf * gimp_font_get_new_preview (GimpViewable *viewable, GimpContext *context, gint width, - gint height); + gint height, + GeglColor *color); static void gimp_font_config_iface_init (GimpConfigInterface *iface); static gboolean gimp_font_serialize (GimpConfig *config, @@ -710,7 +711,8 @@ static GimpTempBuf * gimp_font_get_new_preview (GimpViewable *viewable, GimpContext *context, gint width, - gint height) + gint height, + GeglColor *color) { GimpFont *font = GIMP_FONT (viewable); PangoContext *pango_context; diff --git a/app/vectors/gimppath-preview.c b/app/vectors/gimppath-preview.c index 24b620f88b..9a75c48838 100644 --- a/app/vectors/gimppath-preview.c +++ b/app/vectors/gimppath-preview.c @@ -40,7 +40,8 @@ GimpTempBuf * gimp_path_get_new_preview (GimpViewable *viewable, GimpContext *context, gint width, - gint height) + gint height, + GeglColor *color) { GimpPath *path; GimpItem *item; diff --git a/app/vectors/gimppath-preview.h b/app/vectors/gimppath-preview.h index 5050773107..a8ed7bed8f 100644 --- a/app/vectors/gimppath-preview.h +++ b/app/vectors/gimppath-preview.h @@ -26,7 +26,8 @@ GimpTempBuf * gimp_path_get_new_preview (GimpViewable *viewable, GimpContext *context, gint width, - gint height); + gint height, + GeglColor *color); #endif /* __GIMP_PATH_PREVIEW_H__ */ diff --git a/app/widgets/gimpclipboard.c b/app/widgets/gimpclipboard.c index 95b120ae97..f586b8e1f4 100644 --- a/app/widgets/gimpclipboard.c +++ b/app/widgets/gimpclipboard.c @@ -1171,7 +1171,8 @@ gimp_clipboard_send_image (GtkClipboard *clipboard, pixbuf = gimp_viewable_get_pixbuf (GIMP_VIEWABLE (gimp_clip->image), gimp_get_user_context (gimp), gimp_image_get_width (gimp_clip->image), - gimp_image_get_height (gimp_clip->image)); + gimp_image_get_height (gimp_clip->image), + NULL); if (pixbuf) { @@ -1216,7 +1217,8 @@ gimp_clipboard_send_buffer (GtkClipboard *clipboard, pixbuf = gimp_viewable_get_pixbuf (GIMP_VIEWABLE (gimp_clip->buffer), gimp_get_user_context (gimp), gimp_buffer_get_width (gimp_clip->buffer), - gimp_buffer_get_height (gimp_clip->buffer)); + gimp_buffer_get_height (gimp_clip->buffer), + NULL); if (pixbuf) { diff --git a/app/widgets/gimpcontainericonview.c b/app/widgets/gimpcontainericonview.c index 730fd8f162..9f3910b3aa 100644 --- a/app/widgets/gimpcontainericonview.c +++ b/app/widgets/gimpcontainericonview.c @@ -814,7 +814,7 @@ gimp_container_icon_view_drag_pixbuf (GtkWidget *widget, if (renderer && gimp_viewable_get_size (renderer->viewable, &width, &height)) return gimp_viewable_get_new_pixbuf (renderer->viewable, renderer->context, - width, height); + width, height, NULL); return NULL; } diff --git a/app/widgets/gimpcontainertreeview.c b/app/widgets/gimpcontainertreeview.c index bce0044ece..a4241ef47b 100644 --- a/app/widgets/gimpcontainertreeview.c +++ b/app/widgets/gimpcontainertreeview.c @@ -1827,7 +1827,7 @@ gimp_container_tree_view_drag_pixbuf (GtkWidget *widget, if (renderer && gimp_viewable_get_size (renderer->viewable, &width, &height)) return gimp_viewable_get_new_pixbuf (renderer->viewable, renderer->context, - width, height); + width, height, NULL); return NULL; } diff --git a/app/widgets/gimpview.c b/app/widgets/gimpview.c index 2ac29003cb..96387f7085 100644 --- a/app/widgets/gimpview.c +++ b/app/widgets/gimpview.c @@ -848,7 +848,7 @@ gimp_view_drag_pixbuf (GtkWidget *widget, if (viewable && gimp_viewable_get_size (viewable, &width, &height)) return gimp_viewable_get_new_pixbuf (viewable, view->renderer->context, - width, height); + width, height, NULL); return NULL; } diff --git a/app/widgets/gimpviewrenderer-frame.c b/app/widgets/gimpviewrenderer-frame.c index 3abd1991fe..faf69f38b8 100644 --- a/app/widgets/gimpviewrenderer-frame.c +++ b/app/widgets/gimpviewrenderer-frame.c @@ -234,7 +234,7 @@ gimp_view_renderer_get_frame_pixbuf (GimpViewRenderer *renderer, { pixbuf = gimp_viewable_get_pixbuf (renderer->viewable, renderer->context, - w, h); + w, h, NULL); if (!pixbuf) return NULL; @@ -251,7 +251,8 @@ gimp_view_renderer_get_frame_pixbuf (GimpViewRenderer *renderer, { pixbuf = gimp_viewable_get_pixbuf (renderer->viewable, renderer->context, - width - 2, height - 2); + width - 2, height - 2, + NULL); if (!pixbuf) return NULL; diff --git a/app/widgets/gimpviewrenderer.c b/app/widgets/gimpviewrenderer.c index 5bd40ac61d..95691212ed 100644 --- a/app/widgets/gimpviewrenderer.c +++ b/app/widgets/gimpviewrenderer.c @@ -801,15 +801,32 @@ static void gimp_view_renderer_real_render (GimpViewRenderer *renderer, GtkWidget *widget) { - GdkPixbuf *pixbuf; - GimpTempBuf *temp_buf; - const gchar *icon_name; - gint scale_factor = gtk_widget_get_scale_factor (widget); + GdkPixbuf *pixbuf; + GimpTempBuf *temp_buf; + const gchar *icon_name; + GeglColor *color = NULL; + GdkRGBA *fg_color = NULL; + GtkStyleContext *style; + gint scale_factor = gtk_widget_get_scale_factor (widget); + + style = gtk_widget_get_style_context (widget); + gtk_style_context_get (style, gtk_style_context_get_state (style), + GTK_STYLE_PROPERTY_COLOR, &fg_color, + NULL); + if (fg_color) + { + color = gegl_color_new (NULL); + gegl_color_set_rgba_with_space (color, + fg_color->red, fg_color->green, fg_color->blue, 1.0, + NULL); + } + g_clear_pointer (&fg_color, gdk_rgba_free); pixbuf = gimp_viewable_get_pixbuf (renderer->viewable, renderer->context, renderer->width * scale_factor, - renderer->height * scale_factor); + renderer->height * scale_factor, + color); if (pixbuf) { gimp_view_renderer_render_pixbuf (renderer, widget, pixbuf); @@ -819,7 +836,8 @@ gimp_view_renderer_real_render (GimpViewRenderer *renderer, temp_buf = gimp_viewable_get_preview (renderer->viewable, renderer->context, renderer->width, - renderer->height); + renderer->height, + color); if (temp_buf) { gimp_view_renderer_render_temp_buf_simple (renderer, widget, temp_buf); @@ -828,6 +846,8 @@ gimp_view_renderer_real_render (GimpViewRenderer *renderer, icon_name = gimp_viewable_get_icon_name (renderer->viewable); gimp_view_renderer_render_icon (renderer, widget, icon_name); + + g_clear_object (&color); } static void diff --git a/app/widgets/gimpviewrendererbrush.c b/app/widgets/gimpviewrendererbrush.c index 22c8c5d675..41d5b24961 100644 --- a/app/widgets/gimpviewrendererbrush.c +++ b/app/widgets/gimpviewrendererbrush.c @@ -87,10 +87,14 @@ static void gimp_view_renderer_brush_render (GimpViewRenderer *renderer, GtkWidget *widget) { - GimpViewRendererBrush *renderbrush = GIMP_VIEW_RENDERER_BRUSH (renderer); + GimpViewRendererBrush *renderbrush = GIMP_VIEW_RENDERER_BRUSH (renderer); GimpTempBuf *temp_buf; - gint temp_buf_x = 0; - gint temp_buf_y = 0; + GeglColor *color = NULL; + GdkRGBA *fg_color = NULL; + GtkStyleContext *style; + GimpViewBG view_bg_style = GIMP_VIEW_BG_WHITE; + gint temp_buf_x = 0; + gint temp_buf_y = 0; gint temp_buf_width; gint temp_buf_height; @@ -100,10 +104,23 @@ gimp_view_renderer_brush_render (GimpViewRenderer *renderer, renderbrush->pipe_timeout_id = 0; } - temp_buf = gimp_viewable_get_new_preview (renderer->viewable, - renderer->context, - renderer->width, - renderer->height); + style = gtk_widget_get_style_context (widget); + gtk_style_context_get (style, gtk_style_context_get_state (style), + GTK_STYLE_PROPERTY_COLOR, &fg_color, + NULL); + if (fg_color) + { + color = gegl_color_new (NULL); + gegl_color_set_rgba_with_space (color, + fg_color->red, fg_color->green, fg_color->blue, 1.0, + NULL); + view_bg_style = GIMP_VIEW_BG_USE_STYLE; + } + g_clear_pointer (&fg_color, gdk_rgba_free); + + temp_buf = gimp_viewable_get_new_preview (renderer->viewable, renderer->context, + renderer->width, renderer->height, color); + g_clear_object (&color); temp_buf_width = gimp_temp_buf_get_width (temp_buf); temp_buf_height = gimp_temp_buf_get_height (temp_buf); @@ -119,8 +136,8 @@ gimp_view_renderer_brush_render (GimpViewRenderer *renderer, gimp_view_renderer_render_temp_buf (renderer, widget, temp_buf, temp_buf_x, temp_buf_y, -1, - GIMP_VIEW_BG_USE_STYLE, - GIMP_VIEW_BG_USE_STYLE); + view_bg_style, + view_bg_style); gimp_temp_buf_unref (temp_buf); @@ -139,8 +156,8 @@ gimp_view_renderer_brush_render (GimpViewRenderer *renderer, gimp_view_renderer_render_temp_buf (renderer, widget, temp_buf, temp_buf_x, temp_buf_y, -1, - GIMP_VIEW_BG_USE_STYLE, - GIMP_VIEW_BG_USE_STYLE); + view_bg_style, + view_bg_style); gimp_temp_buf_unref (temp_buf); } @@ -153,6 +170,10 @@ gimp_view_renderer_brush_render_timeout (gpointer data) GimpBrushPipe *brush_pipe; GimpBrush *brush; GimpTempBuf *temp_buf; + GeglColor *color = NULL; + GdkRGBA *fg_color = NULL; + GtkStyleContext *style; + GimpViewBG view_bg_style = GIMP_VIEW_BG_WHITE; gint temp_buf_x = 0; gint temp_buf_y = 0; gint temp_buf_width; @@ -168,6 +189,20 @@ gimp_view_renderer_brush_render_timeout (gpointer data) brush_pipe = GIMP_BRUSH_PIPE (renderer->viewable); + style = gtk_widget_get_style_context (renderbrush->widget); + gtk_style_context_get (style, gtk_style_context_get_state (style), + GTK_STYLE_PROPERTY_COLOR, &fg_color, + NULL); + if (fg_color) + { + color = gegl_color_new (NULL); + gegl_color_set_rgba_with_space (color, + fg_color->red, fg_color->green, fg_color->blue, 1.0, + NULL); + view_bg_style = GIMP_VIEW_BG_USE_STYLE; + } + g_clear_pointer (&fg_color, gdk_rgba_free); + renderbrush->pipe_animation_index++; if (renderbrush->pipe_animation_index >= brush_pipe->n_brushes) @@ -179,7 +214,9 @@ gimp_view_renderer_brush_render_timeout (gpointer data) temp_buf = gimp_viewable_get_new_preview (GIMP_VIEWABLE (brush), renderer->context, renderer->width, - renderer->height); + renderer->height, + color); + g_clear_object (&color); temp_buf_width = gimp_temp_buf_get_width (temp_buf); temp_buf_height = gimp_temp_buf_get_height (temp_buf); @@ -193,8 +230,8 @@ gimp_view_renderer_brush_render_timeout (gpointer data) gimp_view_renderer_render_temp_buf (renderer, renderbrush->widget, temp_buf, temp_buf_x, temp_buf_y, -1, - GIMP_VIEW_BG_USE_STYLE, - GIMP_VIEW_BG_USE_STYLE); + view_bg_style, + view_bg_style); gimp_temp_buf_unref (temp_buf); diff --git a/app/widgets/gimpviewrendererbuffer.c b/app/widgets/gimpviewrendererbuffer.c index 7f9d01e13f..1346205cbb 100644 --- a/app/widgets/gimpviewrendererbuffer.c +++ b/app/widgets/gimpviewrendererbuffer.c @@ -84,7 +84,8 @@ gimp_view_renderer_buffer_render (GimpViewRenderer *renderer, temp_buf = gimp_viewable_get_new_preview (renderer->viewable, renderer->context, - buffer_width, buffer_height); + buffer_width, buffer_height, + NULL); if (temp_buf) { @@ -97,7 +98,8 @@ gimp_view_renderer_buffer_render (GimpViewRenderer *renderer, { render_buf = gimp_viewable_get_new_preview (renderer->viewable, renderer->context, - view_width, view_height); + view_width, view_height, + NULL); } if (render_buf) diff --git a/app/widgets/gimpviewrendererimage.c b/app/widgets/gimpviewrendererimage.c index fe4930a362..9e721376b3 100644 --- a/app/widgets/gimpviewrendererimage.c +++ b/app/widgets/gimpviewrendererimage.c @@ -118,7 +118,7 @@ gimp_view_renderer_image_render (GimpViewRenderer *renderer, temp_buf = gimp_viewable_get_new_preview (renderer->viewable, renderer->context, - width, height); + width, height, NULL); if (temp_buf) { @@ -132,7 +132,7 @@ gimp_view_renderer_image_render (GimpViewRenderer *renderer, render_buf = gimp_viewable_get_new_preview (renderer->viewable, renderer->context, view_width, - view_height); + view_height, NULL); } if (render_buf) diff --git a/pdb/groups/drawable.pdb b/pdb/groups/drawable.pdb index e3dcf49bd6..3d6328d8c0 100644 --- a/pdb/groups/drawable.pdb +++ b/pdb/groups/drawable.pdb @@ -983,7 +983,7 @@ HELP if (image->gimp->config->layer_previews) buf = gimp_viewable_get_new_preview (GIMP_VIEWABLE (drawable), context, - width, height); + width, height, NULL); else buf = gimp_viewable_get_dummy_preview (GIMP_VIEWABLE (drawable), width, height, diff --git a/pdb/groups/image.pdb b/pdb/groups/image.pdb index cc4e9901e1..628b3a656d 100644 --- a/pdb/groups/image.pdb +++ b/pdb/groups/image.pdb @@ -3154,7 +3154,7 @@ HELP gimp_pickable_flush (GIMP_PICKABLE (image)); buf = gimp_viewable_get_new_preview (GIMP_VIEWABLE (image), context, - width, height); + width, height, NULL); if (buf) {