2003-10-29 20:57:21 +00:00
|
|
|
/* LIBGIMP - The GIMP Library
|
|
|
|
* Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
|
1997-11-24 22:05:25 +00:00
|
|
|
*
|
2002-10-28 20:13:17 +00:00
|
|
|
* gimpcolorselect.c
|
|
|
|
* Copyright (C) 2002 Michael Natterer <mitch@gimp.org>
|
1997-11-24 22:05:25 +00:00
|
|
|
*
|
2002-10-28 20:13:17 +00:00
|
|
|
* based on color_notebook module
|
|
|
|
* Copyright (C) 1998 Austin Donnelly <austin@greenend.org.uk>
|
1997-11-24 22:05:25 +00:00
|
|
|
*
|
2009-01-17 22:28:01 +00:00
|
|
|
* This library is free software: you can redistribute it and/or
|
2002-10-28 20:13:17 +00:00
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
2009-01-17 22:28:01 +00:00
|
|
|
* version 3 of the License, or (at your option) any later version.
|
2003-10-29 20:57:21 +00:00
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
2002-10-28 20:13:17 +00:00
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
2009-01-17 22:28:01 +00:00
|
|
|
* License along with this library. If not, see
|
2018-07-11 23:27:07 +02:00
|
|
|
* <https://www.gnu.org/licenses/>.
|
1997-11-24 22:05:25 +00:00
|
|
|
*/
|
2000-12-16 21:37:03 +00:00
|
|
|
|
1999-06-06 19:44:36 +00:00
|
|
|
#include "config.h"
|
1999-09-27 17:58:10 +00:00
|
|
|
|
2012-05-03 03:36:22 +02:00
|
|
|
#include <gegl.h>
|
2000-12-16 21:37:03 +00:00
|
|
|
#include <gtk/gtk.h>
|
2000-05-25 07:50:44 +00:00
|
|
|
|
2005-05-22 20:57:23 +00:00
|
|
|
#include "libgimpbase/gimpbase.h"
|
2017-05-17 19:28:40 +02:00
|
|
|
#include "libgimpconfig/gimpconfig.h"
|
2001-01-23 23:56:18 +00:00
|
|
|
#include "libgimpcolor/gimpcolor.h"
|
2003-06-13 16:44:21 +00:00
|
|
|
#include "libgimpmath/gimpmath.h"
|
2001-05-08 19:29:15 +00:00
|
|
|
|
2002-10-20 10:14:17 +00:00
|
|
|
#include "gimpwidgetstypes.h"
|
1997-11-24 22:05:25 +00:00
|
|
|
|
2002-10-20 10:14:17 +00:00
|
|
|
#include "gimpcolorselector.h"
|
|
|
|
#include "gimpcolorselect.h"
|
2002-11-05 00:02:56 +00:00
|
|
|
#include "gimphelpui.h"
|
2015-12-12 20:44:46 +01:00
|
|
|
#include "gimpicons.h"
|
2017-05-17 19:28:40 +02:00
|
|
|
#include "gimpwidgetsutils.h"
|
2000-04-27 17:27:28 +00:00
|
|
|
|
2002-10-29 12:09:46 +00:00
|
|
|
#include "libgimp/libgimp-intl.h"
|
Lots of ii8n stuff here and some additions to the de.po. Applied
Wed Oct 14 17:46:15 EDT 1998 Adrian Likins <adrian@gimp.org>
* app/*, po/de.po, de/POTFILES.in, libgimp/gimpintl.h:
Lots of ii8n stuff here and some additions to the de.po.
Applied gimp-egger-981005-1 ,gimp-egger-981006-1,
gimp-egger-981007-1, gimp-egger-981008-1,
gimp-egger-981009-1.patch, gimp-egger-981010-1.patch
* plug-in/guillotine/guillotine.c: added the coordinates
of the split images from the original image to the title.
ie foo.jpg (0,0) for the image in the topleft.
* plug-in/script-fu/scripts/neon-logo.scm,
perspective-shadow.scm, predator.scm,rendermap.scm,
ripply-anim.scm, select_to_image.scm,swirltile.scm,
xach-effect.scm: updated scripts to use new script-fu stuff
wooo boy! a big un!
in testing this, it looks like some of the po files are busted.
but the code stuff seems okay.
-adrian
1998-10-14 23:23:52 +00:00
|
|
|
|
2000-04-27 17:27:28 +00:00
|
|
|
|
2010-07-05 18:01:28 +02:00
|
|
|
/**
|
|
|
|
* SECTION: gimpcolorselect
|
|
|
|
* @title: GimpColorSelect
|
|
|
|
* @short_description: A #GimpColorSelector implementation.
|
|
|
|
*
|
|
|
|
* The #GimpColorSelect widget is an implementation of a
|
2012-11-11 15:50:25 +01:00
|
|
|
* #GimpColorSelector. It shows a square area that supports
|
|
|
|
* interactively changing two color channels and a smaller area to
|
2010-07-05 18:01:28 +02:00
|
|
|
* change the third channel. You can select which channel should be
|
|
|
|
* the third by calling gimp_color_selector_set_channel(). The widget
|
|
|
|
* will then change the other two channels accordingly.
|
|
|
|
**/
|
|
|
|
|
|
|
|
|
2003-06-11 13:59:42 +00:00
|
|
|
#define COLOR_AREA_EVENT_MASK (GDK_EXPOSURE_MASK | \
|
|
|
|
GDK_BUTTON_PRESS_MASK | \
|
|
|
|
GDK_BUTTON_RELEASE_MASK | \
|
2004-09-10 13:16:55 +00:00
|
|
|
GDK_BUTTON_MOTION_MASK | \
|
2003-06-11 13:59:42 +00:00
|
|
|
GDK_ENTER_NOTIFY_MASK)
|
1997-11-24 22:05:25 +00:00
|
|
|
|
1999-10-03 13:50:19 +00:00
|
|
|
|
1999-08-23 23:05:46 +00:00
|
|
|
typedef enum
|
|
|
|
{
|
1999-10-28 15:05:49 +00:00
|
|
|
COLOR_SELECT_HUE = 0,
|
|
|
|
COLOR_SELECT_SATURATION,
|
|
|
|
COLOR_SELECT_VALUE,
|
2017-05-17 19:28:40 +02:00
|
|
|
|
1999-10-28 15:05:49 +00:00
|
|
|
COLOR_SELECT_RED,
|
|
|
|
COLOR_SELECT_GREEN,
|
|
|
|
COLOR_SELECT_BLUE,
|
2001-01-07 21:07:14 +00:00
|
|
|
COLOR_SELECT_ALPHA,
|
2017-05-17 19:28:40 +02:00
|
|
|
|
|
|
|
COLOR_SELECT_LCH_LIGHTNESS,
|
|
|
|
COLOR_SELECT_LCH_CHROMA,
|
|
|
|
COLOR_SELECT_LCH_HUE,
|
|
|
|
|
1999-10-28 15:05:49 +00:00
|
|
|
COLOR_SELECT_HUE_SATURATION,
|
|
|
|
COLOR_SELECT_HUE_VALUE,
|
|
|
|
COLOR_SELECT_SATURATION_VALUE,
|
2017-05-17 19:28:40 +02:00
|
|
|
|
1999-10-28 15:05:49 +00:00
|
|
|
COLOR_SELECT_RED_GREEN,
|
|
|
|
COLOR_SELECT_RED_BLUE,
|
2017-05-17 19:28:40 +02:00
|
|
|
COLOR_SELECT_GREEN_BLUE,
|
|
|
|
|
|
|
|
COLOR_SELECT_LCH_HUE_CHROMA,
|
|
|
|
COLOR_SELECT_LCH_HUE_LIGHTNESS,
|
|
|
|
COLOR_SELECT_LCH_CHROMA_LIGHTNESS
|
1997-11-24 22:05:25 +00:00
|
|
|
} ColorSelectFillType;
|
|
|
|
|
1999-08-23 23:05:46 +00:00
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
UPDATE_VALUES = 1 << 0,
|
|
|
|
UPDATE_POS = 1 << 1,
|
|
|
|
UPDATE_XY_COLOR = 1 << 2,
|
|
|
|
UPDATE_Z_COLOR = 1 << 3,
|
|
|
|
UPDATE_CALLER = 1 << 6
|
1997-11-24 22:05:25 +00:00
|
|
|
} ColorSelectUpdateType;
|
|
|
|
|
2009-06-01 22:55:43 +02:00
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
DRAG_NONE,
|
|
|
|
DRAG_XY,
|
|
|
|
DRAG_Z
|
|
|
|
} ColorSelectDragMode;
|
|
|
|
|
1999-10-03 13:50:19 +00:00
|
|
|
|
2017-05-17 19:28:40 +02:00
|
|
|
typedef struct _GimpLCH GimpLCH;
|
|
|
|
|
|
|
|
struct _GimpLCH
|
|
|
|
{
|
|
|
|
gdouble l, c, h, a;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2002-10-20 10:14:17 +00:00
|
|
|
#define GIMP_COLOR_SELECT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_COLOR_SELECT, GimpColorSelectClass))
|
|
|
|
#define GIMP_IS_COLOR_SELECT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_COLOR_SELECT))
|
|
|
|
#define GIMP_COLOR_SELECT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_COLOR_SELECT, GimpColorSelectClass))
|
|
|
|
|
|
|
|
|
2002-10-28 20:13:17 +00:00
|
|
|
typedef struct _GimpColorSelectClass GimpColorSelectClass;
|
2002-10-20 10:14:17 +00:00
|
|
|
|
|
|
|
struct _GimpColorSelect
|
1999-10-03 13:50:19 +00:00
|
|
|
{
|
2002-10-30 14:52:58 +00:00
|
|
|
GimpColorSelector parent_instance;
|
2002-10-20 10:14:17 +00:00
|
|
|
|
2018-01-21 01:51:18 +01:00
|
|
|
GtkWidget *toggle_box[3];
|
2002-11-05 00:02:56 +00:00
|
|
|
|
2002-10-30 14:52:58 +00:00
|
|
|
GtkWidget *xy_color;
|
2017-05-17 19:28:40 +02:00
|
|
|
ColorSelectFillType xy_color_fill;
|
|
|
|
guchar *xy_buf;
|
|
|
|
gint xy_width;
|
|
|
|
gint xy_height;
|
|
|
|
gint xy_rowstride;
|
|
|
|
gboolean xy_needs_render;
|
|
|
|
|
2002-10-30 14:52:58 +00:00
|
|
|
GtkWidget *z_color;
|
2017-05-17 19:28:40 +02:00
|
|
|
ColorSelectFillType z_color_fill;
|
|
|
|
guchar *z_buf;
|
|
|
|
gint z_width;
|
|
|
|
gint z_height;
|
|
|
|
gint z_rowstride;
|
|
|
|
gboolean z_needs_render;
|
2001-01-15 12:20:38 +00:00
|
|
|
|
2015-10-08 21:10:33 +02:00
|
|
|
gdouble pos[3];
|
2001-01-15 12:20:38 +00:00
|
|
|
|
2009-06-01 22:55:43 +02:00
|
|
|
ColorSelectDragMode drag_mode;
|
2017-05-17 19:28:40 +02:00
|
|
|
|
|
|
|
GimpColorConfig *config;
|
2023-12-17 16:09:43 +09:00
|
|
|
const Babl *format;
|
2017-05-17 19:28:40 +02:00
|
|
|
guchar oog_color[3];
|
2002-10-20 10:14:17 +00:00
|
|
|
};
|
1999-10-03 13:50:19 +00:00
|
|
|
|
2002-10-20 10:14:17 +00:00
|
|
|
struct _GimpColorSelectClass
|
|
|
|
{
|
|
|
|
GimpColorSelectorClass parent_class;
|
1999-10-03 13:50:19 +00:00
|
|
|
};
|
|
|
|
|
2002-10-20 10:14:17 +00:00
|
|
|
|
1997-11-24 22:05:25 +00:00
|
|
|
typedef struct _ColorSelectFill ColorSelectFill;
|
1999-08-23 23:05:46 +00:00
|
|
|
|
2017-05-17 19:28:40 +02:00
|
|
|
typedef void (* ColorSelectRenderFunc) (ColorSelectFill *color_select_fill);
|
1997-11-24 22:05:25 +00:00
|
|
|
|
1999-08-23 23:05:46 +00:00
|
|
|
struct _ColorSelectFill
|
|
|
|
{
|
2001-01-15 12:20:38 +00:00
|
|
|
guchar *buffer;
|
|
|
|
gint y;
|
|
|
|
gint width;
|
|
|
|
gint height;
|
app, libgimpwidgets, modules: color selectors are now partly space-invaded.
What this commit does is keep the same code logic while moving to
GeglColor. Yet it's not **really** space-invaded yet. What we need to do
now:
1. Take into account the image space, and this is what we must navigate
through, in particular for various representations of RGB or HSV.
I.e. that if the active image is in anyRGB, the RGB values shown must
be within anyRGB. Right now, everything is still shown/used as sRGB
(even though it's properly retrieved and transformed to the target
space thanks to GeglColor).
2. Show space info to make things clear and explicit, by adding some
label somewhere.
3. Allow to switch between image and softproof spaces, regarding
out-of-gamut display. I.e. that while RGB/HSV must be shown within
the image space (assuming it's anyRGB), we may want to show
out-of-gamut area (pink areas) within the softproof space. This may
mean adding a checkbox. Or maybe simply taking into account whether
we are in softproof mode or not?
4. We can likely move off gimp_widget_get_color_transform() into using
gimp_widget_get_render_space() for display drawing. We don't need any
soft-proofing or black point compensation for any of these widgets so
pure babl is fine. Indeed we want to show any in-gamut color
correctly (and not transformed according to specific intents or
through soft-proofing). We will take care of the proofing case with
out-of-gamut area showing only.
5. In the various drawing functions, we should move to
CAIRO_FORMAT_RGBA128F. The color selection area might be wide enough
that it makes sense to be more accurate, especially as we are
essentially showing color gradients in 1 or 2 directions in these
various widgets.
2023-12-12 17:01:17 +09:00
|
|
|
gdouble rgb[4];
|
|
|
|
gdouble hsv[4];
|
|
|
|
gdouble lch[4];
|
2017-05-17 19:28:40 +02:00
|
|
|
guchar oog_color[3];
|
1999-08-23 23:05:46 +00:00
|
|
|
|
2017-05-17 19:28:40 +02:00
|
|
|
ColorSelectRenderFunc render_line;
|
1997-11-24 22:05:25 +00:00
|
|
|
};
|
|
|
|
|
2001-01-08 02:24:29 +00:00
|
|
|
|
2017-05-17 19:28:40 +02:00
|
|
|
static void gimp_color_select_finalize (GObject *object);
|
|
|
|
|
2002-11-05 00:02:56 +00:00
|
|
|
static void gimp_color_select_togg_visible (GimpColorSelector *selector,
|
|
|
|
gboolean visible);
|
|
|
|
static void gimp_color_select_togg_sensitive (GimpColorSelector *selector,
|
|
|
|
gboolean sensitive);
|
|
|
|
static void gimp_color_select_set_color (GimpColorSelector *selector,
|
app, libgimpwidgets, modules: color selectors are now partly space-invaded.
What this commit does is keep the same code logic while moving to
GeglColor. Yet it's not **really** space-invaded yet. What we need to do
now:
1. Take into account the image space, and this is what we must navigate
through, in particular for various representations of RGB or HSV.
I.e. that if the active image is in anyRGB, the RGB values shown must
be within anyRGB. Right now, everything is still shown/used as sRGB
(even though it's properly retrieved and transformed to the target
space thanks to GeglColor).
2. Show space info to make things clear and explicit, by adding some
label somewhere.
3. Allow to switch between image and softproof spaces, regarding
out-of-gamut display. I.e. that while RGB/HSV must be shown within
the image space (assuming it's anyRGB), we may want to show
out-of-gamut area (pink areas) within the softproof space. This may
mean adding a checkbox. Or maybe simply taking into account whether
we are in softproof mode or not?
4. We can likely move off gimp_widget_get_color_transform() into using
gimp_widget_get_render_space() for display drawing. We don't need any
soft-proofing or black point compensation for any of these widgets so
pure babl is fine. Indeed we want to show any in-gamut color
correctly (and not transformed according to specific intents or
through soft-proofing). We will take care of the proofing case with
out-of-gamut area showing only.
5. In the various drawing functions, we should move to
CAIRO_FORMAT_RGBA128F. The color selection area might be wide enough
that it makes sense to be more accurate, especially as we are
essentially showing color gradients in 1 or 2 directions in these
various widgets.
2023-12-12 17:01:17 +09:00
|
|
|
GeglColor *color);
|
2002-11-05 00:02:56 +00:00
|
|
|
static void gimp_color_select_set_channel (GimpColorSelector *selector,
|
|
|
|
GimpColorSelectorChannel channel);
|
2018-03-19 22:58:03 +01:00
|
|
|
static void gimp_color_select_set_model_visible
|
|
|
|
(GimpColorSelector *selector,
|
|
|
|
GimpColorSelectorModel model,
|
|
|
|
gboolean visible);
|
2023-12-17 16:09:43 +09:00
|
|
|
static void gimp_color_select_set_format (GimpColorSelector *selector,
|
|
|
|
const Babl *format);
|
2016-05-26 22:23:29 +02:00
|
|
|
static void gimp_color_select_set_config (GimpColorSelector *selector,
|
|
|
|
GimpColorConfig *config);
|
2002-10-20 10:14:17 +00:00
|
|
|
|
2002-11-05 00:02:56 +00:00
|
|
|
static void gimp_color_select_channel_toggled (GtkWidget *widget,
|
|
|
|
GimpColorSelect *select);
|
2002-10-20 10:14:17 +00:00
|
|
|
|
2002-11-05 00:02:56 +00:00
|
|
|
static void gimp_color_select_update (GimpColorSelect *select,
|
|
|
|
ColorSelectUpdateType type);
|
|
|
|
static void gimp_color_select_update_values (GimpColorSelect *select);
|
|
|
|
static void gimp_color_select_update_pos (GimpColorSelect *select);
|
2002-10-20 10:14:17 +00:00
|
|
|
|
|
|
|
#if 0
|
2002-11-05 00:02:56 +00:00
|
|
|
static void gimp_color_select_drop_color (GtkWidget *widget,
|
2004-12-31 14:36:30 +00:00
|
|
|
gint x,
|
|
|
|
gint y,
|
2002-11-05 00:02:56 +00:00
|
|
|
const GimpRGB *color,
|
|
|
|
gpointer data);
|
2002-10-20 10:14:17 +00:00
|
|
|
#endif
|
|
|
|
|
2004-02-06 19:03:13 +00:00
|
|
|
static void gimp_color_select_xy_size_allocate (GtkWidget *widget,
|
|
|
|
GtkAllocation *allocation,
|
|
|
|
GimpColorSelect *select);
|
2010-10-19 21:10:48 +02:00
|
|
|
static gboolean gimp_color_select_xy_draw (GtkWidget *widget,
|
|
|
|
cairo_t *cr,
|
2002-11-05 00:02:56 +00:00
|
|
|
GimpColorSelect *select);
|
|
|
|
static gboolean gimp_color_select_xy_events (GtkWidget *widget,
|
|
|
|
GdkEvent *event,
|
|
|
|
GimpColorSelect *select);
|
2004-02-06 19:03:13 +00:00
|
|
|
static void gimp_color_select_z_size_allocate (GtkWidget *widget,
|
|
|
|
GtkAllocation *allocation,
|
|
|
|
GimpColorSelect *select);
|
2010-10-19 21:10:48 +02:00
|
|
|
static gboolean gimp_color_select_z_draw (GtkWidget *widget,
|
|
|
|
cairo_t *cr,
|
2002-11-05 00:02:56 +00:00
|
|
|
GimpColorSelect *select);
|
2016-06-25 22:54:10 +02:00
|
|
|
static gboolean gimp_color_select_z_events (GtkWidget *widget,
|
2002-11-05 00:02:56 +00:00
|
|
|
GdkEvent *event,
|
|
|
|
GimpColorSelect *select);
|
|
|
|
|
2017-05-17 19:28:40 +02:00
|
|
|
static void gimp_color_select_render (GtkWidget *widget,
|
|
|
|
guchar *buf,
|
|
|
|
gint width,
|
|
|
|
gint height,
|
|
|
|
gint rowstride,
|
2002-11-05 00:02:56 +00:00
|
|
|
ColorSelectFillType fill_type,
|
app, libgimpwidgets, modules: color selectors are now partly space-invaded.
What this commit does is keep the same code logic while moving to
GeglColor. Yet it's not **really** space-invaded yet. What we need to do
now:
1. Take into account the image space, and this is what we must navigate
through, in particular for various representations of RGB or HSV.
I.e. that if the active image is in anyRGB, the RGB values shown must
be within anyRGB. Right now, everything is still shown/used as sRGB
(even though it's properly retrieved and transformed to the target
space thanks to GeglColor).
2. Show space info to make things clear and explicit, by adding some
label somewhere.
3. Allow to switch between image and softproof spaces, regarding
out-of-gamut display. I.e. that while RGB/HSV must be shown within
the image space (assuming it's anyRGB), we may want to show
out-of-gamut area (pink areas) within the softproof space. This may
mean adding a checkbox. Or maybe simply taking into account whether
we are in softproof mode or not?
4. We can likely move off gimp_widget_get_color_transform() into using
gimp_widget_get_render_space() for display drawing. We don't need any
soft-proofing or black point compensation for any of these widgets so
pure babl is fine. Indeed we want to show any in-gamut color
correctly (and not transformed according to specific intents or
through soft-proofing). We will take care of the proofing case with
out-of-gamut area showing only.
5. In the various drawing functions, we should move to
CAIRO_FORMAT_RGBA128F. The color selection area might be wide enough
that it makes sense to be more accurate, especially as we are
essentially showing color gradients in 1 or 2 directions in these
various widgets.
2023-12-12 17:01:17 +09:00
|
|
|
GeglColor *color,
|
2017-05-17 19:28:40 +02:00
|
|
|
const guchar *oog_color);
|
|
|
|
|
|
|
|
static void color_select_render_red (ColorSelectFill *csf);
|
|
|
|
static void color_select_render_green (ColorSelectFill *csf);
|
|
|
|
static void color_select_render_blue (ColorSelectFill *csf);
|
|
|
|
|
|
|
|
static void color_select_render_hue (ColorSelectFill *csf);
|
|
|
|
static void color_select_render_saturation (ColorSelectFill *csf);
|
|
|
|
static void color_select_render_value (ColorSelectFill *csf);
|
|
|
|
|
|
|
|
static void color_select_render_lch_lightness (ColorSelectFill *csf);
|
|
|
|
static void color_select_render_lch_chroma (ColorSelectFill *csf);
|
|
|
|
static void color_select_render_lch_hue (ColorSelectFill *csf);
|
|
|
|
|
|
|
|
static void color_select_render_red_green (ColorSelectFill *csf);
|
|
|
|
static void color_select_render_red_blue (ColorSelectFill *csf);
|
|
|
|
static void color_select_render_green_blue (ColorSelectFill *csf);
|
|
|
|
|
|
|
|
static void color_select_render_hue_saturation (ColorSelectFill *csf);
|
|
|
|
static void color_select_render_hue_value (ColorSelectFill *csf);
|
|
|
|
static void color_select_render_saturation_value (ColorSelectFill *csf);
|
|
|
|
|
|
|
|
static void color_select_render_lch_chroma_lightness (ColorSelectFill *csf);
|
|
|
|
static void color_select_render_lch_hue_lightness (ColorSelectFill *csf);
|
|
|
|
static void color_select_render_lch_hue_chroma (ColorSelectFill *csf);
|
|
|
|
|
|
|
|
static void gimp_color_select_notify_config (GimpColorConfig *config,
|
|
|
|
const GParamSpec *pspec,
|
|
|
|
GimpColorSelect *select);
|
2001-01-15 12:20:38 +00:00
|
|
|
|
2002-10-20 10:14:17 +00:00
|
|
|
|
2006-05-15 09:46:31 +00:00
|
|
|
G_DEFINE_TYPE (GimpColorSelect, gimp_color_select, GIMP_TYPE_COLOR_SELECTOR)
|
2002-10-20 10:14:17 +00:00
|
|
|
|
2005-12-20 20:35:23 +00:00
|
|
|
#define parent_class gimp_color_select_parent_class
|
2002-10-20 10:14:17 +00:00
|
|
|
|
2017-05-17 19:28:40 +02:00
|
|
|
static const ColorSelectRenderFunc render_funcs[] =
|
1997-11-24 22:05:25 +00:00
|
|
|
{
|
2017-05-17 19:28:40 +02:00
|
|
|
color_select_render_hue,
|
|
|
|
color_select_render_saturation,
|
|
|
|
color_select_render_value,
|
|
|
|
|
|
|
|
color_select_render_red,
|
|
|
|
color_select_render_green,
|
|
|
|
color_select_render_blue,
|
2001-01-07 21:07:14 +00:00
|
|
|
NULL, /* alpha */
|
2017-05-17 19:28:40 +02:00
|
|
|
|
|
|
|
color_select_render_lch_lightness,
|
|
|
|
color_select_render_lch_chroma,
|
|
|
|
color_select_render_lch_hue,
|
|
|
|
|
|
|
|
color_select_render_hue_saturation,
|
|
|
|
color_select_render_hue_value,
|
|
|
|
color_select_render_saturation_value,
|
|
|
|
|
|
|
|
color_select_render_red_green,
|
|
|
|
color_select_render_red_blue,
|
|
|
|
color_select_render_green_blue,
|
|
|
|
|
|
|
|
color_select_render_lch_hue_chroma,
|
|
|
|
color_select_render_lch_hue_lightness,
|
|
|
|
color_select_render_lch_chroma_lightness
|
1997-11-24 22:05:25 +00:00
|
|
|
};
|
|
|
|
|
2017-05-17 19:28:40 +02:00
|
|
|
static const Babl *fish_lch_to_rgb = NULL;
|
|
|
|
static const Babl *fish_lch_to_rgb_u8 = NULL;
|
|
|
|
|
1997-11-24 22:05:25 +00:00
|
|
|
|
2002-10-20 10:14:17 +00:00
|
|
|
static void
|
|
|
|
gimp_color_select_class_init (GimpColorSelectClass *klass)
|
|
|
|
{
|
2017-05-17 19:28:40 +02:00
|
|
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
2004-07-13 14:55:16 +00:00
|
|
|
GimpColorSelectorClass *selector_class = GIMP_COLOR_SELECTOR_CLASS (klass);
|
2002-10-20 10:14:17 +00:00
|
|
|
|
2017-05-17 19:28:40 +02:00
|
|
|
object_class->finalize = gimp_color_select_finalize;
|
|
|
|
|
2003-07-19 01:43:51 +00:00
|
|
|
selector_class->name = "GIMP";
|
2003-11-18 23:44:35 +00:00
|
|
|
selector_class->help_id = "gimp-colorselector-gimp";
|
2017-03-05 16:01:59 +01:00
|
|
|
selector_class->icon_name = GIMP_ICON_WILBER;
|
2002-11-05 00:02:56 +00:00
|
|
|
selector_class->set_toggles_visible = gimp_color_select_togg_visible;
|
|
|
|
selector_class->set_toggles_sensitive = gimp_color_select_togg_sensitive;
|
|
|
|
selector_class->set_color = gimp_color_select_set_color;
|
|
|
|
selector_class->set_channel = gimp_color_select_set_channel;
|
2018-03-19 22:58:03 +01:00
|
|
|
selector_class->set_model_visible = gimp_color_select_set_model_visible;
|
2023-12-17 16:09:43 +09:00
|
|
|
selector_class->set_format = gimp_color_select_set_format;
|
2016-05-26 22:23:29 +02:00
|
|
|
selector_class->set_config = gimp_color_select_set_config;
|
2017-05-17 19:28:40 +02:00
|
|
|
|
2018-06-24 15:36:00 +02:00
|
|
|
gtk_widget_class_set_css_name (GTK_WIDGET_CLASS (klass), "GimpColorSelect");
|
|
|
|
|
2017-05-17 19:28:40 +02:00
|
|
|
fish_lch_to_rgb = babl_fish (babl_format ("CIE LCH(ab) double"),
|
|
|
|
babl_format ("R'G'B' double"));
|
|
|
|
fish_lch_to_rgb_u8 = babl_fish (babl_format ("CIE LCH(ab) double"),
|
|
|
|
babl_format ("R'G'B' u8"));
|
2002-10-20 10:14:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_color_select_init (GimpColorSelect *select)
|
Bit of a large checkin this - it's basically three things: 1 - GimpModules
Sun Jan 11 00:24:21 GMT 1999 Austin Donnelly <austin@greenend.org.uk>
Bit of a large checkin this - it's basically three things:
1 - GimpModules using gmodules to dynamically load and
initialise modules at gimp start of day.
2 - Color selectors now register themselves with a color
notebook.
3 - progress bars have been cleaned up a bit, so now have
progress indictations on all transform tool and gradient
fill operations. Not done bucket fill, but that seems to
be the next candidate.
New directories:
* modules/: new directory for dynamically loadable modules.
New files:
* modules/.cvsignore
* modules/Makefile.am
* modules/colorsel_gtk.c: GTK color selector wrapped up as a
color selector the gimp can use.
* app/gimpprogress.[ch]: progress bars within gimp core, either as
popups, or in the status bar. This is mainly code moved out
of plug-in.c
* app/color_notebook.[ch]: color selector notebook, implementing
very similar interface to color_select.h so it can be used as
a drop-in replacement for it.
* libgimp/color_selector.h: API color selectors need to implement
to become a page in the color_notebook.
* libgimp/gimpmodule.h: API gimp modules need to implement to be
initialised by gimp at start of day.
Modified files:
* Makefile.am: add modules/ to SUBDIRS
* libgimp/Makefile.am: install gimpmodule.h and color_selector.h
* app/gimprc.[ch]: recognise module-path variable.
* gimprc.in: set module-path variable to something sensible
(currently "${gimp_dir}/modules:${gimp_plugin_dir}/modules").
* app/Makefile.am: build color notebook and gimpprogress
* app/app_procs.c: register internal GIMP color selector with
color notebook.
* app/asupsample.c: call progress function less frequently for
better performance.
* app/asupsample.h: progress_func_t typedef moved to gimpprogress.h
* app/blend.c: make callbacks to a progress function
* app/color_area.c: use a color notebook rather than a color selector
* app/color_panel.c: ditto
* app/color_select.c: export color selector interface for notebook
* app/color_select.h: color_select_init() prototype
* app/flip_tool.c: flip the image every time, rather than every
second click.
* app/interface.c: move progress bar stuff out to
gimpprogress.c. Make the code actually work while we're at it.
* app/interface.h: move prototypes for progress functions out to
gimpprogress.h
* app/plug_in.c: load and initialise modules (if possible). Move
progress bar handling code out to gimpprogress.c
* app/plug_in.h: keep only a gimp_progress * for each plugin, not
a whole bunch of GtkWidgets.
* app/scale_tool.c
* app/rotate_tool.c
* app/shear_tool.c
* app/perspective_tool.c: progress bar during operation.
De-sensitise the dialog to discourage the user from running
two transforms in parallel.
* app/transform_core.c: recalculate grid coords when bounding box
changes. Only initialise the action area of the dialog once,
to avoid multiple "ok" / "reset" buttons appearing. Undraw
transform tool with correct matrix to get rid of handle
remains on screen. Call a progress function as we apply the
transform matrix. A few new i18n markups. Invalidate
floating selection marching ants after applying matrix.
* app/transform_core.h: transform_core_do() takes an optional
progress callback argument (and data).
* plug-ins/oilify/oilify.c: send progress bar updates after every
pixel region, not only if they processed a multiple of 5
pixels (which was quite unlikely, and therefore gave a jerky
progress indication).
1999-01-11 00:57:33 +00:00
|
|
|
{
|
2018-01-21 01:51:18 +01:00
|
|
|
GimpColorSelector *selector = GIMP_COLOR_SELECTOR (select);
|
|
|
|
GtkWidget *hbox;
|
|
|
|
GtkWidget *frame;
|
2018-03-19 22:58:03 +01:00
|
|
|
GtkWidget *vbox;
|
2018-01-21 01:51:18 +01:00
|
|
|
GEnumClass *model_class;
|
|
|
|
GEnumClass *channel_class;
|
2019-08-09 13:29:34 +02:00
|
|
|
const GimpEnumDesc *enum_desc;
|
2018-01-21 01:51:18 +01:00
|
|
|
GimpColorSelectorModel model;
|
2018-03-19 22:58:03 +01:00
|
|
|
GSList *group = NULL;
|
2018-01-21 01:51:18 +01:00
|
|
|
|
|
|
|
/* Default values. */
|
2002-10-20 10:14:17 +00:00
|
|
|
select->z_color_fill = COLOR_SELECT_HUE;
|
|
|
|
select->xy_color_fill = COLOR_SELECT_SATURATION_VALUE;
|
2009-06-01 22:55:43 +02:00
|
|
|
select->drag_mode = DRAG_NONE;
|
1997-11-24 22:05:25 +00:00
|
|
|
|
2011-09-30 10:50:50 +02:00
|
|
|
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4);
|
2004-02-06 19:03:13 +00:00
|
|
|
gtk_box_pack_start (GTK_BOX (select), hbox, TRUE, TRUE, 0);
|
2001-01-09 01:23:54 +00:00
|
|
|
gtk_widget_show (hbox);
|
|
|
|
|
1999-08-23 23:05:46 +00:00
|
|
|
/* The x/y component preview */
|
2004-02-06 19:03:13 +00:00
|
|
|
frame = gtk_frame_new (NULL);
|
|
|
|
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), frame, TRUE, TRUE, 0);
|
|
|
|
gtk_widget_show (frame);
|
1997-11-24 22:05:25 +00:00
|
|
|
|
2017-05-17 19:28:40 +02:00
|
|
|
select->xy_color = gtk_event_box_new ();
|
|
|
|
gtk_event_box_set_visible_window (GTK_EVENT_BOX (select->xy_color), FALSE);
|
2016-05-26 22:23:29 +02:00
|
|
|
g_object_add_weak_pointer (G_OBJECT (select->xy_color),
|
|
|
|
(gpointer) &select->xy_color);
|
2004-09-10 13:04:45 +00:00
|
|
|
gtk_widget_set_size_request (select->xy_color,
|
|
|
|
GIMP_COLOR_SELECTOR_SIZE,
|
|
|
|
GIMP_COLOR_SELECTOR_SIZE);
|
2003-06-11 13:59:42 +00:00
|
|
|
gtk_widget_set_events (select->xy_color, COLOR_AREA_EVENT_MASK);
|
2004-02-06 19:03:13 +00:00
|
|
|
gtk_container_add (GTK_CONTAINER (frame), select->xy_color);
|
2002-10-20 10:14:17 +00:00
|
|
|
gtk_widget_show (select->xy_color);
|
|
|
|
|
2005-05-27 13:05:26 +00:00
|
|
|
g_signal_connect (select->xy_color, "size-allocate",
|
2004-09-10 13:16:55 +00:00
|
|
|
G_CALLBACK (gimp_color_select_xy_size_allocate),
|
|
|
|
select);
|
2010-10-19 21:10:48 +02:00
|
|
|
g_signal_connect_after (select->xy_color, "draw",
|
|
|
|
G_CALLBACK (gimp_color_select_xy_draw),
|
2004-09-10 13:16:55 +00:00
|
|
|
select);
|
2003-01-05 22:07:10 +00:00
|
|
|
g_signal_connect (select->xy_color, "event",
|
2004-09-10 13:16:55 +00:00
|
|
|
G_CALLBACK (gimp_color_select_xy_events),
|
|
|
|
select);
|
2002-10-20 10:14:17 +00:00
|
|
|
|
|
|
|
#if 0
|
|
|
|
gimp_dnd_color_dest_add (select->xy_color, gimp_color_select_drop_color,
|
|
|
|
select);
|
|
|
|
#endif
|
1999-08-23 23:05:46 +00:00
|
|
|
|
|
|
|
/* The z component preview */
|
2004-02-06 19:03:13 +00:00
|
|
|
frame = gtk_frame_new (NULL);
|
|
|
|
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), frame, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (frame);
|
1997-11-24 22:05:25 +00:00
|
|
|
|
2017-05-17 19:28:40 +02:00
|
|
|
select->z_color = gtk_event_box_new ();
|
|
|
|
gtk_event_box_set_visible_window (GTK_EVENT_BOX (select->z_color), FALSE);
|
2016-05-26 22:23:29 +02:00
|
|
|
g_object_add_weak_pointer (G_OBJECT (select->z_color),
|
|
|
|
(gpointer) &select->z_color);
|
2004-09-10 13:04:45 +00:00
|
|
|
gtk_widget_set_size_request (select->z_color,
|
2005-05-24 10:48:47 +00:00
|
|
|
GIMP_COLOR_SELECTOR_BAR_SIZE, -1);
|
2003-06-11 13:59:42 +00:00
|
|
|
gtk_widget_set_events (select->z_color, COLOR_AREA_EVENT_MASK);
|
2004-02-06 19:03:13 +00:00
|
|
|
gtk_container_add (GTK_CONTAINER (frame), select->z_color);
|
2002-10-20 10:14:17 +00:00
|
|
|
gtk_widget_show (select->z_color);
|
|
|
|
|
2005-05-27 13:05:26 +00:00
|
|
|
g_signal_connect (select->z_color, "size-allocate",
|
2004-09-10 13:16:55 +00:00
|
|
|
G_CALLBACK (gimp_color_select_z_size_allocate),
|
|
|
|
select);
|
2010-10-19 21:10:48 +02:00
|
|
|
g_signal_connect_after (select->z_color, "draw",
|
|
|
|
G_CALLBACK (gimp_color_select_z_draw),
|
2004-09-10 13:16:55 +00:00
|
|
|
select);
|
2003-01-05 22:07:10 +00:00
|
|
|
g_signal_connect (select->z_color, "event",
|
2004-09-10 13:16:55 +00:00
|
|
|
G_CALLBACK (gimp_color_select_z_events),
|
|
|
|
select);
|
2002-11-05 00:02:56 +00:00
|
|
|
|
2018-03-19 22:58:03 +01:00
|
|
|
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
|
|
|
|
gtk_box_pack_start (GTK_BOX (hbox), vbox, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show (vbox);
|
2002-11-05 00:02:56 +00:00
|
|
|
|
2018-01-21 01:51:18 +01:00
|
|
|
model_class = g_type_class_ref (GIMP_TYPE_COLOR_SELECTOR_MODEL);
|
|
|
|
channel_class = g_type_class_ref (GIMP_TYPE_COLOR_SELECTOR_CHANNEL);
|
2002-11-05 00:02:56 +00:00
|
|
|
|
2018-03-19 22:58:03 +01:00
|
|
|
for (model = GIMP_COLOR_SELECTOR_MODEL_RGB;
|
|
|
|
model <= GIMP_COLOR_SELECTOR_MODEL_HSV;
|
2018-01-21 01:51:18 +01:00
|
|
|
model++)
|
|
|
|
{
|
|
|
|
enum_desc = gimp_enum_get_desc (model_class, model);
|
2002-11-05 00:02:56 +00:00
|
|
|
|
2018-01-21 01:51:18 +01:00
|
|
|
select->toggle_box[model] = gtk_box_new (GTK_ORIENTATION_VERTICAL, 2);
|
2018-03-19 22:58:03 +01:00
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), select->toggle_box[model],
|
|
|
|
FALSE, FALSE, 0);
|
2002-11-05 00:02:56 +00:00
|
|
|
|
2018-03-19 22:58:03 +01:00
|
|
|
if (gimp_color_selector_get_model_visible (selector, model))
|
|
|
|
gtk_widget_show (select->toggle_box[model]);
|
2002-11-05 00:02:56 +00:00
|
|
|
|
2018-01-21 01:51:18 +01:00
|
|
|
/* channel toggles */
|
2018-03-19 22:58:03 +01:00
|
|
|
{
|
|
|
|
GimpColorSelectorChannel channel = GIMP_COLOR_SELECTOR_RED;
|
|
|
|
GimpColorSelectorChannel end_channel;
|
|
|
|
|
|
|
|
switch (model)
|
|
|
|
{
|
|
|
|
case GIMP_COLOR_SELECTOR_MODEL_RGB:
|
|
|
|
channel = GIMP_COLOR_SELECTOR_RED;
|
|
|
|
break;
|
|
|
|
case GIMP_COLOR_SELECTOR_MODEL_LCH:
|
|
|
|
channel = GIMP_COLOR_SELECTOR_LCH_LIGHTNESS;
|
|
|
|
break;
|
|
|
|
case GIMP_COLOR_SELECTOR_MODEL_HSV:
|
|
|
|
channel = GIMP_COLOR_SELECTOR_HUE;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
/* Should not happen. */
|
|
|
|
g_return_if_reached ();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
end_channel = channel + 3;
|
|
|
|
|
|
|
|
for (; channel < end_channel; channel++)
|
|
|
|
{
|
|
|
|
GtkWidget *button;
|
|
|
|
|
|
|
|
enum_desc = gimp_enum_get_desc (channel_class, channel);
|
|
|
|
|
|
|
|
button = gtk_radio_button_new_with_mnemonic (group,
|
|
|
|
gettext (enum_desc->value_desc));
|
|
|
|
group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (button));
|
|
|
|
gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (button), FALSE);
|
|
|
|
gtk_box_pack_start (GTK_BOX (select->toggle_box[model]), button,
|
|
|
|
TRUE, TRUE, 0);
|
|
|
|
gtk_widget_show (button);
|
|
|
|
|
|
|
|
g_object_set_data (G_OBJECT (button), "channel",
|
|
|
|
GINT_TO_POINTER (channel));
|
|
|
|
|
|
|
|
if (channel == gimp_color_selector_get_channel (selector))
|
|
|
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
|
|
|
|
|
|
|
|
gimp_help_set_help_data (button, gettext (enum_desc->value_help),
|
|
|
|
NULL);
|
|
|
|
|
|
|
|
g_signal_connect (button, "toggled",
|
|
|
|
G_CALLBACK (gimp_color_select_channel_toggled),
|
|
|
|
select);
|
|
|
|
}
|
|
|
|
}
|
2018-01-21 01:51:18 +01:00
|
|
|
}
|
2002-11-05 00:02:56 +00:00
|
|
|
|
2018-01-21 01:51:18 +01:00
|
|
|
g_type_class_unref (model_class);
|
|
|
|
g_type_class_unref (channel_class);
|
Bit of a large checkin this - it's basically three things: 1 - GimpModules
Sun Jan 11 00:24:21 GMT 1999 Austin Donnelly <austin@greenend.org.uk>
Bit of a large checkin this - it's basically three things:
1 - GimpModules using gmodules to dynamically load and
initialise modules at gimp start of day.
2 - Color selectors now register themselves with a color
notebook.
3 - progress bars have been cleaned up a bit, so now have
progress indictations on all transform tool and gradient
fill operations. Not done bucket fill, but that seems to
be the next candidate.
New directories:
* modules/: new directory for dynamically loadable modules.
New files:
* modules/.cvsignore
* modules/Makefile.am
* modules/colorsel_gtk.c: GTK color selector wrapped up as a
color selector the gimp can use.
* app/gimpprogress.[ch]: progress bars within gimp core, either as
popups, or in the status bar. This is mainly code moved out
of plug-in.c
* app/color_notebook.[ch]: color selector notebook, implementing
very similar interface to color_select.h so it can be used as
a drop-in replacement for it.
* libgimp/color_selector.h: API color selectors need to implement
to become a page in the color_notebook.
* libgimp/gimpmodule.h: API gimp modules need to implement to be
initialised by gimp at start of day.
Modified files:
* Makefile.am: add modules/ to SUBDIRS
* libgimp/Makefile.am: install gimpmodule.h and color_selector.h
* app/gimprc.[ch]: recognise module-path variable.
* gimprc.in: set module-path variable to something sensible
(currently "${gimp_dir}/modules:${gimp_plugin_dir}/modules").
* app/Makefile.am: build color notebook and gimpprogress
* app/app_procs.c: register internal GIMP color selector with
color notebook.
* app/asupsample.c: call progress function less frequently for
better performance.
* app/asupsample.h: progress_func_t typedef moved to gimpprogress.h
* app/blend.c: make callbacks to a progress function
* app/color_area.c: use a color notebook rather than a color selector
* app/color_panel.c: ditto
* app/color_select.c: export color selector interface for notebook
* app/color_select.h: color_select_init() prototype
* app/flip_tool.c: flip the image every time, rather than every
second click.
* app/interface.c: move progress bar stuff out to
gimpprogress.c. Make the code actually work while we're at it.
* app/interface.h: move prototypes for progress functions out to
gimpprogress.h
* app/plug_in.c: load and initialise modules (if possible). Move
progress bar handling code out to gimpprogress.c
* app/plug_in.h: keep only a gimp_progress * for each plugin, not
a whole bunch of GtkWidgets.
* app/scale_tool.c
* app/rotate_tool.c
* app/shear_tool.c
* app/perspective_tool.c: progress bar during operation.
De-sensitise the dialog to discourage the user from running
two transforms in parallel.
* app/transform_core.c: recalculate grid coords when bounding box
changes. Only initialise the action area of the dialog once,
to avoid multiple "ok" / "reset" buttons appearing. Undraw
transform tool with correct matrix to get rid of handle
remains on screen. Call a progress function as we apply the
transform matrix. A few new i18n markups. Invalidate
floating selection marching ants after applying matrix.
* app/transform_core.h: transform_core_do() takes an optional
progress callback argument (and data).
* plug-ins/oilify/oilify.c: send progress bar updates after every
pixel region, not only if they processed a multiple of 5
pixels (which was quite unlikely, and therefore gave a jerky
progress indication).
1999-01-11 00:57:33 +00:00
|
|
|
}
|
1997-11-24 22:05:25 +00:00
|
|
|
|
2017-05-17 19:28:40 +02:00
|
|
|
static void
|
|
|
|
gimp_color_select_finalize (GObject *object)
|
|
|
|
{
|
|
|
|
GimpColorSelect *select = GIMP_COLOR_SELECT (object);
|
|
|
|
|
2017-09-03 15:14:51 +02:00
|
|
|
g_clear_pointer (&select->xy_buf, g_free);
|
|
|
|
select->xy_width = 0;
|
|
|
|
select->xy_height = 0;
|
|
|
|
select->xy_rowstride = 0;
|
|
|
|
|
|
|
|
g_clear_pointer (&select->z_buf, g_free);
|
|
|
|
select->z_width = 0;
|
|
|
|
select->z_height = 0;
|
|
|
|
select->z_rowstride = 0;
|
2017-05-17 19:28:40 +02:00
|
|
|
|
|
|
|
G_OBJECT_CLASS (parent_class)->finalize (object);
|
|
|
|
}
|
|
|
|
|
2002-11-05 00:02:56 +00:00
|
|
|
static void
|
|
|
|
gimp_color_select_togg_visible (GimpColorSelector *selector,
|
|
|
|
gboolean visible)
|
|
|
|
{
|
2004-07-13 14:55:16 +00:00
|
|
|
GimpColorSelect *select = GIMP_COLOR_SELECT (selector);
|
2018-01-21 01:51:18 +01:00
|
|
|
gint i;
|
2002-11-05 00:02:56 +00:00
|
|
|
|
2018-01-21 01:51:18 +01:00
|
|
|
for (i = 0; i < 3; i++)
|
|
|
|
{
|
|
|
|
gtk_widget_set_visible (select->toggle_box[i], visible);
|
|
|
|
}
|
2002-11-05 00:02:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_color_select_togg_sensitive (GimpColorSelector *selector,
|
|
|
|
gboolean sensitive)
|
|
|
|
{
|
2004-07-13 14:55:16 +00:00
|
|
|
GimpColorSelect *select = GIMP_COLOR_SELECT (selector);
|
2018-01-21 01:51:18 +01:00
|
|
|
gint i;
|
2002-11-05 00:02:56 +00:00
|
|
|
|
2018-01-21 01:51:18 +01:00
|
|
|
for (i = 0; i < 3; i++)
|
|
|
|
{
|
|
|
|
gtk_widget_set_sensitive (select->toggle_box[i], sensitive);
|
|
|
|
}
|
2002-11-05 00:02:56 +00:00
|
|
|
}
|
|
|
|
|
2002-10-20 10:14:17 +00:00
|
|
|
static void
|
|
|
|
gimp_color_select_set_color (GimpColorSelector *selector,
|
app, libgimpwidgets, modules: color selectors are now partly space-invaded.
What this commit does is keep the same code logic while moving to
GeglColor. Yet it's not **really** space-invaded yet. What we need to do
now:
1. Take into account the image space, and this is what we must navigate
through, in particular for various representations of RGB or HSV.
I.e. that if the active image is in anyRGB, the RGB values shown must
be within anyRGB. Right now, everything is still shown/used as sRGB
(even though it's properly retrieved and transformed to the target
space thanks to GeglColor).
2. Show space info to make things clear and explicit, by adding some
label somewhere.
3. Allow to switch between image and softproof spaces, regarding
out-of-gamut display. I.e. that while RGB/HSV must be shown within
the image space (assuming it's anyRGB), we may want to show
out-of-gamut area (pink areas) within the softproof space. This may
mean adding a checkbox. Or maybe simply taking into account whether
we are in softproof mode or not?
4. We can likely move off gimp_widget_get_color_transform() into using
gimp_widget_get_render_space() for display drawing. We don't need any
soft-proofing or black point compensation for any of these widgets so
pure babl is fine. Indeed we want to show any in-gamut color
correctly (and not transformed according to specific intents or
through soft-proofing). We will take care of the proofing case with
out-of-gamut area showing only.
5. In the various drawing functions, we should move to
CAIRO_FORMAT_RGBA128F. The color selection area might be wide enough
that it makes sense to be more accurate, especially as we are
essentially showing color gradients in 1 or 2 directions in these
various widgets.
2023-12-12 17:01:17 +09:00
|
|
|
GeglColor *color)
|
2002-10-20 10:14:17 +00:00
|
|
|
{
|
2004-07-13 14:55:16 +00:00
|
|
|
GimpColorSelect *select = GIMP_COLOR_SELECT (selector);
|
1999-08-23 23:05:46 +00:00
|
|
|
|
2002-11-05 00:02:56 +00:00
|
|
|
gimp_color_select_update (select,
|
|
|
|
UPDATE_POS | UPDATE_XY_COLOR | UPDATE_Z_COLOR);
|
1999-08-23 23:05:46 +00:00
|
|
|
}
|
|
|
|
|
1999-10-03 13:50:19 +00:00
|
|
|
static void
|
2002-10-20 10:14:17 +00:00
|
|
|
gimp_color_select_set_channel (GimpColorSelector *selector,
|
|
|
|
GimpColorSelectorChannel channel)
|
1997-11-24 22:05:25 +00:00
|
|
|
{
|
2004-07-13 14:55:16 +00:00
|
|
|
GimpColorSelect *select = GIMP_COLOR_SELECT (selector);
|
2002-10-20 10:14:17 +00:00
|
|
|
|
|
|
|
switch ((ColorSelectFillType) channel)
|
|
|
|
{
|
|
|
|
case COLOR_SELECT_HUE:
|
|
|
|
select->z_color_fill = COLOR_SELECT_HUE;
|
|
|
|
select->xy_color_fill = COLOR_SELECT_SATURATION_VALUE;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case COLOR_SELECT_SATURATION:
|
|
|
|
select->z_color_fill = COLOR_SELECT_SATURATION;
|
|
|
|
select->xy_color_fill = COLOR_SELECT_HUE_VALUE;
|
|
|
|
break;
|
1997-11-24 22:05:25 +00:00
|
|
|
|
2002-10-20 10:14:17 +00:00
|
|
|
case COLOR_SELECT_VALUE:
|
|
|
|
select->z_color_fill = COLOR_SELECT_VALUE;
|
|
|
|
select->xy_color_fill = COLOR_SELECT_HUE_SATURATION;
|
|
|
|
break;
|
2001-01-07 21:07:14 +00:00
|
|
|
|
2002-10-20 10:14:17 +00:00
|
|
|
case COLOR_SELECT_RED:
|
|
|
|
select->z_color_fill = COLOR_SELECT_RED;
|
|
|
|
select->xy_color_fill = COLOR_SELECT_GREEN_BLUE;
|
|
|
|
break;
|
2001-01-07 21:07:14 +00:00
|
|
|
|
2002-10-20 10:14:17 +00:00
|
|
|
case COLOR_SELECT_GREEN:
|
|
|
|
select->z_color_fill = COLOR_SELECT_GREEN;
|
|
|
|
select->xy_color_fill = COLOR_SELECT_RED_BLUE;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case COLOR_SELECT_BLUE:
|
|
|
|
select->z_color_fill = COLOR_SELECT_BLUE;
|
|
|
|
select->xy_color_fill = COLOR_SELECT_RED_GREEN;
|
|
|
|
break;
|
|
|
|
|
2017-05-17 19:28:40 +02:00
|
|
|
case COLOR_SELECT_LCH_LIGHTNESS:
|
|
|
|
select->z_color_fill = COLOR_SELECT_LCH_LIGHTNESS;
|
|
|
|
select->xy_color_fill = COLOR_SELECT_LCH_HUE_CHROMA;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case COLOR_SELECT_LCH_CHROMA:
|
|
|
|
select->z_color_fill = COLOR_SELECT_LCH_CHROMA;
|
|
|
|
select->xy_color_fill = COLOR_SELECT_LCH_HUE_LIGHTNESS;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case COLOR_SELECT_LCH_HUE:
|
|
|
|
select->z_color_fill = COLOR_SELECT_LCH_HUE;
|
|
|
|
select->xy_color_fill = COLOR_SELECT_LCH_CHROMA_LIGHTNESS;
|
|
|
|
break;
|
|
|
|
|
2002-10-20 10:14:17 +00:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2002-11-05 00:02:56 +00:00
|
|
|
gimp_color_select_update (select,
|
|
|
|
UPDATE_POS | UPDATE_Z_COLOR | UPDATE_XY_COLOR);
|
|
|
|
}
|
|
|
|
|
2018-03-19 22:58:03 +01:00
|
|
|
static void
|
|
|
|
gimp_color_select_set_model_visible (GimpColorSelector *selector,
|
|
|
|
GimpColorSelectorModel model,
|
|
|
|
gboolean visible)
|
|
|
|
{
|
|
|
|
GimpColorSelect *select = GIMP_COLOR_SELECT (selector);
|
|
|
|
|
|
|
|
gtk_widget_set_visible (select->toggle_box[model], visible);
|
|
|
|
}
|
|
|
|
|
2023-12-17 16:09:43 +09:00
|
|
|
static void
|
|
|
|
gimp_color_select_set_format (GimpColorSelector *selector,
|
|
|
|
const Babl *format)
|
|
|
|
{
|
|
|
|
GimpColorSelect *select = GIMP_COLOR_SELECT (selector);
|
|
|
|
|
|
|
|
if (select->format != format)
|
|
|
|
{
|
|
|
|
select->format = format;
|
|
|
|
|
|
|
|
fish_lch_to_rgb = babl_fish (babl_format ("CIE LCH(ab) double"),
|
|
|
|
babl_format_with_space ("R'G'B' double", format));
|
|
|
|
fish_lch_to_rgb_u8 = babl_fish (babl_format ("CIE LCH(ab) double"),
|
|
|
|
babl_format_with_space ("R'G'B' u8", format));
|
|
|
|
|
|
|
|
select->xy_needs_render = TRUE;
|
|
|
|
select->z_needs_render = TRUE;
|
|
|
|
|
|
|
|
gtk_widget_queue_draw (select->xy_color);
|
|
|
|
gtk_widget_queue_draw (select->z_color);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-05-26 22:23:29 +02:00
|
|
|
static void
|
|
|
|
gimp_color_select_set_config (GimpColorSelector *selector,
|
|
|
|
GimpColorConfig *config)
|
|
|
|
{
|
|
|
|
GimpColorSelect *select = GIMP_COLOR_SELECT (selector);
|
|
|
|
|
2017-05-17 19:28:40 +02:00
|
|
|
if (config != select->config)
|
|
|
|
{
|
|
|
|
if (select->config)
|
|
|
|
{
|
|
|
|
g_signal_handlers_disconnect_by_func (select->config,
|
|
|
|
gimp_color_select_notify_config,
|
|
|
|
select);
|
|
|
|
}
|
|
|
|
|
2018-06-01 12:59:52 +02:00
|
|
|
g_set_object (&select->config, config);
|
2017-05-17 19:28:40 +02:00
|
|
|
|
|
|
|
if (select->config)
|
|
|
|
{
|
|
|
|
g_signal_connect (select->config, "notify",
|
|
|
|
G_CALLBACK (gimp_color_select_notify_config),
|
|
|
|
select);
|
|
|
|
|
|
|
|
gimp_color_select_notify_config (select->config, NULL, select);
|
|
|
|
}
|
|
|
|
}
|
2016-05-26 22:23:29 +02:00
|
|
|
}
|
|
|
|
|
2002-11-05 00:02:56 +00:00
|
|
|
static void
|
|
|
|
gimp_color_select_channel_toggled (GtkWidget *widget,
|
|
|
|
GimpColorSelect *select)
|
|
|
|
{
|
2008-06-28 15:09:46 +00:00
|
|
|
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)))
|
2002-11-05 00:02:56 +00:00
|
|
|
{
|
2004-07-13 14:55:16 +00:00
|
|
|
GimpColorSelector *selector = GIMP_COLOR_SELECTOR (select);
|
2002-11-05 00:02:56 +00:00
|
|
|
GimpColorSelectorChannel channel;
|
|
|
|
|
|
|
|
channel = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (widget),
|
|
|
|
"channel"));
|
|
|
|
|
2017-12-31 19:04:17 +01:00
|
|
|
gimp_color_selector_set_channel (selector, channel);
|
2002-11-05 00:02:56 +00:00
|
|
|
}
|
1997-11-24 22:05:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2002-10-20 10:14:17 +00:00
|
|
|
gimp_color_select_update (GimpColorSelect *select,
|
|
|
|
ColorSelectUpdateType update)
|
1997-11-24 22:05:25 +00:00
|
|
|
{
|
2001-01-07 21:07:14 +00:00
|
|
|
if (update & UPDATE_POS)
|
2002-10-20 10:14:17 +00:00
|
|
|
gimp_color_select_update_pos (select);
|
1997-11-24 22:05:25 +00:00
|
|
|
|
2001-01-07 21:07:14 +00:00
|
|
|
if (update & UPDATE_VALUES)
|
2002-10-20 10:14:17 +00:00
|
|
|
gimp_color_select_update_values (select);
|
1997-11-24 22:05:25 +00:00
|
|
|
|
2001-01-07 21:07:14 +00:00
|
|
|
if (update & UPDATE_XY_COLOR)
|
|
|
|
{
|
2017-05-17 19:28:40 +02:00
|
|
|
select->xy_needs_render = TRUE;
|
2002-10-20 10:14:17 +00:00
|
|
|
gtk_widget_queue_draw (select->xy_color);
|
2001-01-07 21:07:14 +00:00
|
|
|
}
|
1997-11-24 22:05:25 +00:00
|
|
|
|
2001-01-07 21:07:14 +00:00
|
|
|
if (update & UPDATE_Z_COLOR)
|
|
|
|
{
|
2017-05-17 19:28:40 +02:00
|
|
|
select->z_needs_render = TRUE;
|
2002-10-20 10:14:17 +00:00
|
|
|
gtk_widget_queue_draw (select->z_color);
|
1997-11-24 22:05:25 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2002-10-20 10:14:17 +00:00
|
|
|
gimp_color_select_update_values (GimpColorSelect *select)
|
1997-11-24 22:05:25 +00:00
|
|
|
{
|
2004-02-06 19:03:13 +00:00
|
|
|
GimpColorSelector *selector = GIMP_COLOR_SELECTOR (select);
|
app, libgimpwidgets, modules: color selectors are now partly space-invaded.
What this commit does is keep the same code logic while moving to
GeglColor. Yet it's not **really** space-invaded yet. What we need to do
now:
1. Take into account the image space, and this is what we must navigate
through, in particular for various representations of RGB or HSV.
I.e. that if the active image is in anyRGB, the RGB values shown must
be within anyRGB. Right now, everything is still shown/used as sRGB
(even though it's properly retrieved and transformed to the target
space thanks to GeglColor).
2. Show space info to make things clear and explicit, by adding some
label somewhere.
3. Allow to switch between image and softproof spaces, regarding
out-of-gamut display. I.e. that while RGB/HSV must be shown within
the image space (assuming it's anyRGB), we may want to show
out-of-gamut area (pink areas) within the softproof space. This may
mean adding a checkbox. Or maybe simply taking into account whether
we are in softproof mode or not?
4. We can likely move off gimp_widget_get_color_transform() into using
gimp_widget_get_render_space() for display drawing. We don't need any
soft-proofing or black point compensation for any of these widgets so
pure babl is fine. Indeed we want to show any in-gamut color
correctly (and not transformed according to specific intents or
through soft-proofing). We will take care of the proofing case with
out-of-gamut area showing only.
5. In the various drawing functions, we should move to
CAIRO_FORMAT_RGBA128F. The color selection area might be wide enough
that it makes sense to be more accurate, especially as we are
essentially showing color gradients in 1 or 2 directions in these
various widgets.
2023-12-12 17:01:17 +09:00
|
|
|
GeglColor *color = gimp_color_selector_get_color (selector);
|
|
|
|
gdouble values[3];
|
|
|
|
const Babl *rgb_format;
|
2023-12-17 16:09:43 +09:00
|
|
|
const Babl *hsv_format;
|
app, libgimpwidgets, modules: color selectors are now partly space-invaded.
What this commit does is keep the same code logic while moving to
GeglColor. Yet it's not **really** space-invaded yet. What we need to do
now:
1. Take into account the image space, and this is what we must navigate
through, in particular for various representations of RGB or HSV.
I.e. that if the active image is in anyRGB, the RGB values shown must
be within anyRGB. Right now, everything is still shown/used as sRGB
(even though it's properly retrieved and transformed to the target
space thanks to GeglColor).
2. Show space info to make things clear and explicit, by adding some
label somewhere.
3. Allow to switch between image and softproof spaces, regarding
out-of-gamut display. I.e. that while RGB/HSV must be shown within
the image space (assuming it's anyRGB), we may want to show
out-of-gamut area (pink areas) within the softproof space. This may
mean adding a checkbox. Or maybe simply taking into account whether
we are in softproof mode or not?
4. We can likely move off gimp_widget_get_color_transform() into using
gimp_widget_get_render_space() for display drawing. We don't need any
soft-proofing or black point compensation for any of these widgets so
pure babl is fine. Indeed we want to show any in-gamut color
correctly (and not transformed according to specific intents or
through soft-proofing). We will take care of the proofing case with
out-of-gamut area showing only.
5. In the various drawing functions, we should move to
CAIRO_FORMAT_RGBA128F. The color selection area might be wide enough
that it makes sense to be more accurate, especially as we are
essentially showing color gradients in 1 or 2 directions in these
various widgets.
2023-12-12 17:01:17 +09:00
|
|
|
|
2023-12-17 16:09:43 +09:00
|
|
|
rgb_format = babl_format_with_space ("R'G'B' double", select->format);
|
|
|
|
hsv_format = babl_format_with_space ("HSV double", select->format);
|
2002-10-28 20:13:17 +00:00
|
|
|
|
2002-10-20 10:14:17 +00:00
|
|
|
switch (select->z_color_fill)
|
1997-11-24 22:05:25 +00:00
|
|
|
{
|
2001-01-07 21:07:14 +00:00
|
|
|
case COLOR_SELECT_RED:
|
app, libgimpwidgets, modules: color selectors are now partly space-invaded.
What this commit does is keep the same code logic while moving to
GeglColor. Yet it's not **really** space-invaded yet. What we need to do
now:
1. Take into account the image space, and this is what we must navigate
through, in particular for various representations of RGB or HSV.
I.e. that if the active image is in anyRGB, the RGB values shown must
be within anyRGB. Right now, everything is still shown/used as sRGB
(even though it's properly retrieved and transformed to the target
space thanks to GeglColor).
2. Show space info to make things clear and explicit, by adding some
label somewhere.
3. Allow to switch between image and softproof spaces, regarding
out-of-gamut display. I.e. that while RGB/HSV must be shown within
the image space (assuming it's anyRGB), we may want to show
out-of-gamut area (pink areas) within the softproof space. This may
mean adding a checkbox. Or maybe simply taking into account whether
we are in softproof mode or not?
4. We can likely move off gimp_widget_get_color_transform() into using
gimp_widget_get_render_space() for display drawing. We don't need any
soft-proofing or black point compensation for any of these widgets so
pure babl is fine. Indeed we want to show any in-gamut color
correctly (and not transformed according to specific intents or
through soft-proofing). We will take care of the proofing case with
out-of-gamut area showing only.
5. In the various drawing functions, we should move to
CAIRO_FORMAT_RGBA128F. The color selection area might be wide enough
that it makes sense to be more accurate, especially as we are
essentially showing color gradients in 1 or 2 directions in these
various widgets.
2023-12-12 17:01:17 +09:00
|
|
|
values[0] = select->pos[2];
|
|
|
|
values[1] = select->pos[0];
|
|
|
|
values[2] = select->pos[1];
|
|
|
|
gegl_color_set_pixel (color, rgb_format, values);
|
2001-01-07 21:07:14 +00:00
|
|
|
break;
|
|
|
|
case COLOR_SELECT_GREEN:
|
app, libgimpwidgets, modules: color selectors are now partly space-invaded.
What this commit does is keep the same code logic while moving to
GeglColor. Yet it's not **really** space-invaded yet. What we need to do
now:
1. Take into account the image space, and this is what we must navigate
through, in particular for various representations of RGB or HSV.
I.e. that if the active image is in anyRGB, the RGB values shown must
be within anyRGB. Right now, everything is still shown/used as sRGB
(even though it's properly retrieved and transformed to the target
space thanks to GeglColor).
2. Show space info to make things clear and explicit, by adding some
label somewhere.
3. Allow to switch between image and softproof spaces, regarding
out-of-gamut display. I.e. that while RGB/HSV must be shown within
the image space (assuming it's anyRGB), we may want to show
out-of-gamut area (pink areas) within the softproof space. This may
mean adding a checkbox. Or maybe simply taking into account whether
we are in softproof mode or not?
4. We can likely move off gimp_widget_get_color_transform() into using
gimp_widget_get_render_space() for display drawing. We don't need any
soft-proofing or black point compensation for any of these widgets so
pure babl is fine. Indeed we want to show any in-gamut color
correctly (and not transformed according to specific intents or
through soft-proofing). We will take care of the proofing case with
out-of-gamut area showing only.
5. In the various drawing functions, we should move to
CAIRO_FORMAT_RGBA128F. The color selection area might be wide enough
that it makes sense to be more accurate, especially as we are
essentially showing color gradients in 1 or 2 directions in these
various widgets.
2023-12-12 17:01:17 +09:00
|
|
|
values[0] = select->pos[0];
|
|
|
|
values[1] = select->pos[2];
|
|
|
|
values[2] = select->pos[1];
|
|
|
|
gegl_color_set_pixel (color, rgb_format, values);
|
2001-01-07 21:07:14 +00:00
|
|
|
break;
|
|
|
|
case COLOR_SELECT_BLUE:
|
app, libgimpwidgets, modules: color selectors are now partly space-invaded.
What this commit does is keep the same code logic while moving to
GeglColor. Yet it's not **really** space-invaded yet. What we need to do
now:
1. Take into account the image space, and this is what we must navigate
through, in particular for various representations of RGB or HSV.
I.e. that if the active image is in anyRGB, the RGB values shown must
be within anyRGB. Right now, everything is still shown/used as sRGB
(even though it's properly retrieved and transformed to the target
space thanks to GeglColor).
2. Show space info to make things clear and explicit, by adding some
label somewhere.
3. Allow to switch between image and softproof spaces, regarding
out-of-gamut display. I.e. that while RGB/HSV must be shown within
the image space (assuming it's anyRGB), we may want to show
out-of-gamut area (pink areas) within the softproof space. This may
mean adding a checkbox. Or maybe simply taking into account whether
we are in softproof mode or not?
4. We can likely move off gimp_widget_get_color_transform() into using
gimp_widget_get_render_space() for display drawing. We don't need any
soft-proofing or black point compensation for any of these widgets so
pure babl is fine. Indeed we want to show any in-gamut color
correctly (and not transformed according to specific intents or
through soft-proofing). We will take care of the proofing case with
out-of-gamut area showing only.
5. In the various drawing functions, we should move to
CAIRO_FORMAT_RGBA128F. The color selection area might be wide enough
that it makes sense to be more accurate, especially as we are
essentially showing color gradients in 1 or 2 directions in these
various widgets.
2023-12-12 17:01:17 +09:00
|
|
|
gegl_color_set_pixel (color, rgb_format, select->pos);
|
2001-01-07 21:07:14 +00:00
|
|
|
break;
|
2001-01-15 12:20:38 +00:00
|
|
|
|
2001-01-07 21:07:14 +00:00
|
|
|
case COLOR_SELECT_HUE:
|
app, libgimpwidgets, modules: color selectors are now partly space-invaded.
What this commit does is keep the same code logic while moving to
GeglColor. Yet it's not **really** space-invaded yet. What we need to do
now:
1. Take into account the image space, and this is what we must navigate
through, in particular for various representations of RGB or HSV.
I.e. that if the active image is in anyRGB, the RGB values shown must
be within anyRGB. Right now, everything is still shown/used as sRGB
(even though it's properly retrieved and transformed to the target
space thanks to GeglColor).
2. Show space info to make things clear and explicit, by adding some
label somewhere.
3. Allow to switch between image and softproof spaces, regarding
out-of-gamut display. I.e. that while RGB/HSV must be shown within
the image space (assuming it's anyRGB), we may want to show
out-of-gamut area (pink areas) within the softproof space. This may
mean adding a checkbox. Or maybe simply taking into account whether
we are in softproof mode or not?
4. We can likely move off gimp_widget_get_color_transform() into using
gimp_widget_get_render_space() for display drawing. We don't need any
soft-proofing or black point compensation for any of these widgets so
pure babl is fine. Indeed we want to show any in-gamut color
correctly (and not transformed according to specific intents or
through soft-proofing). We will take care of the proofing case with
out-of-gamut area showing only.
5. In the various drawing functions, we should move to
CAIRO_FORMAT_RGBA128F. The color selection area might be wide enough
that it makes sense to be more accurate, especially as we are
essentially showing color gradients in 1 or 2 directions in these
various widgets.
2023-12-12 17:01:17 +09:00
|
|
|
values[0] = select->pos[2];
|
|
|
|
values[1] = select->pos[0];
|
|
|
|
values[2] = select->pos[1];
|
2023-12-17 16:09:43 +09:00
|
|
|
gegl_color_set_pixel (color, hsv_format, values);
|
2001-01-07 21:07:14 +00:00
|
|
|
break;
|
|
|
|
case COLOR_SELECT_SATURATION:
|
app, libgimpwidgets, modules: color selectors are now partly space-invaded.
What this commit does is keep the same code logic while moving to
GeglColor. Yet it's not **really** space-invaded yet. What we need to do
now:
1. Take into account the image space, and this is what we must navigate
through, in particular for various representations of RGB or HSV.
I.e. that if the active image is in anyRGB, the RGB values shown must
be within anyRGB. Right now, everything is still shown/used as sRGB
(even though it's properly retrieved and transformed to the target
space thanks to GeglColor).
2. Show space info to make things clear and explicit, by adding some
label somewhere.
3. Allow to switch between image and softproof spaces, regarding
out-of-gamut display. I.e. that while RGB/HSV must be shown within
the image space (assuming it's anyRGB), we may want to show
out-of-gamut area (pink areas) within the softproof space. This may
mean adding a checkbox. Or maybe simply taking into account whether
we are in softproof mode or not?
4. We can likely move off gimp_widget_get_color_transform() into using
gimp_widget_get_render_space() for display drawing. We don't need any
soft-proofing or black point compensation for any of these widgets so
pure babl is fine. Indeed we want to show any in-gamut color
correctly (and not transformed according to specific intents or
through soft-proofing). We will take care of the proofing case with
out-of-gamut area showing only.
5. In the various drawing functions, we should move to
CAIRO_FORMAT_RGBA128F. The color selection area might be wide enough
that it makes sense to be more accurate, especially as we are
essentially showing color gradients in 1 or 2 directions in these
various widgets.
2023-12-12 17:01:17 +09:00
|
|
|
values[0] = select->pos[0];
|
|
|
|
values[1] = select->pos[2];
|
|
|
|
values[2] = select->pos[1];
|
2023-12-17 16:09:43 +09:00
|
|
|
gegl_color_set_pixel (color, hsv_format, values);
|
2001-01-07 21:07:14 +00:00
|
|
|
break;
|
|
|
|
case COLOR_SELECT_VALUE:
|
2023-12-17 16:09:43 +09:00
|
|
|
gegl_color_set_pixel (color, hsv_format, select->pos);
|
2001-01-07 21:07:14 +00:00
|
|
|
break;
|
2002-10-30 14:52:58 +00:00
|
|
|
|
2017-05-17 19:28:40 +02:00
|
|
|
case COLOR_SELECT_LCH_LIGHTNESS:
|
app, libgimpwidgets, modules: color selectors are now partly space-invaded.
What this commit does is keep the same code logic while moving to
GeglColor. Yet it's not **really** space-invaded yet. What we need to do
now:
1. Take into account the image space, and this is what we must navigate
through, in particular for various representations of RGB or HSV.
I.e. that if the active image is in anyRGB, the RGB values shown must
be within anyRGB. Right now, everything is still shown/used as sRGB
(even though it's properly retrieved and transformed to the target
space thanks to GeglColor).
2. Show space info to make things clear and explicit, by adding some
label somewhere.
3. Allow to switch between image and softproof spaces, regarding
out-of-gamut display. I.e. that while RGB/HSV must be shown within
the image space (assuming it's anyRGB), we may want to show
out-of-gamut area (pink areas) within the softproof space. This may
mean adding a checkbox. Or maybe simply taking into account whether
we are in softproof mode or not?
4. We can likely move off gimp_widget_get_color_transform() into using
gimp_widget_get_render_space() for display drawing. We don't need any
soft-proofing or black point compensation for any of these widgets so
pure babl is fine. Indeed we want to show any in-gamut color
correctly (and not transformed according to specific intents or
through soft-proofing). We will take care of the proofing case with
out-of-gamut area showing only.
5. In the various drawing functions, we should move to
CAIRO_FORMAT_RGBA128F. The color selection area might be wide enough
that it makes sense to be more accurate, especially as we are
essentially showing color gradients in 1 or 2 directions in these
various widgets.
2023-12-12 17:01:17 +09:00
|
|
|
values[0] = select->pos[2] * 100.0;
|
|
|
|
values[1] = select->pos[1] * 200.0;
|
|
|
|
values[2] = select->pos[0] * 360.0;
|
|
|
|
gegl_color_set_pixel (color, babl_format ("CIE LCH(ab) double"), values);
|
2017-05-17 19:28:40 +02:00
|
|
|
break;
|
|
|
|
case COLOR_SELECT_LCH_CHROMA:
|
app, libgimpwidgets, modules: color selectors are now partly space-invaded.
What this commit does is keep the same code logic while moving to
GeglColor. Yet it's not **really** space-invaded yet. What we need to do
now:
1. Take into account the image space, and this is what we must navigate
through, in particular for various representations of RGB or HSV.
I.e. that if the active image is in anyRGB, the RGB values shown must
be within anyRGB. Right now, everything is still shown/used as sRGB
(even though it's properly retrieved and transformed to the target
space thanks to GeglColor).
2. Show space info to make things clear and explicit, by adding some
label somewhere.
3. Allow to switch between image and softproof spaces, regarding
out-of-gamut display. I.e. that while RGB/HSV must be shown within
the image space (assuming it's anyRGB), we may want to show
out-of-gamut area (pink areas) within the softproof space. This may
mean adding a checkbox. Or maybe simply taking into account whether
we are in softproof mode or not?
4. We can likely move off gimp_widget_get_color_transform() into using
gimp_widget_get_render_space() for display drawing. We don't need any
soft-proofing or black point compensation for any of these widgets so
pure babl is fine. Indeed we want to show any in-gamut color
correctly (and not transformed according to specific intents or
through soft-proofing). We will take care of the proofing case with
out-of-gamut area showing only.
5. In the various drawing functions, we should move to
CAIRO_FORMAT_RGBA128F. The color selection area might be wide enough
that it makes sense to be more accurate, especially as we are
essentially showing color gradients in 1 or 2 directions in these
various widgets.
2023-12-12 17:01:17 +09:00
|
|
|
values[0] = select->pos[1] * 100.0;
|
|
|
|
values[1] = select->pos[2] * 200.0;
|
|
|
|
values[2] = select->pos[0] * 360.0;
|
|
|
|
gegl_color_set_pixel (color, babl_format ("CIE LCH(ab) double"), values);
|
2017-05-17 19:28:40 +02:00
|
|
|
break;
|
|
|
|
case COLOR_SELECT_LCH_HUE:
|
app, libgimpwidgets, modules: color selectors are now partly space-invaded.
What this commit does is keep the same code logic while moving to
GeglColor. Yet it's not **really** space-invaded yet. What we need to do
now:
1. Take into account the image space, and this is what we must navigate
through, in particular for various representations of RGB or HSV.
I.e. that if the active image is in anyRGB, the RGB values shown must
be within anyRGB. Right now, everything is still shown/used as sRGB
(even though it's properly retrieved and transformed to the target
space thanks to GeglColor).
2. Show space info to make things clear and explicit, by adding some
label somewhere.
3. Allow to switch between image and softproof spaces, regarding
out-of-gamut display. I.e. that while RGB/HSV must be shown within
the image space (assuming it's anyRGB), we may want to show
out-of-gamut area (pink areas) within the softproof space. This may
mean adding a checkbox. Or maybe simply taking into account whether
we are in softproof mode or not?
4. We can likely move off gimp_widget_get_color_transform() into using
gimp_widget_get_render_space() for display drawing. We don't need any
soft-proofing or black point compensation for any of these widgets so
pure babl is fine. Indeed we want to show any in-gamut color
correctly (and not transformed according to specific intents or
through soft-proofing). We will take care of the proofing case with
out-of-gamut area showing only.
5. In the various drawing functions, we should move to
CAIRO_FORMAT_RGBA128F. The color selection area might be wide enough
that it makes sense to be more accurate, especially as we are
essentially showing color gradients in 1 or 2 directions in these
various widgets.
2023-12-12 17:01:17 +09:00
|
|
|
values[0] = select->pos[1] * 100.0;
|
|
|
|
values[1] = select->pos[0] * 200.0;
|
|
|
|
values[2] = select->pos[2] * 360.0;
|
|
|
|
gegl_color_set_pixel (color, babl_format ("CIE LCH(ab) double"), values);
|
2017-05-17 19:28:40 +02:00
|
|
|
break;
|
|
|
|
|
2002-10-30 14:52:58 +00:00
|
|
|
default:
|
|
|
|
break;
|
2001-01-07 21:07:14 +00:00
|
|
|
}
|
1997-11-24 22:05:25 +00:00
|
|
|
|
app, libgimpwidgets, modules: color selectors are now partly space-invaded.
What this commit does is keep the same code logic while moving to
GeglColor. Yet it's not **really** space-invaded yet. What we need to do
now:
1. Take into account the image space, and this is what we must navigate
through, in particular for various representations of RGB or HSV.
I.e. that if the active image is in anyRGB, the RGB values shown must
be within anyRGB. Right now, everything is still shown/used as sRGB
(even though it's properly retrieved and transformed to the target
space thanks to GeglColor).
2. Show space info to make things clear and explicit, by adding some
label somewhere.
3. Allow to switch between image and softproof spaces, regarding
out-of-gamut display. I.e. that while RGB/HSV must be shown within
the image space (assuming it's anyRGB), we may want to show
out-of-gamut area (pink areas) within the softproof space. This may
mean adding a checkbox. Or maybe simply taking into account whether
we are in softproof mode or not?
4. We can likely move off gimp_widget_get_color_transform() into using
gimp_widget_get_render_space() for display drawing. We don't need any
soft-proofing or black point compensation for any of these widgets so
pure babl is fine. Indeed we want to show any in-gamut color
correctly (and not transformed according to specific intents or
through soft-proofing). We will take care of the proofing case with
out-of-gamut area showing only.
5. In the various drawing functions, we should move to
CAIRO_FORMAT_RGBA128F. The color selection area might be wide enough
that it makes sense to be more accurate, especially as we are
essentially showing color gradients in 1 or 2 directions in these
various widgets.
2023-12-12 17:01:17 +09:00
|
|
|
gimp_color_selector_set_color (selector, color);
|
2017-05-17 19:28:40 +02:00
|
|
|
|
app, libgimpwidgets, modules: color selectors are now partly space-invaded.
What this commit does is keep the same code logic while moving to
GeglColor. Yet it's not **really** space-invaded yet. What we need to do
now:
1. Take into account the image space, and this is what we must navigate
through, in particular for various representations of RGB or HSV.
I.e. that if the active image is in anyRGB, the RGB values shown must
be within anyRGB. Right now, everything is still shown/used as sRGB
(even though it's properly retrieved and transformed to the target
space thanks to GeglColor).
2. Show space info to make things clear and explicit, by adding some
label somewhere.
3. Allow to switch between image and softproof spaces, regarding
out-of-gamut display. I.e. that while RGB/HSV must be shown within
the image space (assuming it's anyRGB), we may want to show
out-of-gamut area (pink areas) within the softproof space. This may
mean adding a checkbox. Or maybe simply taking into account whether
we are in softproof mode or not?
4. We can likely move off gimp_widget_get_color_transform() into using
gimp_widget_get_render_space() for display drawing. We don't need any
soft-proofing or black point compensation for any of these widgets so
pure babl is fine. Indeed we want to show any in-gamut color
correctly (and not transformed according to specific intents or
through soft-proofing). We will take care of the proofing case with
out-of-gamut area showing only.
5. In the various drawing functions, we should move to
CAIRO_FORMAT_RGBA128F. The color selection area might be wide enough
that it makes sense to be more accurate, especially as we are
essentially showing color gradients in 1 or 2 directions in these
various widgets.
2023-12-12 17:01:17 +09:00
|
|
|
g_object_unref (color);
|
1997-11-24 22:05:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2002-10-28 20:13:17 +00:00
|
|
|
gimp_color_select_update_pos (GimpColorSelect *select)
|
1997-11-24 22:05:25 +00:00
|
|
|
{
|
2004-02-06 19:03:13 +00:00
|
|
|
GimpColorSelector *selector = GIMP_COLOR_SELECTOR (select);
|
app, libgimpwidgets, modules: color selectors are now partly space-invaded.
What this commit does is keep the same code logic while moving to
GeglColor. Yet it's not **really** space-invaded yet. What we need to do
now:
1. Take into account the image space, and this is what we must navigate
through, in particular for various representations of RGB or HSV.
I.e. that if the active image is in anyRGB, the RGB values shown must
be within anyRGB. Right now, everything is still shown/used as sRGB
(even though it's properly retrieved and transformed to the target
space thanks to GeglColor).
2. Show space info to make things clear and explicit, by adding some
label somewhere.
3. Allow to switch between image and softproof spaces, regarding
out-of-gamut display. I.e. that while RGB/HSV must be shown within
the image space (assuming it's anyRGB), we may want to show
out-of-gamut area (pink areas) within the softproof space. This may
mean adding a checkbox. Or maybe simply taking into account whether
we are in softproof mode or not?
4. We can likely move off gimp_widget_get_color_transform() into using
gimp_widget_get_render_space() for display drawing. We don't need any
soft-proofing or black point compensation for any of these widgets so
pure babl is fine. Indeed we want to show any in-gamut color
correctly (and not transformed according to specific intents or
through soft-proofing). We will take care of the proofing case with
out-of-gamut area showing only.
5. In the various drawing functions, we should move to
CAIRO_FORMAT_RGBA128F. The color selection area might be wide enough
that it makes sense to be more accurate, especially as we are
essentially showing color gradients in 1 or 2 directions in these
various widgets.
2023-12-12 17:01:17 +09:00
|
|
|
GeglColor *color = gimp_color_selector_get_color (selector);
|
|
|
|
gdouble rgb[3];
|
|
|
|
gdouble lch[3];
|
|
|
|
gdouble hsv[3];
|
2017-05-17 19:28:40 +02:00
|
|
|
|
2023-12-17 16:09:43 +09:00
|
|
|
gegl_color_get_pixel (color, babl_format_with_space ("R'G'B' double", select->format), rgb);
|
|
|
|
gegl_color_get_pixel (color, babl_format_with_space ("HSV double", select->format), hsv);
|
app, libgimpwidgets, modules: color selectors are now partly space-invaded.
What this commit does is keep the same code logic while moving to
GeglColor. Yet it's not **really** space-invaded yet. What we need to do
now:
1. Take into account the image space, and this is what we must navigate
through, in particular for various representations of RGB or HSV.
I.e. that if the active image is in anyRGB, the RGB values shown must
be within anyRGB. Right now, everything is still shown/used as sRGB
(even though it's properly retrieved and transformed to the target
space thanks to GeglColor).
2. Show space info to make things clear and explicit, by adding some
label somewhere.
3. Allow to switch between image and softproof spaces, regarding
out-of-gamut display. I.e. that while RGB/HSV must be shown within
the image space (assuming it's anyRGB), we may want to show
out-of-gamut area (pink areas) within the softproof space. This may
mean adding a checkbox. Or maybe simply taking into account whether
we are in softproof mode or not?
4. We can likely move off gimp_widget_get_color_transform() into using
gimp_widget_get_render_space() for display drawing. We don't need any
soft-proofing or black point compensation for any of these widgets so
pure babl is fine. Indeed we want to show any in-gamut color
correctly (and not transformed according to specific intents or
through soft-proofing). We will take care of the proofing case with
out-of-gamut area showing only.
5. In the various drawing functions, we should move to
CAIRO_FORMAT_RGBA128F. The color selection area might be wide enough
that it makes sense to be more accurate, especially as we are
essentially showing color gradients in 1 or 2 directions in these
various widgets.
2023-12-12 17:01:17 +09:00
|
|
|
gegl_color_get_pixel (color, babl_format ("CIE LCH(ab) double"), lch);
|
|
|
|
g_object_unref (color);
|
1997-11-24 22:05:25 +00:00
|
|
|
|
2002-10-20 10:14:17 +00:00
|
|
|
switch (select->z_color_fill)
|
1997-11-24 22:05:25 +00:00
|
|
|
{
|
2001-01-07 21:07:14 +00:00
|
|
|
case COLOR_SELECT_RED:
|
app, libgimpwidgets, modules: color selectors are now partly space-invaded.
What this commit does is keep the same code logic while moving to
GeglColor. Yet it's not **really** space-invaded yet. What we need to do
now:
1. Take into account the image space, and this is what we must navigate
through, in particular for various representations of RGB or HSV.
I.e. that if the active image is in anyRGB, the RGB values shown must
be within anyRGB. Right now, everything is still shown/used as sRGB
(even though it's properly retrieved and transformed to the target
space thanks to GeglColor).
2. Show space info to make things clear and explicit, by adding some
label somewhere.
3. Allow to switch between image and softproof spaces, regarding
out-of-gamut display. I.e. that while RGB/HSV must be shown within
the image space (assuming it's anyRGB), we may want to show
out-of-gamut area (pink areas) within the softproof space. This may
mean adding a checkbox. Or maybe simply taking into account whether
we are in softproof mode or not?
4. We can likely move off gimp_widget_get_color_transform() into using
gimp_widget_get_render_space() for display drawing. We don't need any
soft-proofing or black point compensation for any of these widgets so
pure babl is fine. Indeed we want to show any in-gamut color
correctly (and not transformed according to specific intents or
through soft-proofing). We will take care of the proofing case with
out-of-gamut area showing only.
5. In the various drawing functions, we should move to
CAIRO_FORMAT_RGBA128F. The color selection area might be wide enough
that it makes sense to be more accurate, especially as we are
essentially showing color gradients in 1 or 2 directions in these
various widgets.
2023-12-12 17:01:17 +09:00
|
|
|
select->pos[0] = CLAMP (rgb[1], 0.0, 1.0);
|
|
|
|
select->pos[1] = CLAMP (rgb[2], 0.0, 1.0);
|
|
|
|
select->pos[2] = CLAMP (rgb[0], 0.0, 1.0);
|
2001-01-07 21:07:14 +00:00
|
|
|
break;
|
|
|
|
case COLOR_SELECT_GREEN:
|
app, libgimpwidgets, modules: color selectors are now partly space-invaded.
What this commit does is keep the same code logic while moving to
GeglColor. Yet it's not **really** space-invaded yet. What we need to do
now:
1. Take into account the image space, and this is what we must navigate
through, in particular for various representations of RGB or HSV.
I.e. that if the active image is in anyRGB, the RGB values shown must
be within anyRGB. Right now, everything is still shown/used as sRGB
(even though it's properly retrieved and transformed to the target
space thanks to GeglColor).
2. Show space info to make things clear and explicit, by adding some
label somewhere.
3. Allow to switch between image and softproof spaces, regarding
out-of-gamut display. I.e. that while RGB/HSV must be shown within
the image space (assuming it's anyRGB), we may want to show
out-of-gamut area (pink areas) within the softproof space. This may
mean adding a checkbox. Or maybe simply taking into account whether
we are in softproof mode or not?
4. We can likely move off gimp_widget_get_color_transform() into using
gimp_widget_get_render_space() for display drawing. We don't need any
soft-proofing or black point compensation for any of these widgets so
pure babl is fine. Indeed we want to show any in-gamut color
correctly (and not transformed according to specific intents or
through soft-proofing). We will take care of the proofing case with
out-of-gamut area showing only.
5. In the various drawing functions, we should move to
CAIRO_FORMAT_RGBA128F. The color selection area might be wide enough
that it makes sense to be more accurate, especially as we are
essentially showing color gradients in 1 or 2 directions in these
various widgets.
2023-12-12 17:01:17 +09:00
|
|
|
select->pos[0] = CLAMP (rgb[0], 0.0, 1.0);
|
|
|
|
select->pos[1] = CLAMP (rgb[2], 0.0, 1.0);
|
|
|
|
select->pos[2] = CLAMP (rgb[1], 0.0, 1.0);
|
2001-01-07 21:07:14 +00:00
|
|
|
break;
|
|
|
|
case COLOR_SELECT_BLUE:
|
app, libgimpwidgets, modules: color selectors are now partly space-invaded.
What this commit does is keep the same code logic while moving to
GeglColor. Yet it's not **really** space-invaded yet. What we need to do
now:
1. Take into account the image space, and this is what we must navigate
through, in particular for various representations of RGB or HSV.
I.e. that if the active image is in anyRGB, the RGB values shown must
be within anyRGB. Right now, everything is still shown/used as sRGB
(even though it's properly retrieved and transformed to the target
space thanks to GeglColor).
2. Show space info to make things clear and explicit, by adding some
label somewhere.
3. Allow to switch between image and softproof spaces, regarding
out-of-gamut display. I.e. that while RGB/HSV must be shown within
the image space (assuming it's anyRGB), we may want to show
out-of-gamut area (pink areas) within the softproof space. This may
mean adding a checkbox. Or maybe simply taking into account whether
we are in softproof mode or not?
4. We can likely move off gimp_widget_get_color_transform() into using
gimp_widget_get_render_space() for display drawing. We don't need any
soft-proofing or black point compensation for any of these widgets so
pure babl is fine. Indeed we want to show any in-gamut color
correctly (and not transformed according to specific intents or
through soft-proofing). We will take care of the proofing case with
out-of-gamut area showing only.
5. In the various drawing functions, we should move to
CAIRO_FORMAT_RGBA128F. The color selection area might be wide enough
that it makes sense to be more accurate, especially as we are
essentially showing color gradients in 1 or 2 directions in these
various widgets.
2023-12-12 17:01:17 +09:00
|
|
|
select->pos[0] = CLAMP (rgb[0], 0.0, 1.0);
|
|
|
|
select->pos[1] = CLAMP (rgb[1], 0.0, 1.0);
|
|
|
|
select->pos[2] = CLAMP (rgb[2], 0.0, 1.0);
|
2001-01-07 21:07:14 +00:00
|
|
|
break;
|
2001-01-15 12:20:38 +00:00
|
|
|
|
2001-01-07 21:07:14 +00:00
|
|
|
case COLOR_SELECT_HUE:
|
app, libgimpwidgets, modules: color selectors are now partly space-invaded.
What this commit does is keep the same code logic while moving to
GeglColor. Yet it's not **really** space-invaded yet. What we need to do
now:
1. Take into account the image space, and this is what we must navigate
through, in particular for various representations of RGB or HSV.
I.e. that if the active image is in anyRGB, the RGB values shown must
be within anyRGB. Right now, everything is still shown/used as sRGB
(even though it's properly retrieved and transformed to the target
space thanks to GeglColor).
2. Show space info to make things clear and explicit, by adding some
label somewhere.
3. Allow to switch between image and softproof spaces, regarding
out-of-gamut display. I.e. that while RGB/HSV must be shown within
the image space (assuming it's anyRGB), we may want to show
out-of-gamut area (pink areas) within the softproof space. This may
mean adding a checkbox. Or maybe simply taking into account whether
we are in softproof mode or not?
4. We can likely move off gimp_widget_get_color_transform() into using
gimp_widget_get_render_space() for display drawing. We don't need any
soft-proofing or black point compensation for any of these widgets so
pure babl is fine. Indeed we want to show any in-gamut color
correctly (and not transformed according to specific intents or
through soft-proofing). We will take care of the proofing case with
out-of-gamut area showing only.
5. In the various drawing functions, we should move to
CAIRO_FORMAT_RGBA128F. The color selection area might be wide enough
that it makes sense to be more accurate, especially as we are
essentially showing color gradients in 1 or 2 directions in these
various widgets.
2023-12-12 17:01:17 +09:00
|
|
|
select->pos[0] = CLAMP (hsv[1], 0.0, 1.0);
|
|
|
|
select->pos[1] = CLAMP (hsv[2], 0.0, 1.0);
|
|
|
|
select->pos[2] = CLAMP (hsv[0], 0.0, 1.0);
|
2001-01-07 21:07:14 +00:00
|
|
|
break;
|
|
|
|
case COLOR_SELECT_SATURATION:
|
app, libgimpwidgets, modules: color selectors are now partly space-invaded.
What this commit does is keep the same code logic while moving to
GeglColor. Yet it's not **really** space-invaded yet. What we need to do
now:
1. Take into account the image space, and this is what we must navigate
through, in particular for various representations of RGB or HSV.
I.e. that if the active image is in anyRGB, the RGB values shown must
be within anyRGB. Right now, everything is still shown/used as sRGB
(even though it's properly retrieved and transformed to the target
space thanks to GeglColor).
2. Show space info to make things clear and explicit, by adding some
label somewhere.
3. Allow to switch between image and softproof spaces, regarding
out-of-gamut display. I.e. that while RGB/HSV must be shown within
the image space (assuming it's anyRGB), we may want to show
out-of-gamut area (pink areas) within the softproof space. This may
mean adding a checkbox. Or maybe simply taking into account whether
we are in softproof mode or not?
4. We can likely move off gimp_widget_get_color_transform() into using
gimp_widget_get_render_space() for display drawing. We don't need any
soft-proofing or black point compensation for any of these widgets so
pure babl is fine. Indeed we want to show any in-gamut color
correctly (and not transformed according to specific intents or
through soft-proofing). We will take care of the proofing case with
out-of-gamut area showing only.
5. In the various drawing functions, we should move to
CAIRO_FORMAT_RGBA128F. The color selection area might be wide enough
that it makes sense to be more accurate, especially as we are
essentially showing color gradients in 1 or 2 directions in these
various widgets.
2023-12-12 17:01:17 +09:00
|
|
|
select->pos[0] = CLAMP (hsv[0], 0.0, 1.0);
|
|
|
|
select->pos[1] = CLAMP (hsv[2], 0.0, 1.0);
|
|
|
|
select->pos[2] = CLAMP (hsv[1], 0.0, 1.0);
|
2001-01-07 21:07:14 +00:00
|
|
|
break;
|
|
|
|
case COLOR_SELECT_VALUE:
|
app, libgimpwidgets, modules: color selectors are now partly space-invaded.
What this commit does is keep the same code logic while moving to
GeglColor. Yet it's not **really** space-invaded yet. What we need to do
now:
1. Take into account the image space, and this is what we must navigate
through, in particular for various representations of RGB or HSV.
I.e. that if the active image is in anyRGB, the RGB values shown must
be within anyRGB. Right now, everything is still shown/used as sRGB
(even though it's properly retrieved and transformed to the target
space thanks to GeglColor).
2. Show space info to make things clear and explicit, by adding some
label somewhere.
3. Allow to switch between image and softproof spaces, regarding
out-of-gamut display. I.e. that while RGB/HSV must be shown within
the image space (assuming it's anyRGB), we may want to show
out-of-gamut area (pink areas) within the softproof space. This may
mean adding a checkbox. Or maybe simply taking into account whether
we are in softproof mode or not?
4. We can likely move off gimp_widget_get_color_transform() into using
gimp_widget_get_render_space() for display drawing. We don't need any
soft-proofing or black point compensation for any of these widgets so
pure babl is fine. Indeed we want to show any in-gamut color
correctly (and not transformed according to specific intents or
through soft-proofing). We will take care of the proofing case with
out-of-gamut area showing only.
5. In the various drawing functions, we should move to
CAIRO_FORMAT_RGBA128F. The color selection area might be wide enough
that it makes sense to be more accurate, especially as we are
essentially showing color gradients in 1 or 2 directions in these
various widgets.
2023-12-12 17:01:17 +09:00
|
|
|
select->pos[0] = CLAMP (hsv[0], 0.0, 1.0);
|
|
|
|
select->pos[1] = CLAMP (hsv[1], 0.0, 1.0);
|
|
|
|
select->pos[2] = CLAMP (hsv[2], 0.0, 1.0);
|
2001-01-07 21:07:14 +00:00
|
|
|
break;
|
2002-10-30 14:52:58 +00:00
|
|
|
|
2017-05-17 19:28:40 +02:00
|
|
|
case COLOR_SELECT_LCH_LIGHTNESS:
|
app, libgimpwidgets, modules: color selectors are now partly space-invaded.
What this commit does is keep the same code logic while moving to
GeglColor. Yet it's not **really** space-invaded yet. What we need to do
now:
1. Take into account the image space, and this is what we must navigate
through, in particular for various representations of RGB or HSV.
I.e. that if the active image is in anyRGB, the RGB values shown must
be within anyRGB. Right now, everything is still shown/used as sRGB
(even though it's properly retrieved and transformed to the target
space thanks to GeglColor).
2. Show space info to make things clear and explicit, by adding some
label somewhere.
3. Allow to switch between image and softproof spaces, regarding
out-of-gamut display. I.e. that while RGB/HSV must be shown within
the image space (assuming it's anyRGB), we may want to show
out-of-gamut area (pink areas) within the softproof space. This may
mean adding a checkbox. Or maybe simply taking into account whether
we are in softproof mode or not?
4. We can likely move off gimp_widget_get_color_transform() into using
gimp_widget_get_render_space() for display drawing. We don't need any
soft-proofing or black point compensation for any of these widgets so
pure babl is fine. Indeed we want to show any in-gamut color
correctly (and not transformed according to specific intents or
through soft-proofing). We will take care of the proofing case with
out-of-gamut area showing only.
5. In the various drawing functions, we should move to
CAIRO_FORMAT_RGBA128F. The color selection area might be wide enough
that it makes sense to be more accurate, especially as we are
essentially showing color gradients in 1 or 2 directions in these
various widgets.
2023-12-12 17:01:17 +09:00
|
|
|
select->pos[0] = CLAMP (lch[2] / 360, 0.0, 1.0);
|
|
|
|
select->pos[1] = CLAMP (lch[1] / 200, 0.0, 1.0);
|
|
|
|
select->pos[2] = CLAMP (lch[0] / 100, 0.0, 1.0);
|
2017-05-17 19:28:40 +02:00
|
|
|
break;
|
|
|
|
case COLOR_SELECT_LCH_CHROMA:
|
app, libgimpwidgets, modules: color selectors are now partly space-invaded.
What this commit does is keep the same code logic while moving to
GeglColor. Yet it's not **really** space-invaded yet. What we need to do
now:
1. Take into account the image space, and this is what we must navigate
through, in particular for various representations of RGB or HSV.
I.e. that if the active image is in anyRGB, the RGB values shown must
be within anyRGB. Right now, everything is still shown/used as sRGB
(even though it's properly retrieved and transformed to the target
space thanks to GeglColor).
2. Show space info to make things clear and explicit, by adding some
label somewhere.
3. Allow to switch between image and softproof spaces, regarding
out-of-gamut display. I.e. that while RGB/HSV must be shown within
the image space (assuming it's anyRGB), we may want to show
out-of-gamut area (pink areas) within the softproof space. This may
mean adding a checkbox. Or maybe simply taking into account whether
we are in softproof mode or not?
4. We can likely move off gimp_widget_get_color_transform() into using
gimp_widget_get_render_space() for display drawing. We don't need any
soft-proofing or black point compensation for any of these widgets so
pure babl is fine. Indeed we want to show any in-gamut color
correctly (and not transformed according to specific intents or
through soft-proofing). We will take care of the proofing case with
out-of-gamut area showing only.
5. In the various drawing functions, we should move to
CAIRO_FORMAT_RGBA128F. The color selection area might be wide enough
that it makes sense to be more accurate, especially as we are
essentially showing color gradients in 1 or 2 directions in these
various widgets.
2023-12-12 17:01:17 +09:00
|
|
|
select->pos[0] = CLAMP (lch[2] / 360, 0.0, 1.0);
|
|
|
|
select->pos[1] = CLAMP (lch[0] / 100, 0.0, 1.0);
|
|
|
|
select->pos[2] = CLAMP (lch[1] / 200, 0.0, 1.0);
|
2017-05-17 19:28:40 +02:00
|
|
|
break;
|
|
|
|
case COLOR_SELECT_LCH_HUE:
|
app, libgimpwidgets, modules: color selectors are now partly space-invaded.
What this commit does is keep the same code logic while moving to
GeglColor. Yet it's not **really** space-invaded yet. What we need to do
now:
1. Take into account the image space, and this is what we must navigate
through, in particular for various representations of RGB or HSV.
I.e. that if the active image is in anyRGB, the RGB values shown must
be within anyRGB. Right now, everything is still shown/used as sRGB
(even though it's properly retrieved and transformed to the target
space thanks to GeglColor).
2. Show space info to make things clear and explicit, by adding some
label somewhere.
3. Allow to switch between image and softproof spaces, regarding
out-of-gamut display. I.e. that while RGB/HSV must be shown within
the image space (assuming it's anyRGB), we may want to show
out-of-gamut area (pink areas) within the softproof space. This may
mean adding a checkbox. Or maybe simply taking into account whether
we are in softproof mode or not?
4. We can likely move off gimp_widget_get_color_transform() into using
gimp_widget_get_render_space() for display drawing. We don't need any
soft-proofing or black point compensation for any of these widgets so
pure babl is fine. Indeed we want to show any in-gamut color
correctly (and not transformed according to specific intents or
through soft-proofing). We will take care of the proofing case with
out-of-gamut area showing only.
5. In the various drawing functions, we should move to
CAIRO_FORMAT_RGBA128F. The color selection area might be wide enough
that it makes sense to be more accurate, especially as we are
essentially showing color gradients in 1 or 2 directions in these
various widgets.
2023-12-12 17:01:17 +09:00
|
|
|
select->pos[0] = CLAMP (lch[1] / 200, 0.0, 1.0);
|
|
|
|
select->pos[1] = CLAMP (lch[0] / 100, 0.0, 1.0);
|
|
|
|
select->pos[2] = CLAMP (lch[2] / 360, 0.0, 1.0);
|
2017-05-17 19:28:40 +02:00
|
|
|
break;
|
|
|
|
|
2002-10-30 14:52:58 +00:00
|
|
|
default:
|
|
|
|
break;
|
1997-11-24 22:05:25 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-10-20 10:14:17 +00:00
|
|
|
#if 0
|
|
|
|
static void
|
|
|
|
gimp_color_select_drop_color (GtkWidget *widget,
|
2004-12-31 14:36:30 +00:00
|
|
|
gint x,
|
|
|
|
gint y,
|
2002-10-20 10:14:17 +00:00
|
|
|
const GimpRGB *color,
|
|
|
|
gpointer data)
|
1997-11-24 22:05:25 +00:00
|
|
|
{
|
2004-02-06 19:03:13 +00:00
|
|
|
GimpColorSelect *select = GIMP_COLOR_SELECT (data);
|
1997-11-24 22:05:25 +00:00
|
|
|
|
2002-10-20 10:14:17 +00:00
|
|
|
select->rgb = *color;
|
|
|
|
|
|
|
|
gimp_color_select_update_hsv_values (select);
|
2017-05-17 19:28:40 +02:00
|
|
|
gimp_color_select_update_lch_values (select);
|
2002-10-20 10:14:17 +00:00
|
|
|
|
2002-11-05 00:02:56 +00:00
|
|
|
gimp_color_select_update (select,
|
|
|
|
UPDATE_POS | UPDATE_XY_COLOR | UPDATE_Z_COLOR |
|
|
|
|
UPDATE_CALLER);
|
2002-10-20 10:14:17 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2004-02-06 19:03:13 +00:00
|
|
|
static void
|
|
|
|
gimp_color_select_xy_size_allocate (GtkWidget *widget,
|
|
|
|
GtkAllocation *allocation,
|
|
|
|
GimpColorSelect *select)
|
|
|
|
{
|
2017-05-17 19:28:40 +02:00
|
|
|
if (allocation->width != select->xy_width ||
|
|
|
|
allocation->height != select->xy_height)
|
|
|
|
{
|
|
|
|
select->xy_width = allocation->width;
|
|
|
|
select->xy_height = allocation->height;
|
|
|
|
|
|
|
|
select->xy_rowstride = (select->xy_width * 3 + 3) & ~3;
|
|
|
|
|
|
|
|
g_free (select->xy_buf);
|
|
|
|
select->xy_buf = g_new (guchar, select->xy_rowstride * select->xy_height);
|
|
|
|
|
|
|
|
select->xy_needs_render = TRUE;
|
|
|
|
}
|
|
|
|
|
2004-02-06 19:03:13 +00:00
|
|
|
gimp_color_select_update (select, UPDATE_XY_COLOR);
|
|
|
|
}
|
|
|
|
|
2002-10-20 10:14:17 +00:00
|
|
|
static gboolean
|
2010-10-19 21:10:48 +02:00
|
|
|
gimp_color_select_xy_draw (GtkWidget *widget,
|
|
|
|
cairo_t *cr,
|
|
|
|
GimpColorSelect *select)
|
2002-10-20 10:14:17 +00:00
|
|
|
{
|
2010-09-11 22:24:08 +02:00
|
|
|
GtkAllocation allocation;
|
2017-05-17 19:28:40 +02:00
|
|
|
GdkPixbuf *pixbuf;
|
2023-12-17 16:09:43 +09:00
|
|
|
const Babl *render_space;
|
|
|
|
const Babl *render_fish;
|
|
|
|
guchar *buf;
|
|
|
|
guchar *src;
|
|
|
|
guchar *dest;
|
2010-09-11 22:24:08 +02:00
|
|
|
gint x, y;
|
|
|
|
|
2017-05-17 19:28:40 +02:00
|
|
|
if (! select->xy_buf)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
if (select->xy_needs_render)
|
|
|
|
{
|
|
|
|
GimpColorSelector *selector = GIMP_COLOR_SELECTOR (select);
|
app, libgimpwidgets, modules: color selectors are now partly space-invaded.
What this commit does is keep the same code logic while moving to
GeglColor. Yet it's not **really** space-invaded yet. What we need to do
now:
1. Take into account the image space, and this is what we must navigate
through, in particular for various representations of RGB or HSV.
I.e. that if the active image is in anyRGB, the RGB values shown must
be within anyRGB. Right now, everything is still shown/used as sRGB
(even though it's properly retrieved and transformed to the target
space thanks to GeglColor).
2. Show space info to make things clear and explicit, by adding some
label somewhere.
3. Allow to switch between image and softproof spaces, regarding
out-of-gamut display. I.e. that while RGB/HSV must be shown within
the image space (assuming it's anyRGB), we may want to show
out-of-gamut area (pink areas) within the softproof space. This may
mean adding a checkbox. Or maybe simply taking into account whether
we are in softproof mode or not?
4. We can likely move off gimp_widget_get_color_transform() into using
gimp_widget_get_render_space() for display drawing. We don't need any
soft-proofing or black point compensation for any of these widgets so
pure babl is fine. Indeed we want to show any in-gamut color
correctly (and not transformed according to specific intents or
through soft-proofing). We will take care of the proofing case with
out-of-gamut area showing only.
5. In the various drawing functions, we should move to
CAIRO_FORMAT_RGBA128F. The color selection area might be wide enough
that it makes sense to be more accurate, especially as we are
essentially showing color gradients in 1 or 2 directions in these
various widgets.
2023-12-12 17:01:17 +09:00
|
|
|
GeglColor *color = gimp_color_selector_get_color (selector);
|
2017-05-17 19:28:40 +02:00
|
|
|
|
|
|
|
gimp_color_select_render (select->xy_color,
|
|
|
|
select->xy_buf,
|
|
|
|
select->xy_width,
|
|
|
|
select->xy_height,
|
|
|
|
select->xy_rowstride,
|
|
|
|
select->xy_color_fill,
|
app, libgimpwidgets, modules: color selectors are now partly space-invaded.
What this commit does is keep the same code logic while moving to
GeglColor. Yet it's not **really** space-invaded yet. What we need to do
now:
1. Take into account the image space, and this is what we must navigate
through, in particular for various representations of RGB or HSV.
I.e. that if the active image is in anyRGB, the RGB values shown must
be within anyRGB. Right now, everything is still shown/used as sRGB
(even though it's properly retrieved and transformed to the target
space thanks to GeglColor).
2. Show space info to make things clear and explicit, by adding some
label somewhere.
3. Allow to switch between image and softproof spaces, regarding
out-of-gamut display. I.e. that while RGB/HSV must be shown within
the image space (assuming it's anyRGB), we may want to show
out-of-gamut area (pink areas) within the softproof space. This may
mean adding a checkbox. Or maybe simply taking into account whether
we are in softproof mode or not?
4. We can likely move off gimp_widget_get_color_transform() into using
gimp_widget_get_render_space() for display drawing. We don't need any
soft-proofing or black point compensation for any of these widgets so
pure babl is fine. Indeed we want to show any in-gamut color
correctly (and not transformed according to specific intents or
through soft-proofing). We will take care of the proofing case with
out-of-gamut area showing only.
5. In the various drawing functions, we should move to
CAIRO_FORMAT_RGBA128F. The color selection area might be wide enough
that it makes sense to be more accurate, especially as we are
essentially showing color gradients in 1 or 2 directions in these
various widgets.
2023-12-12 17:01:17 +09:00
|
|
|
color,
|
2017-05-17 19:28:40 +02:00
|
|
|
select->oog_color);
|
|
|
|
select->xy_needs_render = FALSE;
|
app, libgimpwidgets, modules: color selectors are now partly space-invaded.
What this commit does is keep the same code logic while moving to
GeglColor. Yet it's not **really** space-invaded yet. What we need to do
now:
1. Take into account the image space, and this is what we must navigate
through, in particular for various representations of RGB or HSV.
I.e. that if the active image is in anyRGB, the RGB values shown must
be within anyRGB. Right now, everything is still shown/used as sRGB
(even though it's properly retrieved and transformed to the target
space thanks to GeglColor).
2. Show space info to make things clear and explicit, by adding some
label somewhere.
3. Allow to switch between image and softproof spaces, regarding
out-of-gamut display. I.e. that while RGB/HSV must be shown within
the image space (assuming it's anyRGB), we may want to show
out-of-gamut area (pink areas) within the softproof space. This may
mean adding a checkbox. Or maybe simply taking into account whether
we are in softproof mode or not?
4. We can likely move off gimp_widget_get_color_transform() into using
gimp_widget_get_render_space() for display drawing. We don't need any
soft-proofing or black point compensation for any of these widgets so
pure babl is fine. Indeed we want to show any in-gamut color
correctly (and not transformed according to specific intents or
through soft-proofing). We will take care of the proofing case with
out-of-gamut area showing only.
5. In the various drawing functions, we should move to
CAIRO_FORMAT_RGBA128F. The color selection area might be wide enough
that it makes sense to be more accurate, especially as we are
essentially showing color gradients in 1 or 2 directions in these
various widgets.
2023-12-12 17:01:17 +09:00
|
|
|
|
|
|
|
g_object_unref (color);
|
2017-05-17 19:28:40 +02:00
|
|
|
}
|
|
|
|
|
2023-12-17 16:09:43 +09:00
|
|
|
render_space = gimp_widget_get_render_space (widget, select->config);
|
|
|
|
render_fish = babl_fish (babl_format_with_space ("R'G'B' u8", select->format),
|
|
|
|
babl_format_with_space ("R'G'B' u8", render_space));
|
2017-05-17 19:28:40 +02:00
|
|
|
|
2023-12-17 16:09:43 +09:00
|
|
|
buf = g_new (guchar, select->xy_rowstride * select->xy_height);
|
|
|
|
src = select->xy_buf;
|
|
|
|
dest = buf;
|
|
|
|
for (gint i = 0; i < select->xy_height; i++)
|
2017-05-17 19:28:40 +02:00
|
|
|
{
|
2023-12-17 16:09:43 +09:00
|
|
|
babl_process (render_fish, src, dest, select->xy_width);
|
2017-05-17 19:28:40 +02:00
|
|
|
|
2023-12-17 16:09:43 +09:00
|
|
|
src += select->xy_rowstride;
|
|
|
|
dest += select->xy_rowstride;
|
2017-05-17 19:28:40 +02:00
|
|
|
}
|
|
|
|
|
2023-12-17 16:09:43 +09:00
|
|
|
pixbuf = gdk_pixbuf_new_from_data (buf,
|
|
|
|
GDK_COLORSPACE_RGB,
|
|
|
|
FALSE,
|
|
|
|
8,
|
|
|
|
select->xy_width,
|
|
|
|
select->xy_height,
|
|
|
|
select->xy_rowstride,
|
|
|
|
(GdkPixbufDestroyNotify) g_free, NULL);
|
|
|
|
|
2010-09-11 22:24:08 +02:00
|
|
|
gtk_widget_get_allocation (select->xy_color, &allocation);
|
|
|
|
|
2017-05-17 19:28:40 +02:00
|
|
|
gdk_cairo_set_source_pixbuf (cr, pixbuf, 0, 0);
|
|
|
|
g_object_unref (pixbuf);
|
|
|
|
cairo_paint (cr);
|
|
|
|
|
2015-10-08 21:10:33 +02:00
|
|
|
x = (allocation.width - 1) * select->pos[0];
|
|
|
|
y = (allocation.height - 1) - (allocation.height - 1) * select->pos[1];
|
2010-09-11 22:24:08 +02:00
|
|
|
|
|
|
|
cairo_move_to (cr, 0, y + 0.5);
|
|
|
|
cairo_line_to (cr, allocation.width, y + 0.5);
|
|
|
|
|
|
|
|
cairo_move_to (cr, x + 0.5, 0);
|
|
|
|
cairo_line_to (cr, x + 0.5, allocation.height);
|
2002-10-20 10:14:17 +00:00
|
|
|
|
2010-09-11 22:24:08 +02:00
|
|
|
cairo_set_line_width (cr, 3.0);
|
|
|
|
cairo_set_source_rgba (cr, 1.0, 1.0, 1.0, 0.6);
|
|
|
|
cairo_stroke_preserve (cr);
|
|
|
|
|
|
|
|
cairo_set_line_width (cr, 1.0);
|
|
|
|
cairo_set_source_rgba (cr, 0.0, 0.0, 0.0, 0.8);
|
|
|
|
cairo_stroke (cr);
|
|
|
|
|
2002-10-20 10:14:17 +00:00
|
|
|
return TRUE;
|
1997-11-24 22:05:25 +00:00
|
|
|
}
|
|
|
|
|
2002-10-20 10:14:17 +00:00
|
|
|
static gboolean
|
|
|
|
gimp_color_select_xy_events (GtkWidget *widget,
|
|
|
|
GdkEvent *event,
|
|
|
|
GimpColorSelect *select)
|
1997-11-24 22:05:25 +00:00
|
|
|
{
|
2009-10-17 18:51:48 +02:00
|
|
|
GtkAllocation allocation;
|
2015-10-08 21:10:33 +02:00
|
|
|
gdouble x, y;
|
1997-11-24 22:05:25 +00:00
|
|
|
|
|
|
|
switch (event->type)
|
|
|
|
{
|
|
|
|
case GDK_BUTTON_PRESS:
|
2009-06-01 22:55:43 +02:00
|
|
|
{
|
|
|
|
GdkEventButton *bevent = (GdkEventButton *) event;
|
|
|
|
|
|
|
|
if (select->drag_mode != DRAG_NONE || bevent->button != 1)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
x = bevent->x;
|
|
|
|
y = bevent->y;
|
|
|
|
|
2011-12-10 21:51:05 +01:00
|
|
|
gtk_grab_add (widget);
|
2009-06-01 22:55:43 +02:00
|
|
|
select->drag_mode = DRAG_XY;
|
|
|
|
}
|
1997-11-24 22:05:25 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case GDK_BUTTON_RELEASE:
|
2009-06-01 22:55:43 +02:00
|
|
|
{
|
|
|
|
GdkEventButton *bevent = (GdkEventButton *) event;
|
|
|
|
|
|
|
|
if (select->drag_mode != DRAG_XY || bevent->button != 1)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
x = bevent->x;
|
|
|
|
y = bevent->y;
|
1997-11-24 22:05:25 +00:00
|
|
|
|
2011-12-10 21:51:05 +01:00
|
|
|
gtk_grab_remove (widget);
|
2009-06-01 22:55:43 +02:00
|
|
|
select->drag_mode = DRAG_NONE;
|
|
|
|
}
|
1997-11-24 22:05:25 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case GDK_MOTION_NOTIFY:
|
2009-06-01 22:55:43 +02:00
|
|
|
{
|
|
|
|
GdkEventMotion *mevent = (GdkEventMotion *) event;
|
|
|
|
|
|
|
|
if (select->drag_mode != DRAG_XY)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
x = mevent->x;
|
|
|
|
y = mevent->y;
|
|
|
|
}
|
1997-11-24 22:05:25 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2003-06-11 13:59:42 +00:00
|
|
|
return FALSE;
|
1997-11-24 22:05:25 +00:00
|
|
|
}
|
|
|
|
|
2009-10-17 18:51:48 +02:00
|
|
|
gtk_widget_get_allocation (select->xy_color, &allocation);
|
2004-02-06 19:03:13 +00:00
|
|
|
|
2009-10-17 18:51:48 +02:00
|
|
|
if (allocation.width > 1 && allocation.height > 1)
|
2004-02-06 19:03:13 +00:00
|
|
|
{
|
2015-10-08 21:10:33 +02:00
|
|
|
select->pos[0] = x / (allocation.width - 1);
|
|
|
|
select->pos[1] = 1.0 - y / (allocation.height - 1);
|
2004-02-06 19:03:13 +00:00
|
|
|
}
|
2003-10-29 20:57:21 +00:00
|
|
|
|
2015-10-08 21:10:33 +02:00
|
|
|
select->pos[0] = CLAMP (select->pos[0], 0.0, 1.0);
|
|
|
|
select->pos[1] = CLAMP (select->pos[1], 0.0, 1.0);
|
2003-10-29 20:57:21 +00:00
|
|
|
|
2010-09-11 22:24:08 +02:00
|
|
|
gtk_widget_queue_draw (select->xy_color);
|
2004-09-20 00:17:38 +00:00
|
|
|
|
2003-06-11 13:59:42 +00:00
|
|
|
gimp_color_select_update (select, UPDATE_VALUES | UPDATE_CALLER);
|
|
|
|
|
2008-09-03 19:24:51 +00:00
|
|
|
/* Ask for more motion events in case the event was a hint */
|
|
|
|
gdk_event_request_motions ((GdkEventMotion *) event);
|
2007-11-04 12:52:47 +00:00
|
|
|
|
2003-06-11 13:59:42 +00:00
|
|
|
return TRUE;
|
1997-11-24 22:05:25 +00:00
|
|
|
}
|
|
|
|
|
2004-02-06 19:03:13 +00:00
|
|
|
static void
|
|
|
|
gimp_color_select_z_size_allocate (GtkWidget *widget,
|
|
|
|
GtkAllocation *allocation,
|
|
|
|
GimpColorSelect *select)
|
|
|
|
{
|
2017-05-17 19:28:40 +02:00
|
|
|
if (allocation->width != select->z_width ||
|
|
|
|
allocation->height != select->z_height)
|
|
|
|
{
|
|
|
|
select->z_width = allocation->width;
|
|
|
|
select->z_height = allocation->height;
|
|
|
|
|
|
|
|
select->z_rowstride = (select->z_width * 3 + 3) & ~3;
|
|
|
|
|
|
|
|
g_free (select->z_buf);
|
|
|
|
select->z_buf = g_new (guchar, select->z_rowstride * select->z_height);
|
|
|
|
|
|
|
|
select->z_needs_render = TRUE;
|
|
|
|
}
|
|
|
|
|
2004-02-06 19:03:13 +00:00
|
|
|
gimp_color_select_update (select, UPDATE_Z_COLOR);
|
|
|
|
}
|
|
|
|
|
2002-10-20 10:14:17 +00:00
|
|
|
static gboolean
|
2010-10-19 21:10:48 +02:00
|
|
|
gimp_color_select_z_draw (GtkWidget *widget,
|
|
|
|
cairo_t *cr,
|
|
|
|
GimpColorSelect *select)
|
1997-11-24 22:05:25 +00:00
|
|
|
{
|
2010-09-11 22:24:08 +02:00
|
|
|
GtkAllocation allocation;
|
2017-05-17 19:28:40 +02:00
|
|
|
GdkPixbuf *pixbuf;
|
2023-12-17 16:09:43 +09:00
|
|
|
const Babl *render_space;
|
|
|
|
const Babl *render_fish;
|
|
|
|
guchar *buf;
|
|
|
|
guchar *src;
|
|
|
|
guchar *dest;
|
2010-09-11 22:24:08 +02:00
|
|
|
gint y;
|
|
|
|
|
2017-05-17 19:28:40 +02:00
|
|
|
if (! select->z_buf)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
if (select->z_needs_render)
|
|
|
|
{
|
|
|
|
GimpColorSelector *selector = GIMP_COLOR_SELECTOR (select);
|
app, libgimpwidgets, modules: color selectors are now partly space-invaded.
What this commit does is keep the same code logic while moving to
GeglColor. Yet it's not **really** space-invaded yet. What we need to do
now:
1. Take into account the image space, and this is what we must navigate
through, in particular for various representations of RGB or HSV.
I.e. that if the active image is in anyRGB, the RGB values shown must
be within anyRGB. Right now, everything is still shown/used as sRGB
(even though it's properly retrieved and transformed to the target
space thanks to GeglColor).
2. Show space info to make things clear and explicit, by adding some
label somewhere.
3. Allow to switch between image and softproof spaces, regarding
out-of-gamut display. I.e. that while RGB/HSV must be shown within
the image space (assuming it's anyRGB), we may want to show
out-of-gamut area (pink areas) within the softproof space. This may
mean adding a checkbox. Or maybe simply taking into account whether
we are in softproof mode or not?
4. We can likely move off gimp_widget_get_color_transform() into using
gimp_widget_get_render_space() for display drawing. We don't need any
soft-proofing or black point compensation for any of these widgets so
pure babl is fine. Indeed we want to show any in-gamut color
correctly (and not transformed according to specific intents or
through soft-proofing). We will take care of the proofing case with
out-of-gamut area showing only.
5. In the various drawing functions, we should move to
CAIRO_FORMAT_RGBA128F. The color selection area might be wide enough
that it makes sense to be more accurate, especially as we are
essentially showing color gradients in 1 or 2 directions in these
various widgets.
2023-12-12 17:01:17 +09:00
|
|
|
GeglColor *color = gimp_color_selector_get_color (selector);
|
2017-05-17 19:28:40 +02:00
|
|
|
|
|
|
|
gimp_color_select_render (select->z_color,
|
|
|
|
select->z_buf,
|
|
|
|
select->z_width,
|
|
|
|
select->z_height,
|
|
|
|
select->z_rowstride,
|
|
|
|
select->z_color_fill,
|
app, libgimpwidgets, modules: color selectors are now partly space-invaded.
What this commit does is keep the same code logic while moving to
GeglColor. Yet it's not **really** space-invaded yet. What we need to do
now:
1. Take into account the image space, and this is what we must navigate
through, in particular for various representations of RGB or HSV.
I.e. that if the active image is in anyRGB, the RGB values shown must
be within anyRGB. Right now, everything is still shown/used as sRGB
(even though it's properly retrieved and transformed to the target
space thanks to GeglColor).
2. Show space info to make things clear and explicit, by adding some
label somewhere.
3. Allow to switch between image and softproof spaces, regarding
out-of-gamut display. I.e. that while RGB/HSV must be shown within
the image space (assuming it's anyRGB), we may want to show
out-of-gamut area (pink areas) within the softproof space. This may
mean adding a checkbox. Or maybe simply taking into account whether
we are in softproof mode or not?
4. We can likely move off gimp_widget_get_color_transform() into using
gimp_widget_get_render_space() for display drawing. We don't need any
soft-proofing or black point compensation for any of these widgets so
pure babl is fine. Indeed we want to show any in-gamut color
correctly (and not transformed according to specific intents or
through soft-proofing). We will take care of the proofing case with
out-of-gamut area showing only.
5. In the various drawing functions, we should move to
CAIRO_FORMAT_RGBA128F. The color selection area might be wide enough
that it makes sense to be more accurate, especially as we are
essentially showing color gradients in 1 or 2 directions in these
various widgets.
2023-12-12 17:01:17 +09:00
|
|
|
color,
|
2017-05-17 19:28:40 +02:00
|
|
|
select->oog_color);
|
|
|
|
select->z_needs_render = FALSE;
|
app, libgimpwidgets, modules: color selectors are now partly space-invaded.
What this commit does is keep the same code logic while moving to
GeglColor. Yet it's not **really** space-invaded yet. What we need to do
now:
1. Take into account the image space, and this is what we must navigate
through, in particular for various representations of RGB or HSV.
I.e. that if the active image is in anyRGB, the RGB values shown must
be within anyRGB. Right now, everything is still shown/used as sRGB
(even though it's properly retrieved and transformed to the target
space thanks to GeglColor).
2. Show space info to make things clear and explicit, by adding some
label somewhere.
3. Allow to switch between image and softproof spaces, regarding
out-of-gamut display. I.e. that while RGB/HSV must be shown within
the image space (assuming it's anyRGB), we may want to show
out-of-gamut area (pink areas) within the softproof space. This may
mean adding a checkbox. Or maybe simply taking into account whether
we are in softproof mode or not?
4. We can likely move off gimp_widget_get_color_transform() into using
gimp_widget_get_render_space() for display drawing. We don't need any
soft-proofing or black point compensation for any of these widgets so
pure babl is fine. Indeed we want to show any in-gamut color
correctly (and not transformed according to specific intents or
through soft-proofing). We will take care of the proofing case with
out-of-gamut area showing only.
5. In the various drawing functions, we should move to
CAIRO_FORMAT_RGBA128F. The color selection area might be wide enough
that it makes sense to be more accurate, especially as we are
essentially showing color gradients in 1 or 2 directions in these
various widgets.
2023-12-12 17:01:17 +09:00
|
|
|
|
|
|
|
g_object_unref (color);
|
2017-05-17 19:28:40 +02:00
|
|
|
}
|
|
|
|
|
2010-09-11 22:24:08 +02:00
|
|
|
gtk_widget_get_allocation (widget, &allocation);
|
|
|
|
|
2023-12-17 16:09:43 +09:00
|
|
|
render_space = gimp_widget_get_render_space (widget, select->config);
|
|
|
|
render_fish = babl_fish (babl_format_with_space ("R'G'B' u8", select->format),
|
|
|
|
babl_format_with_space ("R'G'B' u8", render_space));
|
2017-05-17 19:28:40 +02:00
|
|
|
|
2023-12-17 16:09:43 +09:00
|
|
|
buf = g_new (guchar, select->z_rowstride * select->z_height);
|
|
|
|
src = select->z_buf;
|
|
|
|
dest = buf;
|
|
|
|
for (gint i = 0; i < select->z_height; i++)
|
2017-05-17 19:28:40 +02:00
|
|
|
{
|
2023-12-17 16:09:43 +09:00
|
|
|
babl_process (render_fish, src, dest, select->z_width);
|
2017-05-17 19:28:40 +02:00
|
|
|
|
2023-12-17 16:09:43 +09:00
|
|
|
src += select->z_rowstride;
|
|
|
|
dest += select->z_rowstride;
|
2017-05-17 19:28:40 +02:00
|
|
|
}
|
|
|
|
|
2023-12-17 16:09:43 +09:00
|
|
|
pixbuf = gdk_pixbuf_new_from_data (buf,
|
|
|
|
GDK_COLORSPACE_RGB,
|
|
|
|
FALSE,
|
|
|
|
8,
|
|
|
|
select->z_width,
|
|
|
|
select->z_height,
|
|
|
|
select->z_rowstride,
|
|
|
|
(GdkPixbufDestroyNotify) g_free, NULL);
|
|
|
|
|
2017-05-17 19:28:40 +02:00
|
|
|
gdk_cairo_set_source_pixbuf (cr, pixbuf, 0, 0);
|
|
|
|
g_object_unref (pixbuf);
|
|
|
|
cairo_paint (cr);
|
|
|
|
|
2015-10-08 21:10:33 +02:00
|
|
|
y = (allocation.height - 1) - (allocation.height - 1) * select->pos[2];
|
2010-09-11 22:24:08 +02:00
|
|
|
|
|
|
|
cairo_move_to (cr, 0, y + 0.5);
|
|
|
|
cairo_line_to (cr, allocation.width, y + 0.5);
|
|
|
|
|
|
|
|
cairo_set_line_width (cr, 3.0);
|
|
|
|
cairo_set_source_rgba (cr, 1.0, 1.0, 1.0, 0.6);
|
|
|
|
cairo_stroke_preserve (cr);
|
1997-11-24 22:05:25 +00:00
|
|
|
|
2010-09-11 22:24:08 +02:00
|
|
|
cairo_set_line_width (cr, 1.0);
|
|
|
|
cairo_set_source_rgba (cr, 0.0, 0.0, 0.0, 0.8);
|
|
|
|
cairo_stroke (cr);
|
|
|
|
|
2002-10-20 10:14:17 +00:00
|
|
|
return TRUE;
|
1997-11-24 22:05:25 +00:00
|
|
|
}
|
|
|
|
|
2002-10-20 10:14:17 +00:00
|
|
|
static gboolean
|
|
|
|
gimp_color_select_z_events (GtkWidget *widget,
|
|
|
|
GdkEvent *event,
|
|
|
|
GimpColorSelect *select)
|
1997-11-24 22:05:25 +00:00
|
|
|
{
|
2009-10-17 18:51:48 +02:00
|
|
|
GtkAllocation allocation;
|
2015-10-08 21:10:33 +02:00
|
|
|
gdouble z;
|
1997-11-24 22:05:25 +00:00
|
|
|
|
|
|
|
switch (event->type)
|
|
|
|
{
|
|
|
|
case GDK_BUTTON_PRESS:
|
2009-06-01 22:55:43 +02:00
|
|
|
{
|
|
|
|
GdkEventButton *bevent = (GdkEventButton *) event;
|
|
|
|
|
|
|
|
if (select->drag_mode != DRAG_NONE || bevent->button != 1)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
z = bevent->y;
|
|
|
|
|
2011-12-10 21:51:05 +01:00
|
|
|
gtk_grab_add (widget);
|
2009-06-01 22:55:43 +02:00
|
|
|
select->drag_mode = DRAG_Z;
|
|
|
|
}
|
1997-11-24 22:05:25 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case GDK_BUTTON_RELEASE:
|
2009-06-01 22:55:43 +02:00
|
|
|
{
|
|
|
|
GdkEventButton *bevent = (GdkEventButton *) event;
|
1997-11-24 22:05:25 +00:00
|
|
|
|
2009-06-01 22:55:43 +02:00
|
|
|
if (select->drag_mode != DRAG_Z || bevent->button != 1)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
z = bevent->y;
|
|
|
|
|
2011-12-10 21:51:05 +01:00
|
|
|
gtk_grab_remove (widget);
|
2009-06-01 22:55:43 +02:00
|
|
|
select->drag_mode = DRAG_NONE;
|
|
|
|
}
|
1997-11-24 22:05:25 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case GDK_MOTION_NOTIFY:
|
2009-06-01 22:55:43 +02:00
|
|
|
{
|
|
|
|
GdkEventMotion *mevent = (GdkEventMotion *) event;
|
|
|
|
|
|
|
|
if (select->drag_mode != DRAG_Z)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
z = mevent->y;
|
|
|
|
}
|
1997-11-24 22:05:25 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2003-06-11 13:59:42 +00:00
|
|
|
return FALSE;
|
1997-11-24 22:05:25 +00:00
|
|
|
}
|
|
|
|
|
2009-10-17 18:51:48 +02:00
|
|
|
gtk_widget_get_allocation (select->z_color, &allocation);
|
2004-02-06 19:03:13 +00:00
|
|
|
|
2009-10-17 18:51:48 +02:00
|
|
|
if (allocation.height > 1)
|
2015-10-08 21:10:33 +02:00
|
|
|
select->pos[2] = 1.0 - z / (allocation.height - 1);
|
2004-02-06 19:03:13 +00:00
|
|
|
|
2015-10-08 21:10:33 +02:00
|
|
|
select->pos[2] = CLAMP (select->pos[2], 0.0, 1.0);
|
2003-06-11 13:59:42 +00:00
|
|
|
|
2010-09-11 22:24:08 +02:00
|
|
|
gtk_widget_queue_draw (select->z_color);
|
|
|
|
|
2003-06-11 15:55:48 +00:00
|
|
|
gimp_color_select_update (select,
|
|
|
|
UPDATE_VALUES | UPDATE_XY_COLOR | UPDATE_CALLER);
|
2003-06-11 13:59:42 +00:00
|
|
|
|
2008-09-03 19:24:51 +00:00
|
|
|
/* Ask for more motion events in case the event was a hint */
|
|
|
|
gdk_event_request_motions ((GdkEventMotion *) event);
|
|
|
|
|
2003-06-11 13:59:42 +00:00
|
|
|
return TRUE;
|
1997-11-24 22:05:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2017-05-17 19:28:40 +02:00
|
|
|
gimp_color_select_render (GtkWidget *preview,
|
|
|
|
guchar *buf,
|
|
|
|
gint width,
|
|
|
|
gint height,
|
|
|
|
gint rowstride,
|
|
|
|
ColorSelectFillType fill_type,
|
app, libgimpwidgets, modules: color selectors are now partly space-invaded.
What this commit does is keep the same code logic while moving to
GeglColor. Yet it's not **really** space-invaded yet. What we need to do
now:
1. Take into account the image space, and this is what we must navigate
through, in particular for various representations of RGB or HSV.
I.e. that if the active image is in anyRGB, the RGB values shown must
be within anyRGB. Right now, everything is still shown/used as sRGB
(even though it's properly retrieved and transformed to the target
space thanks to GeglColor).
2. Show space info to make things clear and explicit, by adding some
label somewhere.
3. Allow to switch between image and softproof spaces, regarding
out-of-gamut display. I.e. that while RGB/HSV must be shown within
the image space (assuming it's anyRGB), we may want to show
out-of-gamut area (pink areas) within the softproof space. This may
mean adding a checkbox. Or maybe simply taking into account whether
we are in softproof mode or not?
4. We can likely move off gimp_widget_get_color_transform() into using
gimp_widget_get_render_space() for display drawing. We don't need any
soft-proofing or black point compensation for any of these widgets so
pure babl is fine. Indeed we want to show any in-gamut color
correctly (and not transformed according to specific intents or
through soft-proofing). We will take care of the proofing case with
out-of-gamut area showing only.
5. In the various drawing functions, we should move to
CAIRO_FORMAT_RGBA128F. The color selection area might be wide enough
that it makes sense to be more accurate, especially as we are
essentially showing color gradients in 1 or 2 directions in these
various widgets.
2023-12-12 17:01:17 +09:00
|
|
|
GeglColor *color,
|
2017-05-17 19:28:40 +02:00
|
|
|
const guchar *oog_color)
|
1997-11-24 22:05:25 +00:00
|
|
|
{
|
2017-05-17 19:28:40 +02:00
|
|
|
ColorSelectFill csf;
|
1997-11-24 22:05:25 +00:00
|
|
|
|
2017-05-17 19:28:40 +02:00
|
|
|
csf.width = width;
|
|
|
|
csf.height = height;
|
|
|
|
csf.render_line = render_funcs[fill_type];
|
2009-10-17 18:51:48 +02:00
|
|
|
|
app, libgimpwidgets, modules: color selectors are now partly space-invaded.
What this commit does is keep the same code logic while moving to
GeglColor. Yet it's not **really** space-invaded yet. What we need to do
now:
1. Take into account the image space, and this is what we must navigate
through, in particular for various representations of RGB or HSV.
I.e. that if the active image is in anyRGB, the RGB values shown must
be within anyRGB. Right now, everything is still shown/used as sRGB
(even though it's properly retrieved and transformed to the target
space thanks to GeglColor).
2. Show space info to make things clear and explicit, by adding some
label somewhere.
3. Allow to switch between image and softproof spaces, regarding
out-of-gamut display. I.e. that while RGB/HSV must be shown within
the image space (assuming it's anyRGB), we may want to show
out-of-gamut area (pink areas) within the softproof space. This may
mean adding a checkbox. Or maybe simply taking into account whether
we are in softproof mode or not?
4. We can likely move off gimp_widget_get_color_transform() into using
gimp_widget_get_render_space() for display drawing. We don't need any
soft-proofing or black point compensation for any of these widgets so
pure babl is fine. Indeed we want to show any in-gamut color
correctly (and not transformed according to specific intents or
through soft-proofing). We will take care of the proofing case with
out-of-gamut area showing only.
5. In the various drawing functions, we should move to
CAIRO_FORMAT_RGBA128F. The color selection area might be wide enough
that it makes sense to be more accurate, especially as we are
essentially showing color gradients in 1 or 2 directions in these
various widgets.
2023-12-12 17:01:17 +09:00
|
|
|
gegl_color_get_pixel (color, babl_format ("R'G'B'A double"), csf.rgb);
|
|
|
|
gegl_color_get_pixel (color, babl_format ("HSVA double"), csf.hsv);
|
|
|
|
gegl_color_get_pixel (color, babl_format ("CIE LCH(ab) alpha double"), csf.lch);
|
|
|
|
|
2017-05-17 19:28:40 +02:00
|
|
|
csf.oog_color[0] = oog_color[0];
|
|
|
|
csf.oog_color[1] = oog_color[1];
|
|
|
|
csf.oog_color[2] = oog_color[2];
|
|
|
|
|
2004-07-31 01:59:46 +00:00
|
|
|
for (csf.y = 0; csf.y < csf.height; csf.y++)
|
2004-02-21 12:25:09 +00:00
|
|
|
{
|
2017-05-17 19:28:40 +02:00
|
|
|
csf.buffer = buf;
|
|
|
|
|
|
|
|
csf.render_line (&csf);
|
1997-11-24 22:05:25 +00:00
|
|
|
|
2017-05-17 19:28:40 +02:00
|
|
|
buf += rowstride;
|
2004-02-21 12:25:09 +00:00
|
|
|
}
|
1997-11-24 22:05:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2017-05-17 19:28:40 +02:00
|
|
|
color_select_render_red (ColorSelectFill *csf)
|
1997-11-24 22:05:25 +00:00
|
|
|
{
|
2015-10-08 22:24:13 +02:00
|
|
|
guchar *p = csf->buffer;
|
2001-01-08 02:24:29 +00:00
|
|
|
gint i, r;
|
1997-11-24 22:05:25 +00:00
|
|
|
|
|
|
|
r = (csf->height - csf->y + 1) * 255 / csf->height;
|
2015-10-08 22:24:13 +02:00
|
|
|
r = CLAMP (r, 0, 255);
|
1997-11-24 22:05:25 +00:00
|
|
|
|
|
|
|
for (i = 0; i < csf->width; i++)
|
|
|
|
{
|
|
|
|
*p++ = r;
|
|
|
|
*p++ = 0;
|
|
|
|
*p++ = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2017-05-17 19:28:40 +02:00
|
|
|
color_select_render_green (ColorSelectFill *csf)
|
1997-11-24 22:05:25 +00:00
|
|
|
{
|
2015-10-08 22:24:13 +02:00
|
|
|
guchar *p = csf->buffer;
|
2001-01-08 02:24:29 +00:00
|
|
|
gint i, g;
|
1997-11-24 22:05:25 +00:00
|
|
|
|
|
|
|
g = (csf->height - csf->y + 1) * 255 / csf->height;
|
2015-10-08 22:24:13 +02:00
|
|
|
g = CLAMP (g, 0, 255);
|
1997-11-24 22:05:25 +00:00
|
|
|
|
|
|
|
for (i = 0; i < csf->width; i++)
|
|
|
|
{
|
|
|
|
*p++ = 0;
|
|
|
|
*p++ = g;
|
|
|
|
*p++ = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2017-05-17 19:28:40 +02:00
|
|
|
color_select_render_blue (ColorSelectFill *csf)
|
1997-11-24 22:05:25 +00:00
|
|
|
{
|
2015-10-08 22:24:13 +02:00
|
|
|
guchar *p = csf->buffer;
|
2001-01-08 02:24:29 +00:00
|
|
|
gint i, b;
|
1997-11-24 22:05:25 +00:00
|
|
|
|
|
|
|
b = (csf->height - csf->y + 1) * 255 / csf->height;
|
2015-10-08 22:24:13 +02:00
|
|
|
b = CLAMP (b, 0, 255);
|
1997-11-24 22:05:25 +00:00
|
|
|
|
|
|
|
for (i = 0; i < csf->width; i++)
|
|
|
|
{
|
|
|
|
*p++ = 0;
|
|
|
|
*p++ = 0;
|
|
|
|
*p++ = b;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2017-05-17 19:28:40 +02:00
|
|
|
color_select_render_hue (ColorSelectFill *csf)
|
1997-11-24 22:05:25 +00:00
|
|
|
{
|
2015-10-08 22:24:13 +02:00
|
|
|
guchar *p = csf->buffer;
|
2001-01-08 02:24:29 +00:00
|
|
|
gfloat h, f;
|
|
|
|
gint r, g, b;
|
|
|
|
gint i;
|
1997-11-24 22:05:25 +00:00
|
|
|
|
2001-01-15 12:20:38 +00:00
|
|
|
h = csf->y * 360.0 / csf->height;
|
|
|
|
h = CLAMP (360 - h, 0, 360);
|
1997-11-24 22:05:25 +00:00
|
|
|
|
|
|
|
h /= 60;
|
|
|
|
f = (h - (int) h) * 255;
|
|
|
|
|
|
|
|
r = g = b = 0;
|
|
|
|
|
|
|
|
switch ((int) h)
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
r = 255;
|
|
|
|
g = f;
|
|
|
|
b = 0;
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
r = 255 - f;
|
|
|
|
g = 255;
|
|
|
|
b = 0;
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
r = 0;
|
|
|
|
g = 255;
|
|
|
|
b = f;
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
r = 0;
|
|
|
|
g = 255 - f;
|
|
|
|
b = 255;
|
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
r = f;
|
|
|
|
g = 0;
|
|
|
|
b = 255;
|
|
|
|
break;
|
|
|
|
case 5:
|
|
|
|
r = 255;
|
|
|
|
g = 0;
|
|
|
|
b = 255 - f;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < csf->width; i++)
|
|
|
|
{
|
|
|
|
*p++ = r;
|
|
|
|
*p++ = g;
|
|
|
|
*p++ = b;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2017-05-17 19:28:40 +02:00
|
|
|
color_select_render_saturation (ColorSelectFill *csf)
|
1997-11-24 22:05:25 +00:00
|
|
|
{
|
2015-10-08 22:24:13 +02:00
|
|
|
guchar *p = csf->buffer;
|
2001-01-08 02:24:29 +00:00
|
|
|
gint s;
|
|
|
|
gint i;
|
1997-11-24 22:05:25 +00:00
|
|
|
|
|
|
|
s = csf->y * 255 / csf->height;
|
2015-10-08 22:24:13 +02:00
|
|
|
s = CLAMP (s, 0, 255);
|
1997-11-24 22:05:25 +00:00
|
|
|
|
|
|
|
s = 255 - s;
|
|
|
|
|
|
|
|
for (i = 0; i < csf->width; i++)
|
|
|
|
{
|
|
|
|
*p++ = s;
|
|
|
|
*p++ = s;
|
|
|
|
*p++ = s;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2017-05-17 19:28:40 +02:00
|
|
|
color_select_render_value (ColorSelectFill *csf)
|
1997-11-24 22:05:25 +00:00
|
|
|
{
|
2015-10-08 22:24:13 +02:00
|
|
|
guchar *p = csf->buffer;
|
2001-01-08 02:24:29 +00:00
|
|
|
gint v;
|
|
|
|
gint i;
|
1997-11-24 22:05:25 +00:00
|
|
|
|
|
|
|
v = csf->y * 255 / csf->height;
|
2015-10-08 22:24:13 +02:00
|
|
|
v = CLAMP (v, 0, 255);
|
1997-11-24 22:05:25 +00:00
|
|
|
|
|
|
|
v = 255 - v;
|
|
|
|
|
|
|
|
for (i = 0; i < csf->width; i++)
|
|
|
|
{
|
|
|
|
*p++ = v;
|
|
|
|
*p++ = v;
|
|
|
|
*p++ = v;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2017-05-17 19:28:40 +02:00
|
|
|
color_select_render_lch_lightness (ColorSelectFill *csf)
|
|
|
|
{
|
|
|
|
guchar *p = csf->buffer;
|
app, libgimpwidgets, modules: color selectors are now partly space-invaded.
What this commit does is keep the same code logic while moving to
GeglColor. Yet it's not **really** space-invaded yet. What we need to do
now:
1. Take into account the image space, and this is what we must navigate
through, in particular for various representations of RGB or HSV.
I.e. that if the active image is in anyRGB, the RGB values shown must
be within anyRGB. Right now, everything is still shown/used as sRGB
(even though it's properly retrieved and transformed to the target
space thanks to GeglColor).
2. Show space info to make things clear and explicit, by adding some
label somewhere.
3. Allow to switch between image and softproof spaces, regarding
out-of-gamut display. I.e. that while RGB/HSV must be shown within
the image space (assuming it's anyRGB), we may want to show
out-of-gamut area (pink areas) within the softproof space. This may
mean adding a checkbox. Or maybe simply taking into account whether
we are in softproof mode or not?
4. We can likely move off gimp_widget_get_color_transform() into using
gimp_widget_get_render_space() for display drawing. We don't need any
soft-proofing or black point compensation for any of these widgets so
pure babl is fine. Indeed we want to show any in-gamut color
correctly (and not transformed according to specific intents or
through soft-proofing). We will take care of the proofing case with
out-of-gamut area showing only.
5. In the various drawing functions, we should move to
CAIRO_FORMAT_RGBA128F. The color selection area might be wide enough
that it makes sense to be more accurate, especially as we are
essentially showing color gradients in 1 or 2 directions in these
various widgets.
2023-12-12 17:01:17 +09:00
|
|
|
gdouble lch[4] = { 0.0, 0.0, 0.0, 1.0 };
|
2017-05-17 19:28:40 +02:00
|
|
|
guchar rgb[3];
|
|
|
|
gint i;
|
|
|
|
|
app, libgimpwidgets, modules: color selectors are now partly space-invaded.
What this commit does is keep the same code logic while moving to
GeglColor. Yet it's not **really** space-invaded yet. What we need to do
now:
1. Take into account the image space, and this is what we must navigate
through, in particular for various representations of RGB or HSV.
I.e. that if the active image is in anyRGB, the RGB values shown must
be within anyRGB. Right now, everything is still shown/used as sRGB
(even though it's properly retrieved and transformed to the target
space thanks to GeglColor).
2. Show space info to make things clear and explicit, by adding some
label somewhere.
3. Allow to switch between image and softproof spaces, regarding
out-of-gamut display. I.e. that while RGB/HSV must be shown within
the image space (assuming it's anyRGB), we may want to show
out-of-gamut area (pink areas) within the softproof space. This may
mean adding a checkbox. Or maybe simply taking into account whether
we are in softproof mode or not?
4. We can likely move off gimp_widget_get_color_transform() into using
gimp_widget_get_render_space() for display drawing. We don't need any
soft-proofing or black point compensation for any of these widgets so
pure babl is fine. Indeed we want to show any in-gamut color
correctly (and not transformed according to specific intents or
through soft-proofing). We will take care of the proofing case with
out-of-gamut area showing only.
5. In the various drawing functions, we should move to
CAIRO_FORMAT_RGBA128F. The color selection area might be wide enough
that it makes sense to be more accurate, especially as we are
essentially showing color gradients in 1 or 2 directions in these
various widgets.
2023-12-12 17:01:17 +09:00
|
|
|
lch[0] = (csf->height - 1 - csf->y) * 100.0 / csf->height;
|
2017-05-17 19:28:40 +02:00
|
|
|
babl_process (fish_lch_to_rgb_u8, &lch, &rgb, 1);
|
|
|
|
|
|
|
|
for (i = 0; i < csf->width; i++)
|
|
|
|
{
|
|
|
|
*p++ = rgb[0];
|
|
|
|
*p++ = rgb[1];
|
|
|
|
*p++ = rgb[2];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
color_select_render_lch_chroma (ColorSelectFill *csf)
|
|
|
|
{
|
|
|
|
guchar *p = csf->buffer;
|
app, libgimpwidgets, modules: color selectors are now partly space-invaded.
What this commit does is keep the same code logic while moving to
GeglColor. Yet it's not **really** space-invaded yet. What we need to do
now:
1. Take into account the image space, and this is what we must navigate
through, in particular for various representations of RGB or HSV.
I.e. that if the active image is in anyRGB, the RGB values shown must
be within anyRGB. Right now, everything is still shown/used as sRGB
(even though it's properly retrieved and transformed to the target
space thanks to GeglColor).
2. Show space info to make things clear and explicit, by adding some
label somewhere.
3. Allow to switch between image and softproof spaces, regarding
out-of-gamut display. I.e. that while RGB/HSV must be shown within
the image space (assuming it's anyRGB), we may want to show
out-of-gamut area (pink areas) within the softproof space. This may
mean adding a checkbox. Or maybe simply taking into account whether
we are in softproof mode or not?
4. We can likely move off gimp_widget_get_color_transform() into using
gimp_widget_get_render_space() for display drawing. We don't need any
soft-proofing or black point compensation for any of these widgets so
pure babl is fine. Indeed we want to show any in-gamut color
correctly (and not transformed according to specific intents or
through soft-proofing). We will take care of the proofing case with
out-of-gamut area showing only.
5. In the various drawing functions, we should move to
CAIRO_FORMAT_RGBA128F. The color selection area might be wide enough
that it makes sense to be more accurate, especially as we are
essentially showing color gradients in 1 or 2 directions in these
various widgets.
2023-12-12 17:01:17 +09:00
|
|
|
gdouble lch[4] = { 80.0, 0.0, 0.0, 1.0 };
|
2017-05-17 19:28:40 +02:00
|
|
|
guchar rgb[3];
|
|
|
|
gint i;
|
|
|
|
|
app, libgimpwidgets, modules: color selectors are now partly space-invaded.
What this commit does is keep the same code logic while moving to
GeglColor. Yet it's not **really** space-invaded yet. What we need to do
now:
1. Take into account the image space, and this is what we must navigate
through, in particular for various representations of RGB or HSV.
I.e. that if the active image is in anyRGB, the RGB values shown must
be within anyRGB. Right now, everything is still shown/used as sRGB
(even though it's properly retrieved and transformed to the target
space thanks to GeglColor).
2. Show space info to make things clear and explicit, by adding some
label somewhere.
3. Allow to switch between image and softproof spaces, regarding
out-of-gamut display. I.e. that while RGB/HSV must be shown within
the image space (assuming it's anyRGB), we may want to show
out-of-gamut area (pink areas) within the softproof space. This may
mean adding a checkbox. Or maybe simply taking into account whether
we are in softproof mode or not?
4. We can likely move off gimp_widget_get_color_transform() into using
gimp_widget_get_render_space() for display drawing. We don't need any
soft-proofing or black point compensation for any of these widgets so
pure babl is fine. Indeed we want to show any in-gamut color
correctly (and not transformed according to specific intents or
through soft-proofing). We will take care of the proofing case with
out-of-gamut area showing only.
5. In the various drawing functions, we should move to
CAIRO_FORMAT_RGBA128F. The color selection area might be wide enough
that it makes sense to be more accurate, especially as we are
essentially showing color gradients in 1 or 2 directions in these
various widgets.
2023-12-12 17:01:17 +09:00
|
|
|
lch[1] = (csf->height - 1 - csf->y) * 200.0 / csf->height ;
|
2017-05-17 19:28:40 +02:00
|
|
|
babl_process (fish_lch_to_rgb_u8, &lch, &rgb, 1);
|
|
|
|
|
|
|
|
for (i = 0; i < csf->width; i++)
|
|
|
|
{
|
|
|
|
*p++ = rgb[0];
|
|
|
|
*p++ = rgb[1];
|
|
|
|
*p++ = rgb[2];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
color_select_render_lch_hue (ColorSelectFill *csf)
|
|
|
|
{
|
app, libgimpwidgets, modules: color selectors are now partly space-invaded.
What this commit does is keep the same code logic while moving to
GeglColor. Yet it's not **really** space-invaded yet. What we need to do
now:
1. Take into account the image space, and this is what we must navigate
through, in particular for various representations of RGB or HSV.
I.e. that if the active image is in anyRGB, the RGB values shown must
be within anyRGB. Right now, everything is still shown/used as sRGB
(even though it's properly retrieved and transformed to the target
space thanks to GeglColor).
2. Show space info to make things clear and explicit, by adding some
label somewhere.
3. Allow to switch between image and softproof spaces, regarding
out-of-gamut display. I.e. that while RGB/HSV must be shown within
the image space (assuming it's anyRGB), we may want to show
out-of-gamut area (pink areas) within the softproof space. This may
mean adding a checkbox. Or maybe simply taking into account whether
we are in softproof mode or not?
4. We can likely move off gimp_widget_get_color_transform() into using
gimp_widget_get_render_space() for display drawing. We don't need any
soft-proofing or black point compensation for any of these widgets so
pure babl is fine. Indeed we want to show any in-gamut color
correctly (and not transformed according to specific intents or
through soft-proofing). We will take care of the proofing case with
out-of-gamut area showing only.
5. In the various drawing functions, we should move to
CAIRO_FORMAT_RGBA128F. The color selection area might be wide enough
that it makes sense to be more accurate, especially as we are
essentially showing color gradients in 1 or 2 directions in these
various widgets.
2023-12-12 17:01:17 +09:00
|
|
|
guchar *p = csf->buffer;
|
|
|
|
gdouble lch[4] = { 80.0, 200.0, 0.0, 1.0 };
|
2017-05-17 19:28:40 +02:00
|
|
|
guchar rgb[3];
|
|
|
|
gint i;
|
|
|
|
|
app, libgimpwidgets, modules: color selectors are now partly space-invaded.
What this commit does is keep the same code logic while moving to
GeglColor. Yet it's not **really** space-invaded yet. What we need to do
now:
1. Take into account the image space, and this is what we must navigate
through, in particular for various representations of RGB or HSV.
I.e. that if the active image is in anyRGB, the RGB values shown must
be within anyRGB. Right now, everything is still shown/used as sRGB
(even though it's properly retrieved and transformed to the target
space thanks to GeglColor).
2. Show space info to make things clear and explicit, by adding some
label somewhere.
3. Allow to switch between image and softproof spaces, regarding
out-of-gamut display. I.e. that while RGB/HSV must be shown within
the image space (assuming it's anyRGB), we may want to show
out-of-gamut area (pink areas) within the softproof space. This may
mean adding a checkbox. Or maybe simply taking into account whether
we are in softproof mode or not?
4. We can likely move off gimp_widget_get_color_transform() into using
gimp_widget_get_render_space() for display drawing. We don't need any
soft-proofing or black point compensation for any of these widgets so
pure babl is fine. Indeed we want to show any in-gamut color
correctly (and not transformed according to specific intents or
through soft-proofing). We will take care of the proofing case with
out-of-gamut area showing only.
5. In the various drawing functions, we should move to
CAIRO_FORMAT_RGBA128F. The color selection area might be wide enough
that it makes sense to be more accurate, especially as we are
essentially showing color gradients in 1 or 2 directions in these
various widgets.
2023-12-12 17:01:17 +09:00
|
|
|
lch[2] = (csf->height - 1 - csf->y) * 360.0 / csf->height;
|
2017-05-17 19:28:40 +02:00
|
|
|
babl_process (fish_lch_to_rgb_u8, &lch, &rgb, 1);
|
|
|
|
|
|
|
|
for (i = 0; i < csf->width; i++)
|
|
|
|
{
|
|
|
|
*p++ = rgb[0];
|
|
|
|
*p++ = rgb[1];
|
|
|
|
*p++ = rgb[2];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
color_select_render_red_green (ColorSelectFill *csf)
|
1997-11-24 22:05:25 +00:00
|
|
|
{
|
2017-05-18 17:59:49 +02:00
|
|
|
guchar *p = csf->buffer;
|
|
|
|
gfloat r = 0;
|
|
|
|
gfloat g = 0;
|
|
|
|
gfloat b = 0;
|
|
|
|
gfloat dr = 0;
|
|
|
|
gint i;
|
1997-11-24 22:05:25 +00:00
|
|
|
|
app, libgimpwidgets, modules: color selectors are now partly space-invaded.
What this commit does is keep the same code logic while moving to
GeglColor. Yet it's not **really** space-invaded yet. What we need to do
now:
1. Take into account the image space, and this is what we must navigate
through, in particular for various representations of RGB or HSV.
I.e. that if the active image is in anyRGB, the RGB values shown must
be within anyRGB. Right now, everything is still shown/used as sRGB
(even though it's properly retrieved and transformed to the target
space thanks to GeglColor).
2. Show space info to make things clear and explicit, by adding some
label somewhere.
3. Allow to switch between image and softproof spaces, regarding
out-of-gamut display. I.e. that while RGB/HSV must be shown within
the image space (assuming it's anyRGB), we may want to show
out-of-gamut area (pink areas) within the softproof space. This may
mean adding a checkbox. Or maybe simply taking into account whether
we are in softproof mode or not?
4. We can likely move off gimp_widget_get_color_transform() into using
gimp_widget_get_render_space() for display drawing. We don't need any
soft-proofing or black point compensation for any of these widgets so
pure babl is fine. Indeed we want to show any in-gamut color
correctly (and not transformed according to specific intents or
through soft-proofing). We will take care of the proofing case with
out-of-gamut area showing only.
5. In the various drawing functions, we should move to
CAIRO_FORMAT_RGBA128F. The color selection area might be wide enough
that it makes sense to be more accurate, especially as we are
essentially showing color gradients in 1 or 2 directions in these
various widgets.
2023-12-12 17:01:17 +09:00
|
|
|
b = csf->rgb[2] * 255.0;
|
1997-11-24 22:05:25 +00:00
|
|
|
|
2017-05-18 17:59:49 +02:00
|
|
|
if (b < 0.0 || b > 255.0)
|
|
|
|
{
|
|
|
|
r = csf->oog_color[0];
|
|
|
|
g = csf->oog_color[1];
|
|
|
|
b = csf->oog_color[2];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
g = (csf->height - csf->y + 1) * 255.0 / csf->height;
|
1997-11-24 22:05:25 +00:00
|
|
|
|
2017-05-18 17:59:49 +02:00
|
|
|
dr = 255.0 / csf->width;
|
|
|
|
}
|
1997-11-24 22:05:25 +00:00
|
|
|
|
|
|
|
for (i = 0; i < csf->width; i++)
|
|
|
|
{
|
|
|
|
*p++ = r;
|
|
|
|
*p++ = g;
|
|
|
|
*p++ = b;
|
|
|
|
|
2015-10-08 23:47:16 +02:00
|
|
|
r += dr;
|
1997-11-24 22:05:25 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2017-05-17 19:28:40 +02:00
|
|
|
color_select_render_red_blue (ColorSelectFill *csf)
|
1997-11-24 22:05:25 +00:00
|
|
|
{
|
2017-05-18 17:59:49 +02:00
|
|
|
guchar *p = csf->buffer;
|
|
|
|
gfloat r = 0;
|
|
|
|
gfloat g = 0;
|
|
|
|
gfloat b = 0;
|
|
|
|
gfloat dr = 0;
|
|
|
|
gint i;
|
1997-11-24 22:05:25 +00:00
|
|
|
|
app, libgimpwidgets, modules: color selectors are now partly space-invaded.
What this commit does is keep the same code logic while moving to
GeglColor. Yet it's not **really** space-invaded yet. What we need to do
now:
1. Take into account the image space, and this is what we must navigate
through, in particular for various representations of RGB or HSV.
I.e. that if the active image is in anyRGB, the RGB values shown must
be within anyRGB. Right now, everything is still shown/used as sRGB
(even though it's properly retrieved and transformed to the target
space thanks to GeglColor).
2. Show space info to make things clear and explicit, by adding some
label somewhere.
3. Allow to switch between image and softproof spaces, regarding
out-of-gamut display. I.e. that while RGB/HSV must be shown within
the image space (assuming it's anyRGB), we may want to show
out-of-gamut area (pink areas) within the softproof space. This may
mean adding a checkbox. Or maybe simply taking into account whether
we are in softproof mode or not?
4. We can likely move off gimp_widget_get_color_transform() into using
gimp_widget_get_render_space() for display drawing. We don't need any
soft-proofing or black point compensation for any of these widgets so
pure babl is fine. Indeed we want to show any in-gamut color
correctly (and not transformed according to specific intents or
through soft-proofing). We will take care of the proofing case with
out-of-gamut area showing only.
5. In the various drawing functions, we should move to
CAIRO_FORMAT_RGBA128F. The color selection area might be wide enough
that it makes sense to be more accurate, especially as we are
essentially showing color gradients in 1 or 2 directions in these
various widgets.
2023-12-12 17:01:17 +09:00
|
|
|
g = csf->rgb[1] * 255.0;
|
1997-11-24 22:05:25 +00:00
|
|
|
|
2017-05-18 17:59:49 +02:00
|
|
|
if (g < 0.0 || g > 255.0)
|
|
|
|
{
|
|
|
|
r = csf->oog_color[0];
|
|
|
|
g = csf->oog_color[1];
|
|
|
|
b = csf->oog_color[2];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
b = (csf->height - csf->y + 1) * 255.0 / csf->height;
|
1997-11-24 22:05:25 +00:00
|
|
|
|
2017-05-18 17:59:49 +02:00
|
|
|
dr = 255.0 / csf->width;
|
|
|
|
}
|
1997-11-24 22:05:25 +00:00
|
|
|
|
|
|
|
for (i = 0; i < csf->width; i++)
|
|
|
|
{
|
|
|
|
*p++ = r;
|
|
|
|
*p++ = g;
|
|
|
|
*p++ = b;
|
|
|
|
|
2015-10-08 23:47:16 +02:00
|
|
|
r += dr;
|
1997-11-24 22:05:25 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2017-05-17 19:28:40 +02:00
|
|
|
color_select_render_green_blue (ColorSelectFill *csf)
|
1997-11-24 22:05:25 +00:00
|
|
|
{
|
2017-05-18 17:59:49 +02:00
|
|
|
guchar *p = csf->buffer;
|
|
|
|
gfloat r = 0;
|
|
|
|
gfloat g = 0;
|
|
|
|
gfloat b = 0;
|
|
|
|
gfloat dg = 0;
|
|
|
|
gint i;
|
1997-11-24 22:05:25 +00:00
|
|
|
|
app, libgimpwidgets, modules: color selectors are now partly space-invaded.
What this commit does is keep the same code logic while moving to
GeglColor. Yet it's not **really** space-invaded yet. What we need to do
now:
1. Take into account the image space, and this is what we must navigate
through, in particular for various representations of RGB or HSV.
I.e. that if the active image is in anyRGB, the RGB values shown must
be within anyRGB. Right now, everything is still shown/used as sRGB
(even though it's properly retrieved and transformed to the target
space thanks to GeglColor).
2. Show space info to make things clear and explicit, by adding some
label somewhere.
3. Allow to switch between image and softproof spaces, regarding
out-of-gamut display. I.e. that while RGB/HSV must be shown within
the image space (assuming it's anyRGB), we may want to show
out-of-gamut area (pink areas) within the softproof space. This may
mean adding a checkbox. Or maybe simply taking into account whether
we are in softproof mode or not?
4. We can likely move off gimp_widget_get_color_transform() into using
gimp_widget_get_render_space() for display drawing. We don't need any
soft-proofing or black point compensation for any of these widgets so
pure babl is fine. Indeed we want to show any in-gamut color
correctly (and not transformed according to specific intents or
through soft-proofing). We will take care of the proofing case with
out-of-gamut area showing only.
5. In the various drawing functions, we should move to
CAIRO_FORMAT_RGBA128F. The color selection area might be wide enough
that it makes sense to be more accurate, especially as we are
essentially showing color gradients in 1 or 2 directions in these
various widgets.
2023-12-12 17:01:17 +09:00
|
|
|
r = csf->rgb[0] * 255.0;
|
1997-11-24 22:05:25 +00:00
|
|
|
|
2017-05-18 17:59:49 +02:00
|
|
|
if (r < 0.0 || r > 255.0)
|
|
|
|
{
|
|
|
|
r = csf->oog_color[0];
|
|
|
|
g = csf->oog_color[1];
|
|
|
|
b = csf->oog_color[2];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
b = (csf->height - csf->y + 1) * 255.0 / csf->height;
|
1997-11-24 22:05:25 +00:00
|
|
|
|
2017-05-18 17:59:49 +02:00
|
|
|
dg = 255.0 / csf->width;
|
|
|
|
}
|
1997-11-24 22:05:25 +00:00
|
|
|
|
|
|
|
for (i = 0; i < csf->width; i++)
|
|
|
|
{
|
|
|
|
*p++ = r;
|
|
|
|
*p++ = g;
|
|
|
|
*p++ = b;
|
|
|
|
|
2015-10-08 23:47:16 +02:00
|
|
|
g += dg;
|
1997-11-24 22:05:25 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2017-05-17 19:28:40 +02:00
|
|
|
color_select_render_hue_saturation (ColorSelectFill *csf)
|
1997-11-24 22:05:25 +00:00
|
|
|
{
|
2015-10-08 22:24:13 +02:00
|
|
|
guchar *p = csf->buffer;
|
2015-10-08 23:47:16 +02:00
|
|
|
gfloat h, dh, s, v;
|
2001-01-08 02:24:29 +00:00
|
|
|
gint f;
|
|
|
|
gint i;
|
1997-11-24 22:05:25 +00:00
|
|
|
|
app, libgimpwidgets, modules: color selectors are now partly space-invaded.
What this commit does is keep the same code logic while moving to
GeglColor. Yet it's not **really** space-invaded yet. What we need to do
now:
1. Take into account the image space, and this is what we must navigate
through, in particular for various representations of RGB or HSV.
I.e. that if the active image is in anyRGB, the RGB values shown must
be within anyRGB. Right now, everything is still shown/used as sRGB
(even though it's properly retrieved and transformed to the target
space thanks to GeglColor).
2. Show space info to make things clear and explicit, by adding some
label somewhere.
3. Allow to switch between image and softproof spaces, regarding
out-of-gamut display. I.e. that while RGB/HSV must be shown within
the image space (assuming it's anyRGB), we may want to show
out-of-gamut area (pink areas) within the softproof space. This may
mean adding a checkbox. Or maybe simply taking into account whether
we are in softproof mode or not?
4. We can likely move off gimp_widget_get_color_transform() into using
gimp_widget_get_render_space() for display drawing. We don't need any
soft-proofing or black point compensation for any of these widgets so
pure babl is fine. Indeed we want to show any in-gamut color
correctly (and not transformed according to specific intents or
through soft-proofing). We will take care of the proofing case with
out-of-gamut area showing only.
5. In the various drawing functions, we should move to
CAIRO_FORMAT_RGBA128F. The color selection area might be wide enough
that it makes sense to be more accurate, especially as we are
essentially showing color gradients in 1 or 2 directions in these
various widgets.
2023-12-12 17:01:17 +09:00
|
|
|
v = csf->hsv[2];
|
1997-11-24 22:05:25 +00:00
|
|
|
|
2015-10-08 23:47:16 +02:00
|
|
|
s = (gfloat) csf->y / csf->height;
|
|
|
|
s = CLAMP (s, 0.0, 1.0);
|
|
|
|
s = 1.0 - s;
|
1997-11-24 22:05:25 +00:00
|
|
|
|
2015-10-08 23:47:16 +02:00
|
|
|
h = 0;
|
|
|
|
dh = 360.0 / csf->width;
|
1997-11-24 22:05:25 +00:00
|
|
|
|
2015-10-08 23:47:16 +02:00
|
|
|
for (i = 0; i < csf->width; i++)
|
1997-11-24 22:05:25 +00:00
|
|
|
{
|
2017-05-18 17:59:49 +02:00
|
|
|
gfloat r, g, b;
|
|
|
|
|
2015-10-08 23:47:16 +02:00
|
|
|
f = ((h / 60) - (int) (h / 60)) * 255;
|
|
|
|
|
|
|
|
switch ((int) (h / 60))
|
2004-09-10 13:16:55 +00:00
|
|
|
{
|
2017-05-18 17:59:49 +02:00
|
|
|
default:
|
2015-10-08 23:47:16 +02:00
|
|
|
case 0:
|
2017-05-18 17:59:49 +02:00
|
|
|
r = v * 255;
|
|
|
|
g = v * (255 - (s * (255 - f)));
|
|
|
|
b = v * 255 * (1 - s);
|
2015-10-08 23:47:16 +02:00
|
|
|
break;
|
|
|
|
case 1:
|
2017-05-18 17:59:49 +02:00
|
|
|
r = v * (255 - s * f);
|
|
|
|
g = v * 255;
|
|
|
|
b = v * 255 * (1 - s);
|
2015-10-08 23:47:16 +02:00
|
|
|
break;
|
|
|
|
case 2:
|
2017-05-18 17:59:49 +02:00
|
|
|
r = v * 255 * (1 - s);
|
|
|
|
g = v *255;
|
|
|
|
b = v * (255 - (s * (255 - f)));
|
2015-10-08 23:47:16 +02:00
|
|
|
break;
|
|
|
|
case 3:
|
2017-05-18 17:59:49 +02:00
|
|
|
r = v * 255 * (1 - s);
|
|
|
|
g = v * (255 - s * f);
|
|
|
|
b = v * 255;
|
2015-10-08 23:47:16 +02:00
|
|
|
break;
|
|
|
|
case 4:
|
2017-05-18 17:59:49 +02:00
|
|
|
r = v * (255 - (s * (255 - f)));
|
|
|
|
g = v * (255 * (1 - s));
|
|
|
|
b = v * 255;
|
2015-10-08 23:47:16 +02:00
|
|
|
break;
|
|
|
|
case 5:
|
2017-05-18 17:59:49 +02:00
|
|
|
r = v * 255;
|
|
|
|
g = v * 255 * (1 - s);
|
|
|
|
b = v * (255 - s * f);
|
2015-10-08 23:47:16 +02:00
|
|
|
break;
|
2004-09-10 13:16:55 +00:00
|
|
|
}
|
2015-10-08 23:47:16 +02:00
|
|
|
|
2017-05-18 17:59:49 +02:00
|
|
|
if (r < 0.0 || r > 255.0 ||
|
|
|
|
g < 0.0 || g > 255.0 ||
|
|
|
|
b < 0.0 || b > 255.0)
|
|
|
|
{
|
|
|
|
*p++ = csf->oog_color[0];
|
|
|
|
*p++ = csf->oog_color[1];
|
|
|
|
*p++ = csf->oog_color[2];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
*p++ = r;
|
|
|
|
*p++ = g;
|
|
|
|
*p++ = b;
|
|
|
|
}
|
|
|
|
|
2015-10-08 23:47:16 +02:00
|
|
|
h += dh;
|
1997-11-24 22:05:25 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2017-05-17 19:28:40 +02:00
|
|
|
color_select_render_hue_value (ColorSelectFill *csf)
|
1997-11-24 22:05:25 +00:00
|
|
|
{
|
2015-10-08 22:24:13 +02:00
|
|
|
guchar *p = csf->buffer;
|
2015-10-08 23:47:16 +02:00
|
|
|
gfloat h, dh, s, v;
|
2001-01-08 02:24:29 +00:00
|
|
|
gint f;
|
|
|
|
gint i;
|
1997-11-24 22:05:25 +00:00
|
|
|
|
app, libgimpwidgets, modules: color selectors are now partly space-invaded.
What this commit does is keep the same code logic while moving to
GeglColor. Yet it's not **really** space-invaded yet. What we need to do
now:
1. Take into account the image space, and this is what we must navigate
through, in particular for various representations of RGB or HSV.
I.e. that if the active image is in anyRGB, the RGB values shown must
be within anyRGB. Right now, everything is still shown/used as sRGB
(even though it's properly retrieved and transformed to the target
space thanks to GeglColor).
2. Show space info to make things clear and explicit, by adding some
label somewhere.
3. Allow to switch between image and softproof spaces, regarding
out-of-gamut display. I.e. that while RGB/HSV must be shown within
the image space (assuming it's anyRGB), we may want to show
out-of-gamut area (pink areas) within the softproof space. This may
mean adding a checkbox. Or maybe simply taking into account whether
we are in softproof mode or not?
4. We can likely move off gimp_widget_get_color_transform() into using
gimp_widget_get_render_space() for display drawing. We don't need any
soft-proofing or black point compensation for any of these widgets so
pure babl is fine. Indeed we want to show any in-gamut color
correctly (and not transformed according to specific intents or
through soft-proofing). We will take care of the proofing case with
out-of-gamut area showing only.
5. In the various drawing functions, we should move to
CAIRO_FORMAT_RGBA128F. The color selection area might be wide enough
that it makes sense to be more accurate, especially as we are
essentially showing color gradients in 1 or 2 directions in these
various widgets.
2023-12-12 17:01:17 +09:00
|
|
|
s = csf->hsv[1];
|
1997-11-24 22:05:25 +00:00
|
|
|
|
2015-10-08 23:47:16 +02:00
|
|
|
v = (gfloat) csf->y / csf->height;
|
|
|
|
v = CLAMP (v, 0.0, 1.0);
|
|
|
|
v = 1.0 - v;
|
1997-11-24 22:05:25 +00:00
|
|
|
|
2015-10-08 23:47:16 +02:00
|
|
|
h = 0;
|
|
|
|
dh = 360.0 / csf->width;
|
1997-11-24 22:05:25 +00:00
|
|
|
|
2015-10-08 23:47:16 +02:00
|
|
|
for (i = 0; i < csf->width; i++)
|
1997-11-24 22:05:25 +00:00
|
|
|
{
|
2017-05-18 17:59:49 +02:00
|
|
|
gfloat r, g, b;
|
|
|
|
|
2015-10-08 23:47:16 +02:00
|
|
|
f = ((h / 60) - (int) (h / 60)) * 255;
|
|
|
|
|
|
|
|
switch ((int) (h / 60))
|
2004-09-10 13:16:55 +00:00
|
|
|
{
|
2017-05-18 17:59:49 +02:00
|
|
|
default:
|
2015-10-08 23:47:16 +02:00
|
|
|
case 0:
|
2017-05-18 17:59:49 +02:00
|
|
|
r = v * 255;
|
|
|
|
g = v * (255 - (s * (255 - f)));
|
|
|
|
b = v * 255 * (1 - s);
|
2015-10-08 23:47:16 +02:00
|
|
|
break;
|
|
|
|
case 1:
|
2017-05-18 17:59:49 +02:00
|
|
|
r = v * (255 - s * f);
|
|
|
|
g = v * 255;
|
|
|
|
b = v * 255 * (1 - s);
|
2015-10-08 23:47:16 +02:00
|
|
|
break;
|
|
|
|
case 2:
|
2017-05-18 17:59:49 +02:00
|
|
|
r = v * 255 * (1 - s);
|
|
|
|
g = v *255;
|
|
|
|
b = v * (255 - (s * (255 - f)));
|
2015-10-08 23:47:16 +02:00
|
|
|
break;
|
|
|
|
case 3:
|
2017-05-18 17:59:49 +02:00
|
|
|
r = v * 255 * (1 - s);
|
|
|
|
g = v * (255 - s * f);
|
|
|
|
b = v * 255;
|
2015-10-08 23:47:16 +02:00
|
|
|
break;
|
|
|
|
case 4:
|
2017-05-18 17:59:49 +02:00
|
|
|
r = v * (255 - (s * (255 - f)));
|
|
|
|
g = v * (255 * (1 - s));
|
|
|
|
b = v * 255;
|
2015-10-08 23:47:16 +02:00
|
|
|
break;
|
|
|
|
case 5:
|
2017-05-18 17:59:49 +02:00
|
|
|
r = v * 255;
|
|
|
|
g = v * 255 * (1 - s);
|
|
|
|
b = v * (255 - s * f);
|
2015-10-08 23:47:16 +02:00
|
|
|
break;
|
2004-09-10 13:16:55 +00:00
|
|
|
}
|
2015-10-08 23:47:16 +02:00
|
|
|
|
2017-05-18 17:59:49 +02:00
|
|
|
if (r < 0.0 || r > 255.0 ||
|
|
|
|
g < 0.0 || g > 255.0 ||
|
|
|
|
b < 0.0 || b > 255.0)
|
|
|
|
{
|
|
|
|
*p++ = csf->oog_color[0];
|
|
|
|
*p++ = csf->oog_color[1];
|
|
|
|
*p++ = csf->oog_color[2];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
*p++ = r;
|
|
|
|
*p++ = g;
|
|
|
|
*p++ = b;
|
|
|
|
}
|
|
|
|
|
2015-10-08 23:47:16 +02:00
|
|
|
h += dh;
|
1997-11-24 22:05:25 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2017-05-17 19:28:40 +02:00
|
|
|
color_select_render_saturation_value (ColorSelectFill *csf)
|
1997-11-24 22:05:25 +00:00
|
|
|
{
|
2015-10-08 22:24:13 +02:00
|
|
|
guchar *p = csf->buffer;
|
2015-10-08 23:47:16 +02:00
|
|
|
gfloat h, s, ds, v;
|
2001-01-08 02:24:29 +00:00
|
|
|
gint f;
|
|
|
|
gint i;
|
1997-11-24 22:05:25 +00:00
|
|
|
|
app, libgimpwidgets, modules: color selectors are now partly space-invaded.
What this commit does is keep the same code logic while moving to
GeglColor. Yet it's not **really** space-invaded yet. What we need to do
now:
1. Take into account the image space, and this is what we must navigate
through, in particular for various representations of RGB or HSV.
I.e. that if the active image is in anyRGB, the RGB values shown must
be within anyRGB. Right now, everything is still shown/used as sRGB
(even though it's properly retrieved and transformed to the target
space thanks to GeglColor).
2. Show space info to make things clear and explicit, by adding some
label somewhere.
3. Allow to switch between image and softproof spaces, regarding
out-of-gamut display. I.e. that while RGB/HSV must be shown within
the image space (assuming it's anyRGB), we may want to show
out-of-gamut area (pink areas) within the softproof space. This may
mean adding a checkbox. Or maybe simply taking into account whether
we are in softproof mode or not?
4. We can likely move off gimp_widget_get_color_transform() into using
gimp_widget_get_render_space() for display drawing. We don't need any
soft-proofing or black point compensation for any of these widgets so
pure babl is fine. Indeed we want to show any in-gamut color
correctly (and not transformed according to specific intents or
through soft-proofing). We will take care of the proofing case with
out-of-gamut area showing only.
5. In the various drawing functions, we should move to
CAIRO_FORMAT_RGBA128F. The color selection area might be wide enough
that it makes sense to be more accurate, especially as we are
essentially showing color gradients in 1 or 2 directions in these
various widgets.
2023-12-12 17:01:17 +09:00
|
|
|
h = (gfloat) csf->hsv[0] * 360.0;
|
1997-11-24 22:05:25 +00:00
|
|
|
if (h >= 360)
|
|
|
|
h -= 360;
|
|
|
|
h /= 60;
|
2001-01-09 01:23:54 +00:00
|
|
|
f = (h - (gint) h) * 255;
|
1997-11-24 22:05:25 +00:00
|
|
|
|
2015-10-08 23:47:16 +02:00
|
|
|
v = (gfloat) csf->y / csf->height;
|
|
|
|
v = CLAMP (v, 0.0, 1.0);
|
|
|
|
v = 1.0 - v;
|
|
|
|
|
|
|
|
s = 0;
|
|
|
|
ds = 1.0 / csf->width;
|
1997-11-24 22:05:25 +00:00
|
|
|
|
2001-01-09 01:23:54 +00:00
|
|
|
switch ((gint) h)
|
1997-11-24 22:05:25 +00:00
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
for (i = 0; i < csf->width; i++)
|
2004-09-10 13:16:55 +00:00
|
|
|
{
|
|
|
|
*p++ = v * 255;
|
|
|
|
*p++ = v * (255 - (s * (255 - f)));
|
|
|
|
*p++ = v * 255 * (1 - s);
|
1997-11-24 22:05:25 +00:00
|
|
|
|
2015-10-08 23:47:16 +02:00
|
|
|
s += ds;
|
2004-09-10 13:16:55 +00:00
|
|
|
}
|
1997-11-24 22:05:25 +00:00
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
for (i = 0; i < csf->width; i++)
|
2004-09-10 13:16:55 +00:00
|
|
|
{
|
|
|
|
*p++ = v * (255 - s * f);
|
|
|
|
*p++ = v * 255;
|
|
|
|
*p++ = v * 255 * (1 - s);
|
1997-11-24 22:05:25 +00:00
|
|
|
|
2015-10-08 23:47:16 +02:00
|
|
|
s += ds;
|
2004-09-10 13:16:55 +00:00
|
|
|
}
|
1997-11-24 22:05:25 +00:00
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
for (i = 0; i < csf->width; i++)
|
2004-09-10 13:16:55 +00:00
|
|
|
{
|
|
|
|
*p++ = v * 255 * (1 - s);
|
|
|
|
*p++ = v *255;
|
|
|
|
*p++ = v * (255 - (s * (255 - f)));
|
1997-11-24 22:05:25 +00:00
|
|
|
|
2015-10-08 23:47:16 +02:00
|
|
|
s += ds;
|
2004-09-10 13:16:55 +00:00
|
|
|
}
|
1997-11-24 22:05:25 +00:00
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
for (i = 0; i < csf->width; i++)
|
2004-09-10 13:16:55 +00:00
|
|
|
{
|
|
|
|
*p++ = v * 255 * (1 - s);
|
|
|
|
*p++ = v * (255 - s * f);
|
|
|
|
*p++ = v * 255;
|
1997-11-24 22:05:25 +00:00
|
|
|
|
2015-10-08 23:47:16 +02:00
|
|
|
s += ds;
|
2004-09-10 13:16:55 +00:00
|
|
|
}
|
1997-11-24 22:05:25 +00:00
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
for (i = 0; i < csf->width; i++)
|
2004-09-10 13:16:55 +00:00
|
|
|
{
|
|
|
|
*p++ = v * (255 - (s * (255 - f)));
|
|
|
|
*p++ = v * (255 * (1 - s));
|
|
|
|
*p++ = v * 255;
|
1997-11-24 22:05:25 +00:00
|
|
|
|
2015-10-08 23:47:16 +02:00
|
|
|
s += ds;
|
2004-09-10 13:16:55 +00:00
|
|
|
}
|
1997-11-24 22:05:25 +00:00
|
|
|
break;
|
|
|
|
case 5:
|
|
|
|
for (i = 0; i < csf->width; i++)
|
2004-09-10 13:16:55 +00:00
|
|
|
{
|
|
|
|
*p++ = v * 255;
|
|
|
|
*p++ = v * 255 * (1 - s);
|
|
|
|
*p++ = v * (255 - s * f);
|
1997-11-24 22:05:25 +00:00
|
|
|
|
2015-10-08 23:47:16 +02:00
|
|
|
s += ds;
|
2004-09-10 13:16:55 +00:00
|
|
|
}
|
1997-11-24 22:05:25 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2017-05-17 19:28:40 +02:00
|
|
|
|
|
|
|
static void
|
|
|
|
color_select_render_lch_chroma_lightness (ColorSelectFill *csf)
|
|
|
|
{
|
|
|
|
guchar *p = csf->buffer;
|
app, libgimpwidgets, modules: color selectors are now partly space-invaded.
What this commit does is keep the same code logic while moving to
GeglColor. Yet it's not **really** space-invaded yet. What we need to do
now:
1. Take into account the image space, and this is what we must navigate
through, in particular for various representations of RGB or HSV.
I.e. that if the active image is in anyRGB, the RGB values shown must
be within anyRGB. Right now, everything is still shown/used as sRGB
(even though it's properly retrieved and transformed to the target
space thanks to GeglColor).
2. Show space info to make things clear and explicit, by adding some
label somewhere.
3. Allow to switch between image and softproof spaces, regarding
out-of-gamut display. I.e. that while RGB/HSV must be shown within
the image space (assuming it's anyRGB), we may want to show
out-of-gamut area (pink areas) within the softproof space. This may
mean adding a checkbox. Or maybe simply taking into account whether
we are in softproof mode or not?
4. We can likely move off gimp_widget_get_color_transform() into using
gimp_widget_get_render_space() for display drawing. We don't need any
soft-proofing or black point compensation for any of these widgets so
pure babl is fine. Indeed we want to show any in-gamut color
correctly (and not transformed according to specific intents or
through soft-proofing). We will take care of the proofing case with
out-of-gamut area showing only.
5. In the various drawing functions, we should move to
CAIRO_FORMAT_RGBA128F. The color selection area might be wide enough
that it makes sense to be more accurate, especially as we are
essentially showing color gradients in 1 or 2 directions in these
various widgets.
2023-12-12 17:01:17 +09:00
|
|
|
gdouble lch[3];
|
2017-05-17 19:28:40 +02:00
|
|
|
gint i;
|
|
|
|
|
app, libgimpwidgets, modules: color selectors are now partly space-invaded.
What this commit does is keep the same code logic while moving to
GeglColor. Yet it's not **really** space-invaded yet. What we need to do
now:
1. Take into account the image space, and this is what we must navigate
through, in particular for various representations of RGB or HSV.
I.e. that if the active image is in anyRGB, the RGB values shown must
be within anyRGB. Right now, everything is still shown/used as sRGB
(even though it's properly retrieved and transformed to the target
space thanks to GeglColor).
2. Show space info to make things clear and explicit, by adding some
label somewhere.
3. Allow to switch between image and softproof spaces, regarding
out-of-gamut display. I.e. that while RGB/HSV must be shown within
the image space (assuming it's anyRGB), we may want to show
out-of-gamut area (pink areas) within the softproof space. This may
mean adding a checkbox. Or maybe simply taking into account whether
we are in softproof mode or not?
4. We can likely move off gimp_widget_get_color_transform() into using
gimp_widget_get_render_space() for display drawing. We don't need any
soft-proofing or black point compensation for any of these widgets so
pure babl is fine. Indeed we want to show any in-gamut color
correctly (and not transformed according to specific intents or
through soft-proofing). We will take care of the proofing case with
out-of-gamut area showing only.
5. In the various drawing functions, we should move to
CAIRO_FORMAT_RGBA128F. The color selection area might be wide enough
that it makes sense to be more accurate, especially as we are
essentially showing color gradients in 1 or 2 directions in these
various widgets.
2023-12-12 17:01:17 +09:00
|
|
|
lch[0] = (csf->height - 1 - csf->y) * 100.0 / csf->height;
|
|
|
|
lch[2] = csf->lch[2];
|
2017-05-17 19:28:40 +02:00
|
|
|
|
|
|
|
for (i = 0; i < csf->width; i++)
|
|
|
|
{
|
app, libgimpwidgets, modules: color selectors are now partly space-invaded.
What this commit does is keep the same code logic while moving to
GeglColor. Yet it's not **really** space-invaded yet. What we need to do
now:
1. Take into account the image space, and this is what we must navigate
through, in particular for various representations of RGB or HSV.
I.e. that if the active image is in anyRGB, the RGB values shown must
be within anyRGB. Right now, everything is still shown/used as sRGB
(even though it's properly retrieved and transformed to the target
space thanks to GeglColor).
2. Show space info to make things clear and explicit, by adding some
label somewhere.
3. Allow to switch between image and softproof spaces, regarding
out-of-gamut display. I.e. that while RGB/HSV must be shown within
the image space (assuming it's anyRGB), we may want to show
out-of-gamut area (pink areas) within the softproof space. This may
mean adding a checkbox. Or maybe simply taking into account whether
we are in softproof mode or not?
4. We can likely move off gimp_widget_get_color_transform() into using
gimp_widget_get_render_space() for display drawing. We don't need any
soft-proofing or black point compensation for any of these widgets so
pure babl is fine. Indeed we want to show any in-gamut color
correctly (and not transformed according to specific intents or
through soft-proofing). We will take care of the proofing case with
out-of-gamut area showing only.
5. In the various drawing functions, we should move to
CAIRO_FORMAT_RGBA128F. The color selection area might be wide enough
that it makes sense to be more accurate, especially as we are
essentially showing color gradients in 1 or 2 directions in these
various widgets.
2023-12-12 17:01:17 +09:00
|
|
|
gdouble rgb[3];
|
2017-05-17 19:28:40 +02:00
|
|
|
|
app, libgimpwidgets, modules: color selectors are now partly space-invaded.
What this commit does is keep the same code logic while moving to
GeglColor. Yet it's not **really** space-invaded yet. What we need to do
now:
1. Take into account the image space, and this is what we must navigate
through, in particular for various representations of RGB or HSV.
I.e. that if the active image is in anyRGB, the RGB values shown must
be within anyRGB. Right now, everything is still shown/used as sRGB
(even though it's properly retrieved and transformed to the target
space thanks to GeglColor).
2. Show space info to make things clear and explicit, by adding some
label somewhere.
3. Allow to switch between image and softproof spaces, regarding
out-of-gamut display. I.e. that while RGB/HSV must be shown within
the image space (assuming it's anyRGB), we may want to show
out-of-gamut area (pink areas) within the softproof space. This may
mean adding a checkbox. Or maybe simply taking into account whether
we are in softproof mode or not?
4. We can likely move off gimp_widget_get_color_transform() into using
gimp_widget_get_render_space() for display drawing. We don't need any
soft-proofing or black point compensation for any of these widgets so
pure babl is fine. Indeed we want to show any in-gamut color
correctly (and not transformed according to specific intents or
through soft-proofing). We will take care of the proofing case with
out-of-gamut area showing only.
5. In the various drawing functions, we should move to
CAIRO_FORMAT_RGBA128F. The color selection area might be wide enough
that it makes sense to be more accurate, especially as we are
essentially showing color gradients in 1 or 2 directions in these
various widgets.
2023-12-12 17:01:17 +09:00
|
|
|
lch[1] = i * 200.0 / csf->width;
|
2017-05-17 19:28:40 +02:00
|
|
|
|
|
|
|
babl_process (fish_lch_to_rgb, &lch, &rgb, 1);
|
|
|
|
|
app, libgimpwidgets, modules: color selectors are now partly space-invaded.
What this commit does is keep the same code logic while moving to
GeglColor. Yet it's not **really** space-invaded yet. What we need to do
now:
1. Take into account the image space, and this is what we must navigate
through, in particular for various representations of RGB or HSV.
I.e. that if the active image is in anyRGB, the RGB values shown must
be within anyRGB. Right now, everything is still shown/used as sRGB
(even though it's properly retrieved and transformed to the target
space thanks to GeglColor).
2. Show space info to make things clear and explicit, by adding some
label somewhere.
3. Allow to switch between image and softproof spaces, regarding
out-of-gamut display. I.e. that while RGB/HSV must be shown within
the image space (assuming it's anyRGB), we may want to show
out-of-gamut area (pink areas) within the softproof space. This may
mean adding a checkbox. Or maybe simply taking into account whether
we are in softproof mode or not?
4. We can likely move off gimp_widget_get_color_transform() into using
gimp_widget_get_render_space() for display drawing. We don't need any
soft-proofing or black point compensation for any of these widgets so
pure babl is fine. Indeed we want to show any in-gamut color
correctly (and not transformed according to specific intents or
through soft-proofing). We will take care of the proofing case with
out-of-gamut area showing only.
5. In the various drawing functions, we should move to
CAIRO_FORMAT_RGBA128F. The color selection area might be wide enough
that it makes sense to be more accurate, especially as we are
essentially showing color gradients in 1 or 2 directions in these
various widgets.
2023-12-12 17:01:17 +09:00
|
|
|
if (rgb[0] < 0.0 || rgb[0] > 1.0 ||
|
|
|
|
rgb[1] < 0.0 || rgb[1] > 1.0 ||
|
|
|
|
rgb[2] < 0.0 || rgb[2] > 1.0)
|
2017-05-17 19:28:40 +02:00
|
|
|
{
|
|
|
|
p[0] = csf->oog_color[0];
|
|
|
|
p[1] = csf->oog_color[1];
|
|
|
|
p[2] = csf->oog_color[2];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
app, libgimpwidgets, modules: color selectors are now partly space-invaded.
What this commit does is keep the same code logic while moving to
GeglColor. Yet it's not **really** space-invaded yet. What we need to do
now:
1. Take into account the image space, and this is what we must navigate
through, in particular for various representations of RGB or HSV.
I.e. that if the active image is in anyRGB, the RGB values shown must
be within anyRGB. Right now, everything is still shown/used as sRGB
(even though it's properly retrieved and transformed to the target
space thanks to GeglColor).
2. Show space info to make things clear and explicit, by adding some
label somewhere.
3. Allow to switch between image and softproof spaces, regarding
out-of-gamut display. I.e. that while RGB/HSV must be shown within
the image space (assuming it's anyRGB), we may want to show
out-of-gamut area (pink areas) within the softproof space. This may
mean adding a checkbox. Or maybe simply taking into account whether
we are in softproof mode or not?
4. We can likely move off gimp_widget_get_color_transform() into using
gimp_widget_get_render_space() for display drawing. We don't need any
soft-proofing or black point compensation for any of these widgets so
pure babl is fine. Indeed we want to show any in-gamut color
correctly (and not transformed according to specific intents or
through soft-proofing). We will take care of the proofing case with
out-of-gamut area showing only.
5. In the various drawing functions, we should move to
CAIRO_FORMAT_RGBA128F. The color selection area might be wide enough
that it makes sense to be more accurate, especially as we are
essentially showing color gradients in 1 or 2 directions in these
various widgets.
2023-12-12 17:01:17 +09:00
|
|
|
p[0] = rgb[0] * 255;
|
|
|
|
p[1] = rgb[1] * 255;
|
|
|
|
p[2] = rgb[2] * 255;
|
2017-05-17 19:28:40 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
p += 3;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
color_select_render_lch_hue_lightness (ColorSelectFill *csf)
|
|
|
|
{
|
|
|
|
guchar *p = csf->buffer;
|
app, libgimpwidgets, modules: color selectors are now partly space-invaded.
What this commit does is keep the same code logic while moving to
GeglColor. Yet it's not **really** space-invaded yet. What we need to do
now:
1. Take into account the image space, and this is what we must navigate
through, in particular for various representations of RGB or HSV.
I.e. that if the active image is in anyRGB, the RGB values shown must
be within anyRGB. Right now, everything is still shown/used as sRGB
(even though it's properly retrieved and transformed to the target
space thanks to GeglColor).
2. Show space info to make things clear and explicit, by adding some
label somewhere.
3. Allow to switch between image and softproof spaces, regarding
out-of-gamut display. I.e. that while RGB/HSV must be shown within
the image space (assuming it's anyRGB), we may want to show
out-of-gamut area (pink areas) within the softproof space. This may
mean adding a checkbox. Or maybe simply taking into account whether
we are in softproof mode or not?
4. We can likely move off gimp_widget_get_color_transform() into using
gimp_widget_get_render_space() for display drawing. We don't need any
soft-proofing or black point compensation for any of these widgets so
pure babl is fine. Indeed we want to show any in-gamut color
correctly (and not transformed according to specific intents or
through soft-proofing). We will take care of the proofing case with
out-of-gamut area showing only.
5. In the various drawing functions, we should move to
CAIRO_FORMAT_RGBA128F. The color selection area might be wide enough
that it makes sense to be more accurate, especially as we are
essentially showing color gradients in 1 or 2 directions in these
various widgets.
2023-12-12 17:01:17 +09:00
|
|
|
gdouble lch[3];
|
2017-05-17 19:28:40 +02:00
|
|
|
gint i;
|
|
|
|
|
app, libgimpwidgets, modules: color selectors are now partly space-invaded.
What this commit does is keep the same code logic while moving to
GeglColor. Yet it's not **really** space-invaded yet. What we need to do
now:
1. Take into account the image space, and this is what we must navigate
through, in particular for various representations of RGB or HSV.
I.e. that if the active image is in anyRGB, the RGB values shown must
be within anyRGB. Right now, everything is still shown/used as sRGB
(even though it's properly retrieved and transformed to the target
space thanks to GeglColor).
2. Show space info to make things clear and explicit, by adding some
label somewhere.
3. Allow to switch between image and softproof spaces, regarding
out-of-gamut display. I.e. that while RGB/HSV must be shown within
the image space (assuming it's anyRGB), we may want to show
out-of-gamut area (pink areas) within the softproof space. This may
mean adding a checkbox. Or maybe simply taking into account whether
we are in softproof mode or not?
4. We can likely move off gimp_widget_get_color_transform() into using
gimp_widget_get_render_space() for display drawing. We don't need any
soft-proofing or black point compensation for any of these widgets so
pure babl is fine. Indeed we want to show any in-gamut color
correctly (and not transformed according to specific intents or
through soft-proofing). We will take care of the proofing case with
out-of-gamut area showing only.
5. In the various drawing functions, we should move to
CAIRO_FORMAT_RGBA128F. The color selection area might be wide enough
that it makes sense to be more accurate, especially as we are
essentially showing color gradients in 1 or 2 directions in these
various widgets.
2023-12-12 17:01:17 +09:00
|
|
|
lch[0] = (csf->height - 1 - csf->y) * 100.0 / csf->height;
|
|
|
|
lch[1] = csf->lch[1];
|
2017-05-17 19:28:40 +02:00
|
|
|
|
|
|
|
for (i = 0; i < csf->width; i++)
|
|
|
|
{
|
app, libgimpwidgets, modules: color selectors are now partly space-invaded.
What this commit does is keep the same code logic while moving to
GeglColor. Yet it's not **really** space-invaded yet. What we need to do
now:
1. Take into account the image space, and this is what we must navigate
through, in particular for various representations of RGB or HSV.
I.e. that if the active image is in anyRGB, the RGB values shown must
be within anyRGB. Right now, everything is still shown/used as sRGB
(even though it's properly retrieved and transformed to the target
space thanks to GeglColor).
2. Show space info to make things clear and explicit, by adding some
label somewhere.
3. Allow to switch between image and softproof spaces, regarding
out-of-gamut display. I.e. that while RGB/HSV must be shown within
the image space (assuming it's anyRGB), we may want to show
out-of-gamut area (pink areas) within the softproof space. This may
mean adding a checkbox. Or maybe simply taking into account whether
we are in softproof mode or not?
4. We can likely move off gimp_widget_get_color_transform() into using
gimp_widget_get_render_space() for display drawing. We don't need any
soft-proofing or black point compensation for any of these widgets so
pure babl is fine. Indeed we want to show any in-gamut color
correctly (and not transformed according to specific intents or
through soft-proofing). We will take care of the proofing case with
out-of-gamut area showing only.
5. In the various drawing functions, we should move to
CAIRO_FORMAT_RGBA128F. The color selection area might be wide enough
that it makes sense to be more accurate, especially as we are
essentially showing color gradients in 1 or 2 directions in these
various widgets.
2023-12-12 17:01:17 +09:00
|
|
|
gdouble rgb[3];
|
2017-05-17 19:28:40 +02:00
|
|
|
|
app, libgimpwidgets, modules: color selectors are now partly space-invaded.
What this commit does is keep the same code logic while moving to
GeglColor. Yet it's not **really** space-invaded yet. What we need to do
now:
1. Take into account the image space, and this is what we must navigate
through, in particular for various representations of RGB or HSV.
I.e. that if the active image is in anyRGB, the RGB values shown must
be within anyRGB. Right now, everything is still shown/used as sRGB
(even though it's properly retrieved and transformed to the target
space thanks to GeglColor).
2. Show space info to make things clear and explicit, by adding some
label somewhere.
3. Allow to switch between image and softproof spaces, regarding
out-of-gamut display. I.e. that while RGB/HSV must be shown within
the image space (assuming it's anyRGB), we may want to show
out-of-gamut area (pink areas) within the softproof space. This may
mean adding a checkbox. Or maybe simply taking into account whether
we are in softproof mode or not?
4. We can likely move off gimp_widget_get_color_transform() into using
gimp_widget_get_render_space() for display drawing. We don't need any
soft-proofing or black point compensation for any of these widgets so
pure babl is fine. Indeed we want to show any in-gamut color
correctly (and not transformed according to specific intents or
through soft-proofing). We will take care of the proofing case with
out-of-gamut area showing only.
5. In the various drawing functions, we should move to
CAIRO_FORMAT_RGBA128F. The color selection area might be wide enough
that it makes sense to be more accurate, especially as we are
essentially showing color gradients in 1 or 2 directions in these
various widgets.
2023-12-12 17:01:17 +09:00
|
|
|
lch[2] = i * 360.0 / csf->width;
|
2017-05-17 19:28:40 +02:00
|
|
|
|
|
|
|
babl_process (fish_lch_to_rgb, &lch, &rgb, 1);
|
|
|
|
|
app, libgimpwidgets, modules: color selectors are now partly space-invaded.
What this commit does is keep the same code logic while moving to
GeglColor. Yet it's not **really** space-invaded yet. What we need to do
now:
1. Take into account the image space, and this is what we must navigate
through, in particular for various representations of RGB or HSV.
I.e. that if the active image is in anyRGB, the RGB values shown must
be within anyRGB. Right now, everything is still shown/used as sRGB
(even though it's properly retrieved and transformed to the target
space thanks to GeglColor).
2. Show space info to make things clear and explicit, by adding some
label somewhere.
3. Allow to switch between image and softproof spaces, regarding
out-of-gamut display. I.e. that while RGB/HSV must be shown within
the image space (assuming it's anyRGB), we may want to show
out-of-gamut area (pink areas) within the softproof space. This may
mean adding a checkbox. Or maybe simply taking into account whether
we are in softproof mode or not?
4. We can likely move off gimp_widget_get_color_transform() into using
gimp_widget_get_render_space() for display drawing. We don't need any
soft-proofing or black point compensation for any of these widgets so
pure babl is fine. Indeed we want to show any in-gamut color
correctly (and not transformed according to specific intents or
through soft-proofing). We will take care of the proofing case with
out-of-gamut area showing only.
5. In the various drawing functions, we should move to
CAIRO_FORMAT_RGBA128F. The color selection area might be wide enough
that it makes sense to be more accurate, especially as we are
essentially showing color gradients in 1 or 2 directions in these
various widgets.
2023-12-12 17:01:17 +09:00
|
|
|
if (rgb[0] < 0.0 || rgb[0] > 1.0 ||
|
|
|
|
rgb[1] < 0.0 || rgb[1] > 1.0 ||
|
|
|
|
rgb[2] < 0.0 || rgb[2] > 1.0)
|
2017-05-17 19:28:40 +02:00
|
|
|
{
|
|
|
|
p[0] = csf->oog_color[0];
|
|
|
|
p[1] = csf->oog_color[1];
|
|
|
|
p[2] = csf->oog_color[2];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
app, libgimpwidgets, modules: color selectors are now partly space-invaded.
What this commit does is keep the same code logic while moving to
GeglColor. Yet it's not **really** space-invaded yet. What we need to do
now:
1. Take into account the image space, and this is what we must navigate
through, in particular for various representations of RGB or HSV.
I.e. that if the active image is in anyRGB, the RGB values shown must
be within anyRGB. Right now, everything is still shown/used as sRGB
(even though it's properly retrieved and transformed to the target
space thanks to GeglColor).
2. Show space info to make things clear and explicit, by adding some
label somewhere.
3. Allow to switch between image and softproof spaces, regarding
out-of-gamut display. I.e. that while RGB/HSV must be shown within
the image space (assuming it's anyRGB), we may want to show
out-of-gamut area (pink areas) within the softproof space. This may
mean adding a checkbox. Or maybe simply taking into account whether
we are in softproof mode or not?
4. We can likely move off gimp_widget_get_color_transform() into using
gimp_widget_get_render_space() for display drawing. We don't need any
soft-proofing or black point compensation for any of these widgets so
pure babl is fine. Indeed we want to show any in-gamut color
correctly (and not transformed according to specific intents or
through soft-proofing). We will take care of the proofing case with
out-of-gamut area showing only.
5. In the various drawing functions, we should move to
CAIRO_FORMAT_RGBA128F. The color selection area might be wide enough
that it makes sense to be more accurate, especially as we are
essentially showing color gradients in 1 or 2 directions in these
various widgets.
2023-12-12 17:01:17 +09:00
|
|
|
p[0] = rgb[0] * 255;
|
|
|
|
p[1] = rgb[1] * 255;
|
|
|
|
p[2] = rgb[2] * 255;
|
2017-05-17 19:28:40 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
p += 3;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
color_select_render_lch_hue_chroma (ColorSelectFill *csf)
|
|
|
|
{
|
|
|
|
guchar *p = csf->buffer;
|
app, libgimpwidgets, modules: color selectors are now partly space-invaded.
What this commit does is keep the same code logic while moving to
GeglColor. Yet it's not **really** space-invaded yet. What we need to do
now:
1. Take into account the image space, and this is what we must navigate
through, in particular for various representations of RGB or HSV.
I.e. that if the active image is in anyRGB, the RGB values shown must
be within anyRGB. Right now, everything is still shown/used as sRGB
(even though it's properly retrieved and transformed to the target
space thanks to GeglColor).
2. Show space info to make things clear and explicit, by adding some
label somewhere.
3. Allow to switch between image and softproof spaces, regarding
out-of-gamut display. I.e. that while RGB/HSV must be shown within
the image space (assuming it's anyRGB), we may want to show
out-of-gamut area (pink areas) within the softproof space. This may
mean adding a checkbox. Or maybe simply taking into account whether
we are in softproof mode or not?
4. We can likely move off gimp_widget_get_color_transform() into using
gimp_widget_get_render_space() for display drawing. We don't need any
soft-proofing or black point compensation for any of these widgets so
pure babl is fine. Indeed we want to show any in-gamut color
correctly (and not transformed according to specific intents or
through soft-proofing). We will take care of the proofing case with
out-of-gamut area showing only.
5. In the various drawing functions, we should move to
CAIRO_FORMAT_RGBA128F. The color selection area might be wide enough
that it makes sense to be more accurate, especially as we are
essentially showing color gradients in 1 or 2 directions in these
various widgets.
2023-12-12 17:01:17 +09:00
|
|
|
gdouble lch[3];
|
2017-05-17 19:28:40 +02:00
|
|
|
gint i;
|
|
|
|
|
app, libgimpwidgets, modules: color selectors are now partly space-invaded.
What this commit does is keep the same code logic while moving to
GeglColor. Yet it's not **really** space-invaded yet. What we need to do
now:
1. Take into account the image space, and this is what we must navigate
through, in particular for various representations of RGB or HSV.
I.e. that if the active image is in anyRGB, the RGB values shown must
be within anyRGB. Right now, everything is still shown/used as sRGB
(even though it's properly retrieved and transformed to the target
space thanks to GeglColor).
2. Show space info to make things clear and explicit, by adding some
label somewhere.
3. Allow to switch between image and softproof spaces, regarding
out-of-gamut display. I.e. that while RGB/HSV must be shown within
the image space (assuming it's anyRGB), we may want to show
out-of-gamut area (pink areas) within the softproof space. This may
mean adding a checkbox. Or maybe simply taking into account whether
we are in softproof mode or not?
4. We can likely move off gimp_widget_get_color_transform() into using
gimp_widget_get_render_space() for display drawing. We don't need any
soft-proofing or black point compensation for any of these widgets so
pure babl is fine. Indeed we want to show any in-gamut color
correctly (and not transformed according to specific intents or
through soft-proofing). We will take care of the proofing case with
out-of-gamut area showing only.
5. In the various drawing functions, we should move to
CAIRO_FORMAT_RGBA128F. The color selection area might be wide enough
that it makes sense to be more accurate, especially as we are
essentially showing color gradients in 1 or 2 directions in these
various widgets.
2023-12-12 17:01:17 +09:00
|
|
|
lch[0] = csf->lch[0];
|
|
|
|
lch[1] = (csf->height - 1 - csf->y) * 200.0 / csf->height;
|
2017-05-17 19:28:40 +02:00
|
|
|
|
|
|
|
for (i = 0; i < csf->width; i++)
|
|
|
|
{
|
app, libgimpwidgets, modules: color selectors are now partly space-invaded.
What this commit does is keep the same code logic while moving to
GeglColor. Yet it's not **really** space-invaded yet. What we need to do
now:
1. Take into account the image space, and this is what we must navigate
through, in particular for various representations of RGB or HSV.
I.e. that if the active image is in anyRGB, the RGB values shown must
be within anyRGB. Right now, everything is still shown/used as sRGB
(even though it's properly retrieved and transformed to the target
space thanks to GeglColor).
2. Show space info to make things clear and explicit, by adding some
label somewhere.
3. Allow to switch between image and softproof spaces, regarding
out-of-gamut display. I.e. that while RGB/HSV must be shown within
the image space (assuming it's anyRGB), we may want to show
out-of-gamut area (pink areas) within the softproof space. This may
mean adding a checkbox. Or maybe simply taking into account whether
we are in softproof mode or not?
4. We can likely move off gimp_widget_get_color_transform() into using
gimp_widget_get_render_space() for display drawing. We don't need any
soft-proofing or black point compensation for any of these widgets so
pure babl is fine. Indeed we want to show any in-gamut color
correctly (and not transformed according to specific intents or
through soft-proofing). We will take care of the proofing case with
out-of-gamut area showing only.
5. In the various drawing functions, we should move to
CAIRO_FORMAT_RGBA128F. The color selection area might be wide enough
that it makes sense to be more accurate, especially as we are
essentially showing color gradients in 1 or 2 directions in these
various widgets.
2023-12-12 17:01:17 +09:00
|
|
|
gdouble rgb[3];
|
2017-05-17 19:28:40 +02:00
|
|
|
|
app, libgimpwidgets, modules: color selectors are now partly space-invaded.
What this commit does is keep the same code logic while moving to
GeglColor. Yet it's not **really** space-invaded yet. What we need to do
now:
1. Take into account the image space, and this is what we must navigate
through, in particular for various representations of RGB or HSV.
I.e. that if the active image is in anyRGB, the RGB values shown must
be within anyRGB. Right now, everything is still shown/used as sRGB
(even though it's properly retrieved and transformed to the target
space thanks to GeglColor).
2. Show space info to make things clear and explicit, by adding some
label somewhere.
3. Allow to switch between image and softproof spaces, regarding
out-of-gamut display. I.e. that while RGB/HSV must be shown within
the image space (assuming it's anyRGB), we may want to show
out-of-gamut area (pink areas) within the softproof space. This may
mean adding a checkbox. Or maybe simply taking into account whether
we are in softproof mode or not?
4. We can likely move off gimp_widget_get_color_transform() into using
gimp_widget_get_render_space() for display drawing. We don't need any
soft-proofing or black point compensation for any of these widgets so
pure babl is fine. Indeed we want to show any in-gamut color
correctly (and not transformed according to specific intents or
through soft-proofing). We will take care of the proofing case with
out-of-gamut area showing only.
5. In the various drawing functions, we should move to
CAIRO_FORMAT_RGBA128F. The color selection area might be wide enough
that it makes sense to be more accurate, especially as we are
essentially showing color gradients in 1 or 2 directions in these
various widgets.
2023-12-12 17:01:17 +09:00
|
|
|
lch[2] = i * 360.0 / csf->width;
|
2017-05-17 19:28:40 +02:00
|
|
|
|
|
|
|
babl_process (fish_lch_to_rgb, &lch, &rgb, 1);
|
|
|
|
|
app, libgimpwidgets, modules: color selectors are now partly space-invaded.
What this commit does is keep the same code logic while moving to
GeglColor. Yet it's not **really** space-invaded yet. What we need to do
now:
1. Take into account the image space, and this is what we must navigate
through, in particular for various representations of RGB or HSV.
I.e. that if the active image is in anyRGB, the RGB values shown must
be within anyRGB. Right now, everything is still shown/used as sRGB
(even though it's properly retrieved and transformed to the target
space thanks to GeglColor).
2. Show space info to make things clear and explicit, by adding some
label somewhere.
3. Allow to switch between image and softproof spaces, regarding
out-of-gamut display. I.e. that while RGB/HSV must be shown within
the image space (assuming it's anyRGB), we may want to show
out-of-gamut area (pink areas) within the softproof space. This may
mean adding a checkbox. Or maybe simply taking into account whether
we are in softproof mode or not?
4. We can likely move off gimp_widget_get_color_transform() into using
gimp_widget_get_render_space() for display drawing. We don't need any
soft-proofing or black point compensation for any of these widgets so
pure babl is fine. Indeed we want to show any in-gamut color
correctly (and not transformed according to specific intents or
through soft-proofing). We will take care of the proofing case with
out-of-gamut area showing only.
5. In the various drawing functions, we should move to
CAIRO_FORMAT_RGBA128F. The color selection area might be wide enough
that it makes sense to be more accurate, especially as we are
essentially showing color gradients in 1 or 2 directions in these
various widgets.
2023-12-12 17:01:17 +09:00
|
|
|
if (rgb[0] < 0.0 || rgb[0] > 1.0 ||
|
|
|
|
rgb[1] < 0.0 || rgb[1] > 1.0 ||
|
|
|
|
rgb[2] < 0.0 || rgb[2] > 1.0)
|
2017-05-17 19:28:40 +02:00
|
|
|
{
|
|
|
|
p[0] = csf->oog_color[0];
|
|
|
|
p[1] = csf->oog_color[1];
|
|
|
|
p[2] = csf->oog_color[2];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
app, libgimpwidgets, modules: color selectors are now partly space-invaded.
What this commit does is keep the same code logic while moving to
GeglColor. Yet it's not **really** space-invaded yet. What we need to do
now:
1. Take into account the image space, and this is what we must navigate
through, in particular for various representations of RGB or HSV.
I.e. that if the active image is in anyRGB, the RGB values shown must
be within anyRGB. Right now, everything is still shown/used as sRGB
(even though it's properly retrieved and transformed to the target
space thanks to GeglColor).
2. Show space info to make things clear and explicit, by adding some
label somewhere.
3. Allow to switch between image and softproof spaces, regarding
out-of-gamut display. I.e. that while RGB/HSV must be shown within
the image space (assuming it's anyRGB), we may want to show
out-of-gamut area (pink areas) within the softproof space. This may
mean adding a checkbox. Or maybe simply taking into account whether
we are in softproof mode or not?
4. We can likely move off gimp_widget_get_color_transform() into using
gimp_widget_get_render_space() for display drawing. We don't need any
soft-proofing or black point compensation for any of these widgets so
pure babl is fine. Indeed we want to show any in-gamut color
correctly (and not transformed according to specific intents or
through soft-proofing). We will take care of the proofing case with
out-of-gamut area showing only.
5. In the various drawing functions, we should move to
CAIRO_FORMAT_RGBA128F. The color selection area might be wide enough
that it makes sense to be more accurate, especially as we are
essentially showing color gradients in 1 or 2 directions in these
various widgets.
2023-12-12 17:01:17 +09:00
|
|
|
p[0] = rgb[0] * 255;
|
|
|
|
p[1] = rgb[1] * 255;
|
|
|
|
p[2] = rgb[2] * 255;
|
2017-05-17 19:28:40 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
p += 3;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_color_select_notify_config (GimpColorConfig *config,
|
|
|
|
const GParamSpec *pspec,
|
|
|
|
GimpColorSelect *select)
|
|
|
|
{
|
2023-11-22 23:38:25 +01:00
|
|
|
GeglColor *color;
|
2018-05-05 20:07:27 +02:00
|
|
|
|
2023-11-22 23:38:25 +01:00
|
|
|
color = gimp_color_config_get_out_of_gamut_color (config);
|
|
|
|
/* TODO: shouldn't this be color-managed too, using the target space into
|
|
|
|
* consideration?
|
|
|
|
*/
|
|
|
|
gegl_color_get_pixel (color, babl_format ("R'G'B' u8"), select->oog_color);
|
2017-05-17 19:28:40 +02:00
|
|
|
select->xy_needs_render = TRUE;
|
|
|
|
select->z_needs_render = TRUE;
|
2023-11-22 23:38:25 +01:00
|
|
|
|
|
|
|
g_object_unref (color);
|
2017-05-17 19:28:40 +02:00
|
|
|
}
|