widgets: Minor GimpRGB to GeglColor ports

Mainly fixing GimpRGB comments and
parameters that are unused (or in unused
functions).
GimpCircle and GimpGradientChooser
have color conversions ported to use
GeglColor exclusively.
This commit is contained in:
Alx Sa 2024-03-19 04:40:14 +00:00
parent f46c536ebb
commit 05af8c91c1
7 changed files with 24 additions and 23 deletions

View file

@ -101,7 +101,7 @@ static void gimp_offset_tool_edge_behavior_toggled (GtkToggleButton
GimpOffsetTool *offset_tool); GimpOffsetTool *offset_tool);
static void gimp_offset_tool_background_changed (GimpContext *context, static void gimp_offset_tool_background_changed (GimpContext *context,
const GimpRGB *color, GeglColor *color,
GimpOffsetTool *offset_tool); GimpOffsetTool *offset_tool);
static gint gimp_offset_tool_get_width (GimpOffsetTool *offset_tool); static gint gimp_offset_tool_get_width (GimpOffsetTool *offset_tool);
@ -636,7 +636,7 @@ gimp_offset_tool_edge_behavior_toggled (GtkToggleButton *toggle,
static void static void
gimp_offset_tool_background_changed (GimpContext *context, gimp_offset_tool_background_changed (GimpContext *context,
const GimpRGB *color, GeglColor *color,
GimpOffsetTool *offset_tool) GimpOffsetTool *offset_tool)
{ {
GimpFilterTool *filter_tool = GIMP_FILTER_TOOL (offset_tool); GimpFilterTool *filter_tool = GIMP_FILTER_TOOL (offset_tool);

View file

@ -508,17 +508,16 @@ gimp_circle_background_hsv (gdouble angle,
gdouble distance, gdouble distance,
guchar *rgb) guchar *rgb)
{ {
GimpHSV hsv; gdouble hsv[3];
GimpRGB color; GeglColor *color = gegl_color_new ("black");
gimp_hsv_set (&hsv, hsv[0] = angle / (2.0 * G_PI);
angle / (2.0 * G_PI), hsv[1] = distance;
distance, hsv[2] = 1 - sqrt (distance) / 4;
1 - sqrt (distance) / 4 /* it just looks nicer this way */);
gimp_hsv_to_rgb (&hsv, &color); gegl_color_set_pixel (color, babl_format ("HSV double"), hsv);
gegl_color_get_pixel (color, babl_format ("R'G'B' u8"), rgb);
gimp_rgb_get_uchar (&color, rgb, rgb + 1, rgb + 2); g_object_unref (color);
} }
static void static void

View file

@ -108,7 +108,7 @@ static void gimp_colormap_selection_entry_activated (GimpPaletteView *vi
GimpColormapSelection *selection); GimpColormapSelection *selection);
static void gimp_colormap_selection_color_dropped (GimpPaletteView *view, static void gimp_colormap_selection_color_dropped (GimpPaletteView *view,
GimpPaletteEntry *entry, GimpPaletteEntry *entry,
const GimpRGB *color, GeglColor *color,
GimpColormapSelection *selection); GimpColormapSelection *selection);
static void gimp_colormap_adjustment_changed (GtkAdjustment *adjustment, static void gimp_colormap_adjustment_changed (GtkAdjustment *adjustment,
@ -661,7 +661,7 @@ gimp_colormap_selection_entry_activated (GimpPaletteView *view,
static void static void
gimp_colormap_selection_color_dropped (GimpPaletteView *view, gimp_colormap_selection_color_dropped (GimpPaletteView *view,
GimpPaletteEntry *entry, GimpPaletteEntry *entry,
const GimpRGB *color, GeglColor *color,
GimpColormapSelection *selection) GimpColormapSelection *selection)
{ {
} }

View file

@ -422,7 +422,7 @@ gimp_prop_color_button_new (GObject *config,
* @height: Height of color button. * @height: Height of color button.
* @type: How transparency is represented. * @type: How transparency is represented.
* *
* Creates a #GimpColorPanel to set and display the value of a #GimpRGB * Creates a #GimpColorPanel to set and display the value of a #GeglColor
* property. Pressing the button brings up a color selector dialog. * property. Pressing the button brings up a color selector dialog.
* If @title is %NULL, the @property_name's nick will be used as label * If @title is %NULL, the @property_name's nick will be used as label
* of the returned widget. * of the returned widget.

View file

@ -278,13 +278,14 @@ gimp_gradient_select_preview_draw (cairo_t *cr,
x < src_width; x < src_width;
x++, src += 4, dest += 4) x++, src += 4, dest += 4)
{ {
GimpRGB color; GeglColor *color = gegl_color_new ("black");
guchar r, g, b, a; guchar rgba[4];
gimp_rgba_set (&color, src[0], src[1], src[2], src[3]); gegl_color_set_pixel (color, babl_format ("R'G'B'A double"), src);
gimp_rgba_get_uchar (&color, &r, &g, &b, &a); gegl_color_get_pixel (color, babl_format ("R'G'B'A u8"), rgba);
GIMP_CAIRO_ARGB32_SET_PIXEL (dest, r, g, b, a); GIMP_CAIRO_ARGB32_SET_PIXEL (dest, rgba[0], rgba[1], rgba[2], rgba[3]);
g_object_unref (color);
} }
cairo_surface_mark_dirty (surface); cairo_surface_mark_dirty (surface);

View file

@ -219,7 +219,7 @@ static void gimp_color_select_update_pos (GimpColorSelect
static void gimp_color_select_drop_color (GtkWidget *widget, static void gimp_color_select_drop_color (GtkWidget *widget,
gint x, gint x,
gint y, gint y,
const GimpRGB *color, GeglColor *color,
gpointer data); gpointer data);
#endif #endif
@ -1036,7 +1036,7 @@ static void
gimp_color_select_drop_color (GtkWidget *widget, gimp_color_select_drop_color (GtkWidget *widget,
gint x, gint x,
gint y, gint y,
const GimpRGB *color, GeglColor *color,
gpointer data) gpointer data)
{ {
GimpColorSelect *select = GIMP_COLOR_SELECT (data); GimpColorSelect *select = GIMP_COLOR_SELECT (data);

View file

@ -20,6 +20,7 @@
#include "config.h" #include "config.h"
#include <gegl.h>
#include <gtk/gtk.h> #include <gtk/gtk.h>
#include "libgimpmath/gimpmath.h" #include "libgimpmath/gimpmath.h"
@ -546,8 +547,8 @@ gimp_scrolled_preview_nav_button_press (GtkWidget *widget,
GdkCursor *cursor; GdkCursor *cursor;
GtkBorder border; GtkBorder border;
GimpCheckType check_type; GimpCheckType check_type;
GimpRGB check_custom_color1; GeglColor *check_custom_color1;
GimpRGB check_custom_color2; GeglColor *check_custom_color2;
gint area_width; gint area_width;
gint area_height; gint area_height;
gint x, y; gint x, y;