gimp/libgimpwidgets/gimpcolorselector.c

832 lines
24 KiB
C
Raw Normal View History

/* LIBGIMP - The GIMP Library
Ported module loading to GTypeModule, getting rid of all own module 2002-10-20 Michael Natterer <mitch@gimp.org> Ported module loading to GTypeModule, getting rid of all own module registering/bookkeeping stuff for color selectors and display filters. The modules now simply register GimpColorSelector and GimpColorDisplay subclasses, the list of registered subclasses can then be obtained calling g_type_children() on the abstract base classes. This is work in progress and just the first working state after I started breaking everything... * app/gui/color-select.[ch] * libgimp/gimpcolordisplay.h * libgimp/gimpcolorselector.h: removed. * app/gui/Makefile.am * libgimp/Makefile.am: changed accordingly. * libgimp/gimpmodule.h: massively simplified. All voodoo is gone. * libgimpwidgets/gimpcolordisplay.[ch] * libgimpwidgets/gimpcolorselector.[ch]: new abstract base classes which need to be subclassed by modules. * libgimpwidgets/gimpcolorselect.[ch]: the built-in color selector from app/gui/color-select.* ported to be a GimpColorSelector subclass. * libgimpwidgets/Makefile.am * libgimpwidgets/gimpwidgets.h * libgimpwidgets/gimpwidgetsmarshal.list * libgimpwidgets/gimpwidgetstypes.h: changed accordingly. * app/core/gimpmoduleinfo.[ch]: made it a GTypeModule subclass * app/core/gimpmodules.c: changed accordingly. * app/core/gimpcontainer.c * app/core/gimplist.c: HACKED around to allow GimpLists of GObjects (not GimpObjects). This is EEKy, so I will either make gimp->modules a simple GList and revert this bit of change, or allow GObjects all over the place in GimpContainer land... * app/display/gimpdisplayshell-filter.[ch] * app/gui/color-notebook.c: removed all module stuff and use g_type_children() to get the list of available color_selectors and display_filters. * app/display/gimpdisplayshell-filter-dialog.c * app/display/gimpdisplayshell-render.c * app/gui/module-browser.c: changed accordingly. * app/gui/gui.c: ref the built-in color selector's class before the modules are queried so it appears first in the list of GimpColorSelector's children. * modules/Makefile.am: build the water color selector again. * modules/cdisplay_gamma.c * modules/cdisplay_highcontrast.c * modules/colorsel_triangle.c * modules/colorsel_water.c: ported them all to the new API. * modules/gimpmodregister.[ch]: removed the old EMX module hack.
2002-10-20 18:14:17 +08:00
* Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
*
* gimpcolorselector.c
* Copyright (C) 2002 Michael Natterer <mitch@gimp.org>
*
* based on:
* Colour selector module
* Copyright (C) 1999 Austin Donnelly <austin@greenend.org.uk>
*
* This library is free software: you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
Ported module loading to GTypeModule, getting rid of all own module 2002-10-20 Michael Natterer <mitch@gimp.org> Ported module loading to GTypeModule, getting rid of all own module registering/bookkeeping stuff for color selectors and display filters. The modules now simply register GimpColorSelector and GimpColorDisplay subclasses, the list of registered subclasses can then be obtained calling g_type_children() on the abstract base classes. This is work in progress and just the first working state after I started breaking everything... * app/gui/color-select.[ch] * libgimp/gimpcolordisplay.h * libgimp/gimpcolorselector.h: removed. * app/gui/Makefile.am * libgimp/Makefile.am: changed accordingly. * libgimp/gimpmodule.h: massively simplified. All voodoo is gone. * libgimpwidgets/gimpcolordisplay.[ch] * libgimpwidgets/gimpcolorselector.[ch]: new abstract base classes which need to be subclassed by modules. * libgimpwidgets/gimpcolorselect.[ch]: the built-in color selector from app/gui/color-select.* ported to be a GimpColorSelector subclass. * libgimpwidgets/Makefile.am * libgimpwidgets/gimpwidgets.h * libgimpwidgets/gimpwidgetsmarshal.list * libgimpwidgets/gimpwidgetstypes.h: changed accordingly. * app/core/gimpmoduleinfo.[ch]: made it a GTypeModule subclass * app/core/gimpmodules.c: changed accordingly. * app/core/gimpcontainer.c * app/core/gimplist.c: HACKED around to allow GimpLists of GObjects (not GimpObjects). This is EEKy, so I will either make gimp->modules a simple GList and revert this bit of change, or allow GObjects all over the place in GimpContainer land... * app/display/gimpdisplayshell-filter.[ch] * app/gui/color-notebook.c: removed all module stuff and use g_type_children() to get the list of available color_selectors and display_filters. * app/display/gimpdisplayshell-filter-dialog.c * app/display/gimpdisplayshell-render.c * app/gui/module-browser.c: changed accordingly. * app/gui/gui.c: ref the built-in color selector's class before the modules are queried so it appears first in the list of GimpColorSelector's children. * modules/Makefile.am: build the water color selector again. * modules/cdisplay_gamma.c * modules/cdisplay_highcontrast.c * modules/colorsel_triangle.c * modules/colorsel_water.c: ported them all to the new API. * modules/gimpmodregister.[ch]: removed the old EMX module hack.
2002-10-20 18:14:17 +08:00
*
* This library is distributed in the hope that it will be useful,
Ported module loading to GTypeModule, getting rid of all own module 2002-10-20 Michael Natterer <mitch@gimp.org> Ported module loading to GTypeModule, getting rid of all own module registering/bookkeeping stuff for color selectors and display filters. The modules now simply register GimpColorSelector and GimpColorDisplay subclasses, the list of registered subclasses can then be obtained calling g_type_children() on the abstract base classes. This is work in progress and just the first working state after I started breaking everything... * app/gui/color-select.[ch] * libgimp/gimpcolordisplay.h * libgimp/gimpcolorselector.h: removed. * app/gui/Makefile.am * libgimp/Makefile.am: changed accordingly. * libgimp/gimpmodule.h: massively simplified. All voodoo is gone. * libgimpwidgets/gimpcolordisplay.[ch] * libgimpwidgets/gimpcolorselector.[ch]: new abstract base classes which need to be subclassed by modules. * libgimpwidgets/gimpcolorselect.[ch]: the built-in color selector from app/gui/color-select.* ported to be a GimpColorSelector subclass. * libgimpwidgets/Makefile.am * libgimpwidgets/gimpwidgets.h * libgimpwidgets/gimpwidgetsmarshal.list * libgimpwidgets/gimpwidgetstypes.h: changed accordingly. * app/core/gimpmoduleinfo.[ch]: made it a GTypeModule subclass * app/core/gimpmodules.c: changed accordingly. * app/core/gimpcontainer.c * app/core/gimplist.c: HACKED around to allow GimpLists of GObjects (not GimpObjects). This is EEKy, so I will either make gimp->modules a simple GList and revert this bit of change, or allow GObjects all over the place in GimpContainer land... * app/display/gimpdisplayshell-filter.[ch] * app/gui/color-notebook.c: removed all module stuff and use g_type_children() to get the list of available color_selectors and display_filters. * app/display/gimpdisplayshell-filter-dialog.c * app/display/gimpdisplayshell-render.c * app/gui/module-browser.c: changed accordingly. * app/gui/gui.c: ref the built-in color selector's class before the modules are queried so it appears first in the list of GimpColorSelector's children. * modules/Makefile.am: build the water color selector again. * modules/cdisplay_gamma.c * modules/cdisplay_highcontrast.c * modules/colorsel_triangle.c * modules/colorsel_water.c: ported them all to the new API. * modules/gimpmodregister.[ch]: removed the old EMX module hack.
2002-10-20 18:14:17 +08:00
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
Ported module loading to GTypeModule, getting rid of all own module 2002-10-20 Michael Natterer <mitch@gimp.org> Ported module loading to GTypeModule, getting rid of all own module registering/bookkeeping stuff for color selectors and display filters. The modules now simply register GimpColorSelector and GimpColorDisplay subclasses, the list of registered subclasses can then be obtained calling g_type_children() on the abstract base classes. This is work in progress and just the first working state after I started breaking everything... * app/gui/color-select.[ch] * libgimp/gimpcolordisplay.h * libgimp/gimpcolorselector.h: removed. * app/gui/Makefile.am * libgimp/Makefile.am: changed accordingly. * libgimp/gimpmodule.h: massively simplified. All voodoo is gone. * libgimpwidgets/gimpcolordisplay.[ch] * libgimpwidgets/gimpcolorselector.[ch]: new abstract base classes which need to be subclassed by modules. * libgimpwidgets/gimpcolorselect.[ch]: the built-in color selector from app/gui/color-select.* ported to be a GimpColorSelector subclass. * libgimpwidgets/Makefile.am * libgimpwidgets/gimpwidgets.h * libgimpwidgets/gimpwidgetsmarshal.list * libgimpwidgets/gimpwidgetstypes.h: changed accordingly. * app/core/gimpmoduleinfo.[ch]: made it a GTypeModule subclass * app/core/gimpmodules.c: changed accordingly. * app/core/gimpcontainer.c * app/core/gimplist.c: HACKED around to allow GimpLists of GObjects (not GimpObjects). This is EEKy, so I will either make gimp->modules a simple GList and revert this bit of change, or allow GObjects all over the place in GimpContainer land... * app/display/gimpdisplayshell-filter.[ch] * app/gui/color-notebook.c: removed all module stuff and use g_type_children() to get the list of available color_selectors and display_filters. * app/display/gimpdisplayshell-filter-dialog.c * app/display/gimpdisplayshell-render.c * app/gui/module-browser.c: changed accordingly. * app/gui/gui.c: ref the built-in color selector's class before the modules are queried so it appears first in the list of GimpColorSelector's children. * modules/Makefile.am: build the water color selector again. * modules/cdisplay_gamma.c * modules/cdisplay_highcontrast.c * modules/colorsel_triangle.c * modules/colorsel_water.c: ported them all to the new API. * modules/gimpmodregister.[ch]: removed the old EMX module hack.
2002-10-20 18:14:17 +08:00
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see
* <https://www.gnu.org/licenses/>.
Ported module loading to GTypeModule, getting rid of all own module 2002-10-20 Michael Natterer <mitch@gimp.org> Ported module loading to GTypeModule, getting rid of all own module registering/bookkeeping stuff for color selectors and display filters. The modules now simply register GimpColorSelector and GimpColorDisplay subclasses, the list of registered subclasses can then be obtained calling g_type_children() on the abstract base classes. This is work in progress and just the first working state after I started breaking everything... * app/gui/color-select.[ch] * libgimp/gimpcolordisplay.h * libgimp/gimpcolorselector.h: removed. * app/gui/Makefile.am * libgimp/Makefile.am: changed accordingly. * libgimp/gimpmodule.h: massively simplified. All voodoo is gone. * libgimpwidgets/gimpcolordisplay.[ch] * libgimpwidgets/gimpcolorselector.[ch]: new abstract base classes which need to be subclassed by modules. * libgimpwidgets/gimpcolorselect.[ch]: the built-in color selector from app/gui/color-select.* ported to be a GimpColorSelector subclass. * libgimpwidgets/Makefile.am * libgimpwidgets/gimpwidgets.h * libgimpwidgets/gimpwidgetsmarshal.list * libgimpwidgets/gimpwidgetstypes.h: changed accordingly. * app/core/gimpmoduleinfo.[ch]: made it a GTypeModule subclass * app/core/gimpmodules.c: changed accordingly. * app/core/gimpcontainer.c * app/core/gimplist.c: HACKED around to allow GimpLists of GObjects (not GimpObjects). This is EEKy, so I will either make gimp->modules a simple GList and revert this bit of change, or allow GObjects all over the place in GimpContainer land... * app/display/gimpdisplayshell-filter.[ch] * app/gui/color-notebook.c: removed all module stuff and use g_type_children() to get the list of available color_selectors and display_filters. * app/display/gimpdisplayshell-filter-dialog.c * app/display/gimpdisplayshell-render.c * app/gui/module-browser.c: changed accordingly. * app/gui/gui.c: ref the built-in color selector's class before the modules are queried so it appears first in the list of GimpColorSelector's children. * modules/Makefile.am: build the water color selector again. * modules/cdisplay_gamma.c * modules/cdisplay_highcontrast.c * modules/colorsel_triangle.c * modules/colorsel_water.c: ported them all to the new API. * modules/gimpmodregister.[ch]: removed the old EMX module hack.
2002-10-20 18:14:17 +08:00
*/
#include "config.h"
#include <gegl.h>
Ported module loading to GTypeModule, getting rid of all own module 2002-10-20 Michael Natterer <mitch@gimp.org> Ported module loading to GTypeModule, getting rid of all own module registering/bookkeeping stuff for color selectors and display filters. The modules now simply register GimpColorSelector and GimpColorDisplay subclasses, the list of registered subclasses can then be obtained calling g_type_children() on the abstract base classes. This is work in progress and just the first working state after I started breaking everything... * app/gui/color-select.[ch] * libgimp/gimpcolordisplay.h * libgimp/gimpcolorselector.h: removed. * app/gui/Makefile.am * libgimp/Makefile.am: changed accordingly. * libgimp/gimpmodule.h: massively simplified. All voodoo is gone. * libgimpwidgets/gimpcolordisplay.[ch] * libgimpwidgets/gimpcolorselector.[ch]: new abstract base classes which need to be subclassed by modules. * libgimpwidgets/gimpcolorselect.[ch]: the built-in color selector from app/gui/color-select.* ported to be a GimpColorSelector subclass. * libgimpwidgets/Makefile.am * libgimpwidgets/gimpwidgets.h * libgimpwidgets/gimpwidgetsmarshal.list * libgimpwidgets/gimpwidgetstypes.h: changed accordingly. * app/core/gimpmoduleinfo.[ch]: made it a GTypeModule subclass * app/core/gimpmodules.c: changed accordingly. * app/core/gimpcontainer.c * app/core/gimplist.c: HACKED around to allow GimpLists of GObjects (not GimpObjects). This is EEKy, so I will either make gimp->modules a simple GList and revert this bit of change, or allow GObjects all over the place in GimpContainer land... * app/display/gimpdisplayshell-filter.[ch] * app/gui/color-notebook.c: removed all module stuff and use g_type_children() to get the list of available color_selectors and display_filters. * app/display/gimpdisplayshell-filter-dialog.c * app/display/gimpdisplayshell-render.c * app/gui/module-browser.c: changed accordingly. * app/gui/gui.c: ref the built-in color selector's class before the modules are queried so it appears first in the list of GimpColorSelector's children. * modules/Makefile.am: build the water color selector again. * modules/cdisplay_gamma.c * modules/cdisplay_highcontrast.c * modules/colorsel_triangle.c * modules/colorsel_water.c: ported them all to the new API. * modules/gimpmodregister.[ch]: removed the old EMX module hack.
2002-10-20 18:14:17 +08:00
#include <gtk/gtk.h>
#include "libgimpcolor/gimpcolor.h"
#include "libgimpconfig/gimpconfig.h"
Ported module loading to GTypeModule, getting rid of all own module 2002-10-20 Michael Natterer <mitch@gimp.org> Ported module loading to GTypeModule, getting rid of all own module registering/bookkeeping stuff for color selectors and display filters. The modules now simply register GimpColorSelector and GimpColorDisplay subclasses, the list of registered subclasses can then be obtained calling g_type_children() on the abstract base classes. This is work in progress and just the first working state after I started breaking everything... * app/gui/color-select.[ch] * libgimp/gimpcolordisplay.h * libgimp/gimpcolorselector.h: removed. * app/gui/Makefile.am * libgimp/Makefile.am: changed accordingly. * libgimp/gimpmodule.h: massively simplified. All voodoo is gone. * libgimpwidgets/gimpcolordisplay.[ch] * libgimpwidgets/gimpcolorselector.[ch]: new abstract base classes which need to be subclassed by modules. * libgimpwidgets/gimpcolorselect.[ch]: the built-in color selector from app/gui/color-select.* ported to be a GimpColorSelector subclass. * libgimpwidgets/Makefile.am * libgimpwidgets/gimpwidgets.h * libgimpwidgets/gimpwidgetsmarshal.list * libgimpwidgets/gimpwidgetstypes.h: changed accordingly. * app/core/gimpmoduleinfo.[ch]: made it a GTypeModule subclass * app/core/gimpmodules.c: changed accordingly. * app/core/gimpcontainer.c * app/core/gimplist.c: HACKED around to allow GimpLists of GObjects (not GimpObjects). This is EEKy, so I will either make gimp->modules a simple GList and revert this bit of change, or allow GObjects all over the place in GimpContainer land... * app/display/gimpdisplayshell-filter.[ch] * app/gui/color-notebook.c: removed all module stuff and use g_type_children() to get the list of available color_selectors and display_filters. * app/display/gimpdisplayshell-filter-dialog.c * app/display/gimpdisplayshell-render.c * app/gui/module-browser.c: changed accordingly. * app/gui/gui.c: ref the built-in color selector's class before the modules are queried so it appears first in the list of GimpColorSelector's children. * modules/Makefile.am: build the water color selector again. * modules/cdisplay_gamma.c * modules/cdisplay_highcontrast.c * modules/colorsel_triangle.c * modules/colorsel_water.c: ported them all to the new API. * modules/gimpmodregister.[ch]: removed the old EMX module hack.
2002-10-20 18:14:17 +08:00
#include "gimpwidgetstypes.h"
#include "gimpcolorselector.h"
#include "gimpicons.h"
Ported module loading to GTypeModule, getting rid of all own module 2002-10-20 Michael Natterer <mitch@gimp.org> Ported module loading to GTypeModule, getting rid of all own module registering/bookkeeping stuff for color selectors and display filters. The modules now simply register GimpColorSelector and GimpColorDisplay subclasses, the list of registered subclasses can then be obtained calling g_type_children() on the abstract base classes. This is work in progress and just the first working state after I started breaking everything... * app/gui/color-select.[ch] * libgimp/gimpcolordisplay.h * libgimp/gimpcolorselector.h: removed. * app/gui/Makefile.am * libgimp/Makefile.am: changed accordingly. * libgimp/gimpmodule.h: massively simplified. All voodoo is gone. * libgimpwidgets/gimpcolordisplay.[ch] * libgimpwidgets/gimpcolorselector.[ch]: new abstract base classes which need to be subclassed by modules. * libgimpwidgets/gimpcolorselect.[ch]: the built-in color selector from app/gui/color-select.* ported to be a GimpColorSelector subclass. * libgimpwidgets/Makefile.am * libgimpwidgets/gimpwidgets.h * libgimpwidgets/gimpwidgetsmarshal.list * libgimpwidgets/gimpwidgetstypes.h: changed accordingly. * app/core/gimpmoduleinfo.[ch]: made it a GTypeModule subclass * app/core/gimpmodules.c: changed accordingly. * app/core/gimpcontainer.c * app/core/gimplist.c: HACKED around to allow GimpLists of GObjects (not GimpObjects). This is EEKy, so I will either make gimp->modules a simple GList and revert this bit of change, or allow GObjects all over the place in GimpContainer land... * app/display/gimpdisplayshell-filter.[ch] * app/gui/color-notebook.c: removed all module stuff and use g_type_children() to get the list of available color_selectors and display_filters. * app/display/gimpdisplayshell-filter-dialog.c * app/display/gimpdisplayshell-render.c * app/gui/module-browser.c: changed accordingly. * app/gui/gui.c: ref the built-in color selector's class before the modules are queried so it appears first in the list of GimpColorSelector's children. * modules/Makefile.am: build the water color selector again. * modules/cdisplay_gamma.c * modules/cdisplay_highcontrast.c * modules/colorsel_triangle.c * modules/colorsel_water.c: ported them all to the new API. * modules/gimpmodregister.[ch]: removed the old EMX module hack.
2002-10-20 18:14:17 +08:00
#include "gimpwidgetsmarshal.h"
/**
* SECTION: gimpcolorselector
* @title: GimpColorSelector
* @short_description: Pluggable GIMP color selector modules.
* @see_also: #GModule, #GTypeModule, #GimpModule
*
* Functions and definitions for creating pluggable GIMP color
* selector modules.
**/
Ported module loading to GTypeModule, getting rid of all own module 2002-10-20 Michael Natterer <mitch@gimp.org> Ported module loading to GTypeModule, getting rid of all own module registering/bookkeeping stuff for color selectors and display filters. The modules now simply register GimpColorSelector and GimpColorDisplay subclasses, the list of registered subclasses can then be obtained calling g_type_children() on the abstract base classes. This is work in progress and just the first working state after I started breaking everything... * app/gui/color-select.[ch] * libgimp/gimpcolordisplay.h * libgimp/gimpcolorselector.h: removed. * app/gui/Makefile.am * libgimp/Makefile.am: changed accordingly. * libgimp/gimpmodule.h: massively simplified. All voodoo is gone. * libgimpwidgets/gimpcolordisplay.[ch] * libgimpwidgets/gimpcolorselector.[ch]: new abstract base classes which need to be subclassed by modules. * libgimpwidgets/gimpcolorselect.[ch]: the built-in color selector from app/gui/color-select.* ported to be a GimpColorSelector subclass. * libgimpwidgets/Makefile.am * libgimpwidgets/gimpwidgets.h * libgimpwidgets/gimpwidgetsmarshal.list * libgimpwidgets/gimpwidgetstypes.h: changed accordingly. * app/core/gimpmoduleinfo.[ch]: made it a GTypeModule subclass * app/core/gimpmodules.c: changed accordingly. * app/core/gimpcontainer.c * app/core/gimplist.c: HACKED around to allow GimpLists of GObjects (not GimpObjects). This is EEKy, so I will either make gimp->modules a simple GList and revert this bit of change, or allow GObjects all over the place in GimpContainer land... * app/display/gimpdisplayshell-filter.[ch] * app/gui/color-notebook.c: removed all module stuff and use g_type_children() to get the list of available color_selectors and display_filters. * app/display/gimpdisplayshell-filter-dialog.c * app/display/gimpdisplayshell-render.c * app/gui/module-browser.c: changed accordingly. * app/gui/gui.c: ref the built-in color selector's class before the modules are queried so it appears first in the list of GimpColorSelector's children. * modules/Makefile.am: build the water color selector again. * modules/cdisplay_gamma.c * modules/cdisplay_highcontrast.c * modules/colorsel_triangle.c * modules/colorsel_water.c: ported them all to the new API. * modules/gimpmodregister.[ch]: removed the old EMX module hack.
2002-10-20 18:14:17 +08:00
enum
{
COLOR_CHANGED,
CHANNEL_CHANGED,
MODEL_VISIBLE_CHANGED,
SIMULATION,
Ported module loading to GTypeModule, getting rid of all own module 2002-10-20 Michael Natterer <mitch@gimp.org> Ported module loading to GTypeModule, getting rid of all own module registering/bookkeeping stuff for color selectors and display filters. The modules now simply register GimpColorSelector and GimpColorDisplay subclasses, the list of registered subclasses can then be obtained calling g_type_children() on the abstract base classes. This is work in progress and just the first working state after I started breaking everything... * app/gui/color-select.[ch] * libgimp/gimpcolordisplay.h * libgimp/gimpcolorselector.h: removed. * app/gui/Makefile.am * libgimp/Makefile.am: changed accordingly. * libgimp/gimpmodule.h: massively simplified. All voodoo is gone. * libgimpwidgets/gimpcolordisplay.[ch] * libgimpwidgets/gimpcolorselector.[ch]: new abstract base classes which need to be subclassed by modules. * libgimpwidgets/gimpcolorselect.[ch]: the built-in color selector from app/gui/color-select.* ported to be a GimpColorSelector subclass. * libgimpwidgets/Makefile.am * libgimpwidgets/gimpwidgets.h * libgimpwidgets/gimpwidgetsmarshal.list * libgimpwidgets/gimpwidgetstypes.h: changed accordingly. * app/core/gimpmoduleinfo.[ch]: made it a GTypeModule subclass * app/core/gimpmodules.c: changed accordingly. * app/core/gimpcontainer.c * app/core/gimplist.c: HACKED around to allow GimpLists of GObjects (not GimpObjects). This is EEKy, so I will either make gimp->modules a simple GList and revert this bit of change, or allow GObjects all over the place in GimpContainer land... * app/display/gimpdisplayshell-filter.[ch] * app/gui/color-notebook.c: removed all module stuff and use g_type_children() to get the list of available color_selectors and display_filters. * app/display/gimpdisplayshell-filter-dialog.c * app/display/gimpdisplayshell-render.c * app/gui/module-browser.c: changed accordingly. * app/gui/gui.c: ref the built-in color selector's class before the modules are queried so it appears first in the list of GimpColorSelector's children. * modules/Makefile.am: build the water color selector again. * modules/cdisplay_gamma.c * modules/cdisplay_highcontrast.c * modules/colorsel_triangle.c * modules/colorsel_water.c: ported them all to the new API. * modules/gimpmodregister.[ch]: removed the old EMX module hack.
2002-10-20 18:14:17 +08:00
LAST_SIGNAL
};
typedef struct _GimpColorSelectorPrivate
{
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 16:01:17 +08:00
gboolean toggles_visible;
gboolean toggles_sensitive;
gboolean show_alpha;
gboolean model_visible[3];
GimpColorSelectorChannel channel;
GeglColor *color;
gboolean simulation;
GimpColorProfile *simulation_profile;
GimpColorRenderingIntent simulation_intent;
gboolean simulation_bpc;
} GimpColorSelectorPrivate;
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 16:01:17 +08:00
static void gimp_color_selector_dispose (GObject *object);
static void gimp_color_selector_emit_color_changed (GimpColorSelector *selector);
static void gimp_color_selector_emit_channel_changed (GimpColorSelector *selector);
static void gimp_color_selector_emit_model_visible_changed (GimpColorSelector *selector,
GimpColorSelectorModel model);
G_DEFINE_TYPE_WITH_PRIVATE (GimpColorSelector, gimp_color_selector,
GTK_TYPE_BOX)
Ported module loading to GTypeModule, getting rid of all own module 2002-10-20 Michael Natterer <mitch@gimp.org> Ported module loading to GTypeModule, getting rid of all own module registering/bookkeeping stuff for color selectors and display filters. The modules now simply register GimpColorSelector and GimpColorDisplay subclasses, the list of registered subclasses can then be obtained calling g_type_children() on the abstract base classes. This is work in progress and just the first working state after I started breaking everything... * app/gui/color-select.[ch] * libgimp/gimpcolordisplay.h * libgimp/gimpcolorselector.h: removed. * app/gui/Makefile.am * libgimp/Makefile.am: changed accordingly. * libgimp/gimpmodule.h: massively simplified. All voodoo is gone. * libgimpwidgets/gimpcolordisplay.[ch] * libgimpwidgets/gimpcolorselector.[ch]: new abstract base classes which need to be subclassed by modules. * libgimpwidgets/gimpcolorselect.[ch]: the built-in color selector from app/gui/color-select.* ported to be a GimpColorSelector subclass. * libgimpwidgets/Makefile.am * libgimpwidgets/gimpwidgets.h * libgimpwidgets/gimpwidgetsmarshal.list * libgimpwidgets/gimpwidgetstypes.h: changed accordingly. * app/core/gimpmoduleinfo.[ch]: made it a GTypeModule subclass * app/core/gimpmodules.c: changed accordingly. * app/core/gimpcontainer.c * app/core/gimplist.c: HACKED around to allow GimpLists of GObjects (not GimpObjects). This is EEKy, so I will either make gimp->modules a simple GList and revert this bit of change, or allow GObjects all over the place in GimpContainer land... * app/display/gimpdisplayshell-filter.[ch] * app/gui/color-notebook.c: removed all module stuff and use g_type_children() to get the list of available color_selectors and display_filters. * app/display/gimpdisplayshell-filter-dialog.c * app/display/gimpdisplayshell-render.c * app/gui/module-browser.c: changed accordingly. * app/gui/gui.c: ref the built-in color selector's class before the modules are queried so it appears first in the list of GimpColorSelector's children. * modules/Makefile.am: build the water color selector again. * modules/cdisplay_gamma.c * modules/cdisplay_highcontrast.c * modules/colorsel_triangle.c * modules/colorsel_water.c: ported them all to the new API. * modules/gimpmodregister.[ch]: removed the old EMX module hack.
2002-10-20 18:14:17 +08:00
#define parent_class gimp_color_selector_parent_class
Ported module loading to GTypeModule, getting rid of all own module 2002-10-20 Michael Natterer <mitch@gimp.org> Ported module loading to GTypeModule, getting rid of all own module registering/bookkeeping stuff for color selectors and display filters. The modules now simply register GimpColorSelector and GimpColorDisplay subclasses, the list of registered subclasses can then be obtained calling g_type_children() on the abstract base classes. This is work in progress and just the first working state after I started breaking everything... * app/gui/color-select.[ch] * libgimp/gimpcolordisplay.h * libgimp/gimpcolorselector.h: removed. * app/gui/Makefile.am * libgimp/Makefile.am: changed accordingly. * libgimp/gimpmodule.h: massively simplified. All voodoo is gone. * libgimpwidgets/gimpcolordisplay.[ch] * libgimpwidgets/gimpcolorselector.[ch]: new abstract base classes which need to be subclassed by modules. * libgimpwidgets/gimpcolorselect.[ch]: the built-in color selector from app/gui/color-select.* ported to be a GimpColorSelector subclass. * libgimpwidgets/Makefile.am * libgimpwidgets/gimpwidgets.h * libgimpwidgets/gimpwidgetsmarshal.list * libgimpwidgets/gimpwidgetstypes.h: changed accordingly. * app/core/gimpmoduleinfo.[ch]: made it a GTypeModule subclass * app/core/gimpmodules.c: changed accordingly. * app/core/gimpcontainer.c * app/core/gimplist.c: HACKED around to allow GimpLists of GObjects (not GimpObjects). This is EEKy, so I will either make gimp->modules a simple GList and revert this bit of change, or allow GObjects all over the place in GimpContainer land... * app/display/gimpdisplayshell-filter.[ch] * app/gui/color-notebook.c: removed all module stuff and use g_type_children() to get the list of available color_selectors and display_filters. * app/display/gimpdisplayshell-filter-dialog.c * app/display/gimpdisplayshell-render.c * app/gui/module-browser.c: changed accordingly. * app/gui/gui.c: ref the built-in color selector's class before the modules are queried so it appears first in the list of GimpColorSelector's children. * modules/Makefile.am: build the water color selector again. * modules/cdisplay_gamma.c * modules/cdisplay_highcontrast.c * modules/colorsel_triangle.c * modules/colorsel_water.c: ported them all to the new API. * modules/gimpmodregister.[ch]: removed the old EMX module hack.
2002-10-20 18:14:17 +08:00
static guint selector_signals[LAST_SIGNAL] = { 0 };
Ported module loading to GTypeModule, getting rid of all own module 2002-10-20 Michael Natterer <mitch@gimp.org> Ported module loading to GTypeModule, getting rid of all own module registering/bookkeeping stuff for color selectors and display filters. The modules now simply register GimpColorSelector and GimpColorDisplay subclasses, the list of registered subclasses can then be obtained calling g_type_children() on the abstract base classes. This is work in progress and just the first working state after I started breaking everything... * app/gui/color-select.[ch] * libgimp/gimpcolordisplay.h * libgimp/gimpcolorselector.h: removed. * app/gui/Makefile.am * libgimp/Makefile.am: changed accordingly. * libgimp/gimpmodule.h: massively simplified. All voodoo is gone. * libgimpwidgets/gimpcolordisplay.[ch] * libgimpwidgets/gimpcolorselector.[ch]: new abstract base classes which need to be subclassed by modules. * libgimpwidgets/gimpcolorselect.[ch]: the built-in color selector from app/gui/color-select.* ported to be a GimpColorSelector subclass. * libgimpwidgets/Makefile.am * libgimpwidgets/gimpwidgets.h * libgimpwidgets/gimpwidgetsmarshal.list * libgimpwidgets/gimpwidgetstypes.h: changed accordingly. * app/core/gimpmoduleinfo.[ch]: made it a GTypeModule subclass * app/core/gimpmodules.c: changed accordingly. * app/core/gimpcontainer.c * app/core/gimplist.c: HACKED around to allow GimpLists of GObjects (not GimpObjects). This is EEKy, so I will either make gimp->modules a simple GList and revert this bit of change, or allow GObjects all over the place in GimpContainer land... * app/display/gimpdisplayshell-filter.[ch] * app/gui/color-notebook.c: removed all module stuff and use g_type_children() to get the list of available color_selectors and display_filters. * app/display/gimpdisplayshell-filter-dialog.c * app/display/gimpdisplayshell-render.c * app/gui/module-browser.c: changed accordingly. * app/gui/gui.c: ref the built-in color selector's class before the modules are queried so it appears first in the list of GimpColorSelector's children. * modules/Makefile.am: build the water color selector again. * modules/cdisplay_gamma.c * modules/cdisplay_highcontrast.c * modules/colorsel_triangle.c * modules/colorsel_water.c: ported them all to the new API. * modules/gimpmodregister.[ch]: removed the old EMX module hack.
2002-10-20 18:14:17 +08:00
static void
gimp_color_selector_class_init (GimpColorSelectorClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->dispose = gimp_color_selector_dispose;
Ported module loading to GTypeModule, getting rid of all own module 2002-10-20 Michael Natterer <mitch@gimp.org> Ported module loading to GTypeModule, getting rid of all own module registering/bookkeeping stuff for color selectors and display filters. The modules now simply register GimpColorSelector and GimpColorDisplay subclasses, the list of registered subclasses can then be obtained calling g_type_children() on the abstract base classes. This is work in progress and just the first working state after I started breaking everything... * app/gui/color-select.[ch] * libgimp/gimpcolordisplay.h * libgimp/gimpcolorselector.h: removed. * app/gui/Makefile.am * libgimp/Makefile.am: changed accordingly. * libgimp/gimpmodule.h: massively simplified. All voodoo is gone. * libgimpwidgets/gimpcolordisplay.[ch] * libgimpwidgets/gimpcolorselector.[ch]: new abstract base classes which need to be subclassed by modules. * libgimpwidgets/gimpcolorselect.[ch]: the built-in color selector from app/gui/color-select.* ported to be a GimpColorSelector subclass. * libgimpwidgets/Makefile.am * libgimpwidgets/gimpwidgets.h * libgimpwidgets/gimpwidgetsmarshal.list * libgimpwidgets/gimpwidgetstypes.h: changed accordingly. * app/core/gimpmoduleinfo.[ch]: made it a GTypeModule subclass * app/core/gimpmodules.c: changed accordingly. * app/core/gimpcontainer.c * app/core/gimplist.c: HACKED around to allow GimpLists of GObjects (not GimpObjects). This is EEKy, so I will either make gimp->modules a simple GList and revert this bit of change, or allow GObjects all over the place in GimpContainer land... * app/display/gimpdisplayshell-filter.[ch] * app/gui/color-notebook.c: removed all module stuff and use g_type_children() to get the list of available color_selectors and display_filters. * app/display/gimpdisplayshell-filter-dialog.c * app/display/gimpdisplayshell-render.c * app/gui/module-browser.c: changed accordingly. * app/gui/gui.c: ref the built-in color selector's class before the modules are queried so it appears first in the list of GimpColorSelector's children. * modules/Makefile.am: build the water color selector again. * modules/cdisplay_gamma.c * modules/cdisplay_highcontrast.c * modules/colorsel_triangle.c * modules/colorsel_water.c: ported them all to the new API. * modules/gimpmodregister.[ch]: removed the old EMX module hack.
2002-10-20 18:14:17 +08:00
selector_signals[COLOR_CHANGED] =
g_signal_new ("color-changed",
Ported module loading to GTypeModule, getting rid of all own module 2002-10-20 Michael Natterer <mitch@gimp.org> Ported module loading to GTypeModule, getting rid of all own module registering/bookkeeping stuff for color selectors and display filters. The modules now simply register GimpColorSelector and GimpColorDisplay subclasses, the list of registered subclasses can then be obtained calling g_type_children() on the abstract base classes. This is work in progress and just the first working state after I started breaking everything... * app/gui/color-select.[ch] * libgimp/gimpcolordisplay.h * libgimp/gimpcolorselector.h: removed. * app/gui/Makefile.am * libgimp/Makefile.am: changed accordingly. * libgimp/gimpmodule.h: massively simplified. All voodoo is gone. * libgimpwidgets/gimpcolordisplay.[ch] * libgimpwidgets/gimpcolorselector.[ch]: new abstract base classes which need to be subclassed by modules. * libgimpwidgets/gimpcolorselect.[ch]: the built-in color selector from app/gui/color-select.* ported to be a GimpColorSelector subclass. * libgimpwidgets/Makefile.am * libgimpwidgets/gimpwidgets.h * libgimpwidgets/gimpwidgetsmarshal.list * libgimpwidgets/gimpwidgetstypes.h: changed accordingly. * app/core/gimpmoduleinfo.[ch]: made it a GTypeModule subclass * app/core/gimpmodules.c: changed accordingly. * app/core/gimpcontainer.c * app/core/gimplist.c: HACKED around to allow GimpLists of GObjects (not GimpObjects). This is EEKy, so I will either make gimp->modules a simple GList and revert this bit of change, or allow GObjects all over the place in GimpContainer land... * app/display/gimpdisplayshell-filter.[ch] * app/gui/color-notebook.c: removed all module stuff and use g_type_children() to get the list of available color_selectors and display_filters. * app/display/gimpdisplayshell-filter-dialog.c * app/display/gimpdisplayshell-render.c * app/gui/module-browser.c: changed accordingly. * app/gui/gui.c: ref the built-in color selector's class before the modules are queried so it appears first in the list of GimpColorSelector's children. * modules/Makefile.am: build the water color selector again. * modules/cdisplay_gamma.c * modules/cdisplay_highcontrast.c * modules/colorsel_triangle.c * modules/colorsel_water.c: ported them all to the new API. * modules/gimpmodregister.[ch]: removed the old EMX module hack.
2002-10-20 18:14:17 +08:00
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GimpColorSelectorClass, color_changed),
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 16:01:17 +08:00
NULL, NULL, NULL,
G_TYPE_NONE, 1,
GEGL_TYPE_COLOR);
Ported module loading to GTypeModule, getting rid of all own module 2002-10-20 Michael Natterer <mitch@gimp.org> Ported module loading to GTypeModule, getting rid of all own module registering/bookkeeping stuff for color selectors and display filters. The modules now simply register GimpColorSelector and GimpColorDisplay subclasses, the list of registered subclasses can then be obtained calling g_type_children() on the abstract base classes. This is work in progress and just the first working state after I started breaking everything... * app/gui/color-select.[ch] * libgimp/gimpcolordisplay.h * libgimp/gimpcolorselector.h: removed. * app/gui/Makefile.am * libgimp/Makefile.am: changed accordingly. * libgimp/gimpmodule.h: massively simplified. All voodoo is gone. * libgimpwidgets/gimpcolordisplay.[ch] * libgimpwidgets/gimpcolorselector.[ch]: new abstract base classes which need to be subclassed by modules. * libgimpwidgets/gimpcolorselect.[ch]: the built-in color selector from app/gui/color-select.* ported to be a GimpColorSelector subclass. * libgimpwidgets/Makefile.am * libgimpwidgets/gimpwidgets.h * libgimpwidgets/gimpwidgetsmarshal.list * libgimpwidgets/gimpwidgetstypes.h: changed accordingly. * app/core/gimpmoduleinfo.[ch]: made it a GTypeModule subclass * app/core/gimpmodules.c: changed accordingly. * app/core/gimpcontainer.c * app/core/gimplist.c: HACKED around to allow GimpLists of GObjects (not GimpObjects). This is EEKy, so I will either make gimp->modules a simple GList and revert this bit of change, or allow GObjects all over the place in GimpContainer land... * app/display/gimpdisplayshell-filter.[ch] * app/gui/color-notebook.c: removed all module stuff and use g_type_children() to get the list of available color_selectors and display_filters. * app/display/gimpdisplayshell-filter-dialog.c * app/display/gimpdisplayshell-render.c * app/gui/module-browser.c: changed accordingly. * app/gui/gui.c: ref the built-in color selector's class before the modules are queried so it appears first in the list of GimpColorSelector's children. * modules/Makefile.am: build the water color selector again. * modules/cdisplay_gamma.c * modules/cdisplay_highcontrast.c * modules/colorsel_triangle.c * modules/colorsel_water.c: ported them all to the new API. * modules/gimpmodregister.[ch]: removed the old EMX module hack.
2002-10-20 18:14:17 +08:00
selector_signals[CHANNEL_CHANGED] =
g_signal_new ("channel-changed",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GimpColorSelectorClass, channel_changed),
NULL, NULL, NULL,
G_TYPE_NONE, 1,
GIMP_TYPE_COLOR_SELECTOR_CHANNEL);
selector_signals[MODEL_VISIBLE_CHANGED] =
g_signal_new ("model-visible-changed",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GimpColorSelectorClass, model_visible_changed),
NULL, NULL,
_gimp_widgets_marshal_VOID__ENUM_BOOLEAN,
G_TYPE_NONE, 2,
GIMP_TYPE_COLOR_SELECTOR_MODEL,
G_TYPE_BOOLEAN);
selector_signals[SIMULATION] =
g_signal_new ("simulation",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GimpColorSelectorClass, simulation),
NULL, NULL, NULL,
G_TYPE_NONE, 1,
G_TYPE_BOOLEAN);
klass->name = "Unnamed";
klass->help_id = NULL;
klass->icon_name = GIMP_ICON_PALETTE;
added virtual functions set_toggles_visible() and set_toggles_sensitive(). 2002-11-05 Michael Natterer <mitch@gimp.org> * libgimpwidgets/gimpcolorselector.[ch]: added virtual functions set_toggles_visible() and set_toggles_sensitive(). Added a stock_id. Emit "color_changed" and "channel_changed" on set_color() and set_channel() resp. * libgimpwidgets/gimpcolornotebook.[ch]: implement the new methods. Added gimp_color_notebook_set_has_page() to control which selectors a notebook contains. * libgimpwidgets/gimpcolorscales.[ch]: removed the toggle API and implement the new methods. * libgimpwidgets/gimpcolorselect.c: added toggle buttons for the channels so the widget doesn't need external ones. * app/gui/color-notebook.c: changed accordingly. * libgimpwidgets/gimpstock.[ch] * themes/Default/images/Makefile.am * themes/Default/images/stock-color-triangle-16.png: added a (bad) icon for the triangle color selector. * modules/colorsel_triangle.c: use the new icon. * modules/colorsel_water.c: use the "Paintbrush" icon for now. * app/widgets/gimpcoloreditor.[ch]: new widget for editing the FG/BG color featuring a color notebook, stock buttons for selecting the pages and a GimpPickButton. * app/widgets/Makefile.am * app/widgets/widgets-types.h: changed accordingly. * app/gui/dialogs-constructors.[ch] * app/gui/dialogs.c: added a dockable wrapper for GimpColorEditor. * app/gui/menus.c: added it to the menus. Also added separate Layers, Channels and Paths entries. Bind <ctrl>L to the new callback so it doesn't always create a new layers dialog.
2002-11-05 08:02:56 +08:00
klass->set_toggles_visible = NULL;
klass->set_toggles_sensitive = NULL;
klass->set_show_alpha = NULL;
klass->set_color = NULL;
klass->set_channel = NULL;
klass->set_model_visible = NULL;
added virtual functions set_toggles_visible() and set_toggles_sensitive(). 2002-11-05 Michael Natterer <mitch@gimp.org> * libgimpwidgets/gimpcolorselector.[ch]: added virtual functions set_toggles_visible() and set_toggles_sensitive(). Added a stock_id. Emit "color_changed" and "channel_changed" on set_color() and set_channel() resp. * libgimpwidgets/gimpcolornotebook.[ch]: implement the new methods. Added gimp_color_notebook_set_has_page() to control which selectors a notebook contains. * libgimpwidgets/gimpcolorscales.[ch]: removed the toggle API and implement the new methods. * libgimpwidgets/gimpcolorselect.c: added toggle buttons for the channels so the widget doesn't need external ones. * app/gui/color-notebook.c: changed accordingly. * libgimpwidgets/gimpstock.[ch] * themes/Default/images/Makefile.am * themes/Default/images/stock-color-triangle-16.png: added a (bad) icon for the triangle color selector. * modules/colorsel_triangle.c: use the new icon. * modules/colorsel_water.c: use the "Paintbrush" icon for now. * app/widgets/gimpcoloreditor.[ch]: new widget for editing the FG/BG color featuring a color notebook, stock buttons for selecting the pages and a GimpPickButton. * app/widgets/Makefile.am * app/widgets/widgets-types.h: changed accordingly. * app/gui/dialogs-constructors.[ch] * app/gui/dialogs.c: added a dockable wrapper for GimpColorEditor. * app/gui/menus.c: added it to the menus. Also added separate Layers, Channels and Paths entries. Bind <ctrl>L to the new callback so it doesn't always create a new layers dialog.
2002-11-05 08:02:56 +08:00
klass->color_changed = NULL;
klass->channel_changed = NULL;
klass->model_visible_changed = NULL;
klass->set_config = NULL;
Ported module loading to GTypeModule, getting rid of all own module 2002-10-20 Michael Natterer <mitch@gimp.org> Ported module loading to GTypeModule, getting rid of all own module registering/bookkeeping stuff for color selectors and display filters. The modules now simply register GimpColorSelector and GimpColorDisplay subclasses, the list of registered subclasses can then be obtained calling g_type_children() on the abstract base classes. This is work in progress and just the first working state after I started breaking everything... * app/gui/color-select.[ch] * libgimp/gimpcolordisplay.h * libgimp/gimpcolorselector.h: removed. * app/gui/Makefile.am * libgimp/Makefile.am: changed accordingly. * libgimp/gimpmodule.h: massively simplified. All voodoo is gone. * libgimpwidgets/gimpcolordisplay.[ch] * libgimpwidgets/gimpcolorselector.[ch]: new abstract base classes which need to be subclassed by modules. * libgimpwidgets/gimpcolorselect.[ch]: the built-in color selector from app/gui/color-select.* ported to be a GimpColorSelector subclass. * libgimpwidgets/Makefile.am * libgimpwidgets/gimpwidgets.h * libgimpwidgets/gimpwidgetsmarshal.list * libgimpwidgets/gimpwidgetstypes.h: changed accordingly. * app/core/gimpmoduleinfo.[ch]: made it a GTypeModule subclass * app/core/gimpmodules.c: changed accordingly. * app/core/gimpcontainer.c * app/core/gimplist.c: HACKED around to allow GimpLists of GObjects (not GimpObjects). This is EEKy, so I will either make gimp->modules a simple GList and revert this bit of change, or allow GObjects all over the place in GimpContainer land... * app/display/gimpdisplayshell-filter.[ch] * app/gui/color-notebook.c: removed all module stuff and use g_type_children() to get the list of available color_selectors and display_filters. * app/display/gimpdisplayshell-filter-dialog.c * app/display/gimpdisplayshell-render.c * app/gui/module-browser.c: changed accordingly. * app/gui/gui.c: ref the built-in color selector's class before the modules are queried so it appears first in the list of GimpColorSelector's children. * modules/Makefile.am: build the water color selector again. * modules/cdisplay_gamma.c * modules/cdisplay_highcontrast.c * modules/colorsel_triangle.c * modules/colorsel_water.c: ported them all to the new API. * modules/gimpmodregister.[ch]: removed the old EMX module hack.
2002-10-20 18:14:17 +08:00
}
static void
gimp_color_selector_init (GimpColorSelector *selector)
{
GimpColorSelectorPrivate *priv;
priv = gimp_color_selector_get_instance_private (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 16:01:17 +08:00
priv->toggles_visible = TRUE;
priv->toggles_sensitive = TRUE;
priv->show_alpha = TRUE;
gtk_orientable_set_orientation (GTK_ORIENTABLE (selector),
GTK_ORIENTATION_VERTICAL);
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 16:01:17 +08:00
priv->channel = GIMP_COLOR_SELECTOR_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 16:01:17 +08:00
priv->color = gegl_color_new ("black");
priv->model_visible[GIMP_COLOR_SELECTOR_MODEL_RGB] = TRUE;
priv->model_visible[GIMP_COLOR_SELECTOR_MODEL_LCH] = TRUE;
priv->model_visible[GIMP_COLOR_SELECTOR_MODEL_HSV] = FALSE;
priv->simulation = FALSE;
priv->simulation_profile = NULL;
priv->simulation_intent = GIMP_COLOR_RENDERING_INTENT_RELATIVE_COLORIMETRIC;
priv->simulation_bpc = FALSE;
Ported module loading to GTypeModule, getting rid of all own module 2002-10-20 Michael Natterer <mitch@gimp.org> Ported module loading to GTypeModule, getting rid of all own module registering/bookkeeping stuff for color selectors and display filters. The modules now simply register GimpColorSelector and GimpColorDisplay subclasses, the list of registered subclasses can then be obtained calling g_type_children() on the abstract base classes. This is work in progress and just the first working state after I started breaking everything... * app/gui/color-select.[ch] * libgimp/gimpcolordisplay.h * libgimp/gimpcolorselector.h: removed. * app/gui/Makefile.am * libgimp/Makefile.am: changed accordingly. * libgimp/gimpmodule.h: massively simplified. All voodoo is gone. * libgimpwidgets/gimpcolordisplay.[ch] * libgimpwidgets/gimpcolorselector.[ch]: new abstract base classes which need to be subclassed by modules. * libgimpwidgets/gimpcolorselect.[ch]: the built-in color selector from app/gui/color-select.* ported to be a GimpColorSelector subclass. * libgimpwidgets/Makefile.am * libgimpwidgets/gimpwidgets.h * libgimpwidgets/gimpwidgetsmarshal.list * libgimpwidgets/gimpwidgetstypes.h: changed accordingly. * app/core/gimpmoduleinfo.[ch]: made it a GTypeModule subclass * app/core/gimpmodules.c: changed accordingly. * app/core/gimpcontainer.c * app/core/gimplist.c: HACKED around to allow GimpLists of GObjects (not GimpObjects). This is EEKy, so I will either make gimp->modules a simple GList and revert this bit of change, or allow GObjects all over the place in GimpContainer land... * app/display/gimpdisplayshell-filter.[ch] * app/gui/color-notebook.c: removed all module stuff and use g_type_children() to get the list of available color_selectors and display_filters. * app/display/gimpdisplayshell-filter-dialog.c * app/display/gimpdisplayshell-render.c * app/gui/module-browser.c: changed accordingly. * app/gui/gui.c: ref the built-in color selector's class before the modules are queried so it appears first in the list of GimpColorSelector's children. * modules/Makefile.am: build the water color selector again. * modules/cdisplay_gamma.c * modules/cdisplay_highcontrast.c * modules/colorsel_triangle.c * modules/colorsel_water.c: ported them all to the new API. * modules/gimpmodregister.[ch]: removed the old EMX module hack.
2002-10-20 18:14:17 +08:00
}
static void
gimp_color_selector_dispose (GObject *object)
{
GimpColorSelector *selector = GIMP_COLOR_SELECTOR (object);
GimpColorSelectorPrivate *priv;
priv = gimp_color_selector_get_instance_private (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 16:01:17 +08:00
gimp_color_selector_set_config (selector, NULL);
g_clear_object (&priv->color);
g_clear_object (&priv->simulation_profile);
G_OBJECT_CLASS (parent_class)->dispose (object);
}
/* public functions */
/**
* gimp_color_selector_new:
* @selector_type: The #GType of the selector to create.
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 16:01:17 +08:00
* @color: The initial color to be edited.
* @channel: The selector's initial channel.
*
* Creates a new #GimpColorSelector widget of type @selector_type.
*
* Note that this is mostly internal API to be used by other widgets.
*
* Please use gimp_color_selection_new() for the "GIMP-typical" color
* selection widget. Also see gimp_color_button_new().
*
* Retunn value: the new #GimpColorSelector widget.
**/
Ported module loading to GTypeModule, getting rid of all own module 2002-10-20 Michael Natterer <mitch@gimp.org> Ported module loading to GTypeModule, getting rid of all own module registering/bookkeeping stuff for color selectors and display filters. The modules now simply register GimpColorSelector and GimpColorDisplay subclasses, the list of registered subclasses can then be obtained calling g_type_children() on the abstract base classes. This is work in progress and just the first working state after I started breaking everything... * app/gui/color-select.[ch] * libgimp/gimpcolordisplay.h * libgimp/gimpcolorselector.h: removed. * app/gui/Makefile.am * libgimp/Makefile.am: changed accordingly. * libgimp/gimpmodule.h: massively simplified. All voodoo is gone. * libgimpwidgets/gimpcolordisplay.[ch] * libgimpwidgets/gimpcolorselector.[ch]: new abstract base classes which need to be subclassed by modules. * libgimpwidgets/gimpcolorselect.[ch]: the built-in color selector from app/gui/color-select.* ported to be a GimpColorSelector subclass. * libgimpwidgets/Makefile.am * libgimpwidgets/gimpwidgets.h * libgimpwidgets/gimpwidgetsmarshal.list * libgimpwidgets/gimpwidgetstypes.h: changed accordingly. * app/core/gimpmoduleinfo.[ch]: made it a GTypeModule subclass * app/core/gimpmodules.c: changed accordingly. * app/core/gimpcontainer.c * app/core/gimplist.c: HACKED around to allow GimpLists of GObjects (not GimpObjects). This is EEKy, so I will either make gimp->modules a simple GList and revert this bit of change, or allow GObjects all over the place in GimpContainer land... * app/display/gimpdisplayshell-filter.[ch] * app/gui/color-notebook.c: removed all module stuff and use g_type_children() to get the list of available color_selectors and display_filters. * app/display/gimpdisplayshell-filter-dialog.c * app/display/gimpdisplayshell-render.c * app/gui/module-browser.c: changed accordingly. * app/gui/gui.c: ref the built-in color selector's class before the modules are queried so it appears first in the list of GimpColorSelector's children. * modules/Makefile.am: build the water color selector again. * modules/cdisplay_gamma.c * modules/cdisplay_highcontrast.c * modules/colorsel_triangle.c * modules/colorsel_water.c: ported them all to the new API. * modules/gimpmodregister.[ch]: removed the old EMX module hack.
2002-10-20 18:14:17 +08:00
GtkWidget *
gimp_color_selector_new (GType selector_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 16:01:17 +08:00
GeglColor *color,
GimpColorSelectorChannel channel)
Ported module loading to GTypeModule, getting rid of all own module 2002-10-20 Michael Natterer <mitch@gimp.org> Ported module loading to GTypeModule, getting rid of all own module registering/bookkeeping stuff for color selectors and display filters. The modules now simply register GimpColorSelector and GimpColorDisplay subclasses, the list of registered subclasses can then be obtained calling g_type_children() on the abstract base classes. This is work in progress and just the first working state after I started breaking everything... * app/gui/color-select.[ch] * libgimp/gimpcolordisplay.h * libgimp/gimpcolorselector.h: removed. * app/gui/Makefile.am * libgimp/Makefile.am: changed accordingly. * libgimp/gimpmodule.h: massively simplified. All voodoo is gone. * libgimpwidgets/gimpcolordisplay.[ch] * libgimpwidgets/gimpcolorselector.[ch]: new abstract base classes which need to be subclassed by modules. * libgimpwidgets/gimpcolorselect.[ch]: the built-in color selector from app/gui/color-select.* ported to be a GimpColorSelector subclass. * libgimpwidgets/Makefile.am * libgimpwidgets/gimpwidgets.h * libgimpwidgets/gimpwidgetsmarshal.list * libgimpwidgets/gimpwidgetstypes.h: changed accordingly. * app/core/gimpmoduleinfo.[ch]: made it a GTypeModule subclass * app/core/gimpmodules.c: changed accordingly. * app/core/gimpcontainer.c * app/core/gimplist.c: HACKED around to allow GimpLists of GObjects (not GimpObjects). This is EEKy, so I will either make gimp->modules a simple GList and revert this bit of change, or allow GObjects all over the place in GimpContainer land... * app/display/gimpdisplayshell-filter.[ch] * app/gui/color-notebook.c: removed all module stuff and use g_type_children() to get the list of available color_selectors and display_filters. * app/display/gimpdisplayshell-filter-dialog.c * app/display/gimpdisplayshell-render.c * app/gui/module-browser.c: changed accordingly. * app/gui/gui.c: ref the built-in color selector's class before the modules are queried so it appears first in the list of GimpColorSelector's children. * modules/Makefile.am: build the water color selector again. * modules/cdisplay_gamma.c * modules/cdisplay_highcontrast.c * modules/colorsel_triangle.c * modules/colorsel_water.c: ported them all to the new API. * modules/gimpmodregister.[ch]: removed the old EMX module hack.
2002-10-20 18:14:17 +08:00
{
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 16:01:17 +08:00
g_return_val_if_fail (g_type_is_a (selector_type, GIMP_TYPE_COLOR_SELECTOR), NULL);
g_return_val_if_fail (GEGL_IS_COLOR (color), NULL);
Ported module loading to GTypeModule, getting rid of all own module 2002-10-20 Michael Natterer <mitch@gimp.org> Ported module loading to GTypeModule, getting rid of all own module registering/bookkeeping stuff for color selectors and display filters. The modules now simply register GimpColorSelector and GimpColorDisplay subclasses, the list of registered subclasses can then be obtained calling g_type_children() on the abstract base classes. This is work in progress and just the first working state after I started breaking everything... * app/gui/color-select.[ch] * libgimp/gimpcolordisplay.h * libgimp/gimpcolorselector.h: removed. * app/gui/Makefile.am * libgimp/Makefile.am: changed accordingly. * libgimp/gimpmodule.h: massively simplified. All voodoo is gone. * libgimpwidgets/gimpcolordisplay.[ch] * libgimpwidgets/gimpcolorselector.[ch]: new abstract base classes which need to be subclassed by modules. * libgimpwidgets/gimpcolorselect.[ch]: the built-in color selector from app/gui/color-select.* ported to be a GimpColorSelector subclass. * libgimpwidgets/Makefile.am * libgimpwidgets/gimpwidgets.h * libgimpwidgets/gimpwidgetsmarshal.list * libgimpwidgets/gimpwidgetstypes.h: changed accordingly. * app/core/gimpmoduleinfo.[ch]: made it a GTypeModule subclass * app/core/gimpmodules.c: changed accordingly. * app/core/gimpcontainer.c * app/core/gimplist.c: HACKED around to allow GimpLists of GObjects (not GimpObjects). This is EEKy, so I will either make gimp->modules a simple GList and revert this bit of change, or allow GObjects all over the place in GimpContainer land... * app/display/gimpdisplayshell-filter.[ch] * app/gui/color-notebook.c: removed all module stuff and use g_type_children() to get the list of available color_selectors and display_filters. * app/display/gimpdisplayshell-filter-dialog.c * app/display/gimpdisplayshell-render.c * app/gui/module-browser.c: changed accordingly. * app/gui/gui.c: ref the built-in color selector's class before the modules are queried so it appears first in the list of GimpColorSelector's children. * modules/Makefile.am: build the water color selector again. * modules/cdisplay_gamma.c * modules/cdisplay_highcontrast.c * modules/colorsel_triangle.c * modules/colorsel_water.c: ported them all to the new API. * modules/gimpmodregister.[ch]: removed the old EMX module hack.
2002-10-20 18:14:17 +08:00
selector = g_object_new (selector_type, NULL);
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 16:01:17 +08:00
gimp_color_selector_set_color (selector, color);
gimp_color_selector_set_channel (selector, channel);
Ported module loading to GTypeModule, getting rid of all own module 2002-10-20 Michael Natterer <mitch@gimp.org> Ported module loading to GTypeModule, getting rid of all own module registering/bookkeeping stuff for color selectors and display filters. The modules now simply register GimpColorSelector and GimpColorDisplay subclasses, the list of registered subclasses can then be obtained calling g_type_children() on the abstract base classes. This is work in progress and just the first working state after I started breaking everything... * app/gui/color-select.[ch] * libgimp/gimpcolordisplay.h * libgimp/gimpcolorselector.h: removed. * app/gui/Makefile.am * libgimp/Makefile.am: changed accordingly. * libgimp/gimpmodule.h: massively simplified. All voodoo is gone. * libgimpwidgets/gimpcolordisplay.[ch] * libgimpwidgets/gimpcolorselector.[ch]: new abstract base classes which need to be subclassed by modules. * libgimpwidgets/gimpcolorselect.[ch]: the built-in color selector from app/gui/color-select.* ported to be a GimpColorSelector subclass. * libgimpwidgets/Makefile.am * libgimpwidgets/gimpwidgets.h * libgimpwidgets/gimpwidgetsmarshal.list * libgimpwidgets/gimpwidgetstypes.h: changed accordingly. * app/core/gimpmoduleinfo.[ch]: made it a GTypeModule subclass * app/core/gimpmodules.c: changed accordingly. * app/core/gimpcontainer.c * app/core/gimplist.c: HACKED around to allow GimpLists of GObjects (not GimpObjects). This is EEKy, so I will either make gimp->modules a simple GList and revert this bit of change, or allow GObjects all over the place in GimpContainer land... * app/display/gimpdisplayshell-filter.[ch] * app/gui/color-notebook.c: removed all module stuff and use g_type_children() to get the list of available color_selectors and display_filters. * app/display/gimpdisplayshell-filter-dialog.c * app/display/gimpdisplayshell-render.c * app/gui/module-browser.c: changed accordingly. * app/gui/gui.c: ref the built-in color selector's class before the modules are queried so it appears first in the list of GimpColorSelector's children. * modules/Makefile.am: build the water color selector again. * modules/cdisplay_gamma.c * modules/cdisplay_highcontrast.c * modules/colorsel_triangle.c * modules/colorsel_water.c: ported them all to the new API. * modules/gimpmodregister.[ch]: removed the old EMX module hack.
2002-10-20 18:14:17 +08:00
return GTK_WIDGET (selector);
}
/**
* gimp_color_selector_set_toggles_visible:
* @selector: A #GimpColorSelector widget.
* @visible: The new @visible setting.
*
* Sets the @visible property of the @selector's toggles.
*
* This function has no effect if this @selector instance has no
* toggles to switch channels.
**/
added virtual functions set_toggles_visible() and set_toggles_sensitive(). 2002-11-05 Michael Natterer <mitch@gimp.org> * libgimpwidgets/gimpcolorselector.[ch]: added virtual functions set_toggles_visible() and set_toggles_sensitive(). Added a stock_id. Emit "color_changed" and "channel_changed" on set_color() and set_channel() resp. * libgimpwidgets/gimpcolornotebook.[ch]: implement the new methods. Added gimp_color_notebook_set_has_page() to control which selectors a notebook contains. * libgimpwidgets/gimpcolorscales.[ch]: removed the toggle API and implement the new methods. * libgimpwidgets/gimpcolorselect.c: added toggle buttons for the channels so the widget doesn't need external ones. * app/gui/color-notebook.c: changed accordingly. * libgimpwidgets/gimpstock.[ch] * themes/Default/images/Makefile.am * themes/Default/images/stock-color-triangle-16.png: added a (bad) icon for the triangle color selector. * modules/colorsel_triangle.c: use the new icon. * modules/colorsel_water.c: use the "Paintbrush" icon for now. * app/widgets/gimpcoloreditor.[ch]: new widget for editing the FG/BG color featuring a color notebook, stock buttons for selecting the pages and a GimpPickButton. * app/widgets/Makefile.am * app/widgets/widgets-types.h: changed accordingly. * app/gui/dialogs-constructors.[ch] * app/gui/dialogs.c: added a dockable wrapper for GimpColorEditor. * app/gui/menus.c: added it to the menus. Also added separate Layers, Channels and Paths entries. Bind <ctrl>L to the new callback so it doesn't always create a new layers dialog.
2002-11-05 08:02:56 +08:00
void
gimp_color_selector_set_toggles_visible (GimpColorSelector *selector,
gboolean visible)
{
GimpColorSelectorPrivate *priv;
added virtual functions set_toggles_visible() and set_toggles_sensitive(). 2002-11-05 Michael Natterer <mitch@gimp.org> * libgimpwidgets/gimpcolorselector.[ch]: added virtual functions set_toggles_visible() and set_toggles_sensitive(). Added a stock_id. Emit "color_changed" and "channel_changed" on set_color() and set_channel() resp. * libgimpwidgets/gimpcolornotebook.[ch]: implement the new methods. Added gimp_color_notebook_set_has_page() to control which selectors a notebook contains. * libgimpwidgets/gimpcolorscales.[ch]: removed the toggle API and implement the new methods. * libgimpwidgets/gimpcolorselect.c: added toggle buttons for the channels so the widget doesn't need external ones. * app/gui/color-notebook.c: changed accordingly. * libgimpwidgets/gimpstock.[ch] * themes/Default/images/Makefile.am * themes/Default/images/stock-color-triangle-16.png: added a (bad) icon for the triangle color selector. * modules/colorsel_triangle.c: use the new icon. * modules/colorsel_water.c: use the "Paintbrush" icon for now. * app/widgets/gimpcoloreditor.[ch]: new widget for editing the FG/BG color featuring a color notebook, stock buttons for selecting the pages and a GimpPickButton. * app/widgets/Makefile.am * app/widgets/widgets-types.h: changed accordingly. * app/gui/dialogs-constructors.[ch] * app/gui/dialogs.c: added a dockable wrapper for GimpColorEditor. * app/gui/menus.c: added it to the menus. Also added separate Layers, Channels and Paths entries. Bind <ctrl>L to the new callback so it doesn't always create a new layers dialog.
2002-11-05 08:02:56 +08:00
g_return_if_fail (GIMP_IS_COLOR_SELECTOR (selector));
priv = gimp_color_selector_get_instance_private (selector);
if (priv->toggles_visible != visible)
added virtual functions set_toggles_visible() and set_toggles_sensitive(). 2002-11-05 Michael Natterer <mitch@gimp.org> * libgimpwidgets/gimpcolorselector.[ch]: added virtual functions set_toggles_visible() and set_toggles_sensitive(). Added a stock_id. Emit "color_changed" and "channel_changed" on set_color() and set_channel() resp. * libgimpwidgets/gimpcolornotebook.[ch]: implement the new methods. Added gimp_color_notebook_set_has_page() to control which selectors a notebook contains. * libgimpwidgets/gimpcolorscales.[ch]: removed the toggle API and implement the new methods. * libgimpwidgets/gimpcolorselect.c: added toggle buttons for the channels so the widget doesn't need external ones. * app/gui/color-notebook.c: changed accordingly. * libgimpwidgets/gimpstock.[ch] * themes/Default/images/Makefile.am * themes/Default/images/stock-color-triangle-16.png: added a (bad) icon for the triangle color selector. * modules/colorsel_triangle.c: use the new icon. * modules/colorsel_water.c: use the "Paintbrush" icon for now. * app/widgets/gimpcoloreditor.[ch]: new widget for editing the FG/BG color featuring a color notebook, stock buttons for selecting the pages and a GimpPickButton. * app/widgets/Makefile.am * app/widgets/widgets-types.h: changed accordingly. * app/gui/dialogs-constructors.[ch] * app/gui/dialogs.c: added a dockable wrapper for GimpColorEditor. * app/gui/menus.c: added it to the menus. Also added separate Layers, Channels and Paths entries. Bind <ctrl>L to the new callback so it doesn't always create a new layers dialog.
2002-11-05 08:02:56 +08:00
{
GimpColorSelectorClass *selector_class;
priv->toggles_visible = visible ? TRUE : FALSE;
added virtual functions set_toggles_visible() and set_toggles_sensitive(). 2002-11-05 Michael Natterer <mitch@gimp.org> * libgimpwidgets/gimpcolorselector.[ch]: added virtual functions set_toggles_visible() and set_toggles_sensitive(). Added a stock_id. Emit "color_changed" and "channel_changed" on set_color() and set_channel() resp. * libgimpwidgets/gimpcolornotebook.[ch]: implement the new methods. Added gimp_color_notebook_set_has_page() to control which selectors a notebook contains. * libgimpwidgets/gimpcolorscales.[ch]: removed the toggle API and implement the new methods. * libgimpwidgets/gimpcolorselect.c: added toggle buttons for the channels so the widget doesn't need external ones. * app/gui/color-notebook.c: changed accordingly. * libgimpwidgets/gimpstock.[ch] * themes/Default/images/Makefile.am * themes/Default/images/stock-color-triangle-16.png: added a (bad) icon for the triangle color selector. * modules/colorsel_triangle.c: use the new icon. * modules/colorsel_water.c: use the "Paintbrush" icon for now. * app/widgets/gimpcoloreditor.[ch]: new widget for editing the FG/BG color featuring a color notebook, stock buttons for selecting the pages and a GimpPickButton. * app/widgets/Makefile.am * app/widgets/widgets-types.h: changed accordingly. * app/gui/dialogs-constructors.[ch] * app/gui/dialogs.c: added a dockable wrapper for GimpColorEditor. * app/gui/menus.c: added it to the menus. Also added separate Layers, Channels and Paths entries. Bind <ctrl>L to the new callback so it doesn't always create a new layers dialog.
2002-11-05 08:02:56 +08:00
selector_class = GIMP_COLOR_SELECTOR_GET_CLASS (selector);
if (selector_class->set_toggles_visible)
selector_class->set_toggles_visible (selector, visible);
}
}
/**
* gimp_color_selector_get_toggles_visible:
* @selector: A #GimpColorSelector widget.
*
* Returns the @visible property of the @selector's toggles.
*
* Returns: %TRUE if the #GimpColorSelector's toggles are visible.
*
* Since: 2.10
**/
gboolean
gimp_color_selector_get_toggles_visible (GimpColorSelector *selector)
{
GimpColorSelectorPrivate *priv;
g_return_val_if_fail (GIMP_IS_COLOR_SELECTOR (selector), FALSE);
priv = gimp_color_selector_get_instance_private (selector);
return priv->toggles_visible;
}
/**
* gimp_color_selector_set_toggles_sensitive:
* @selector: A #GimpColorSelector widget.
* @sensitive: The new @sensitive setting.
*
* Sets the @sensitive property of the @selector's toggles.
*
* This function has no effect if this @selector instance has no
* toggles to switch channels.
**/
added virtual functions set_toggles_visible() and set_toggles_sensitive(). 2002-11-05 Michael Natterer <mitch@gimp.org> * libgimpwidgets/gimpcolorselector.[ch]: added virtual functions set_toggles_visible() and set_toggles_sensitive(). Added a stock_id. Emit "color_changed" and "channel_changed" on set_color() and set_channel() resp. * libgimpwidgets/gimpcolornotebook.[ch]: implement the new methods. Added gimp_color_notebook_set_has_page() to control which selectors a notebook contains. * libgimpwidgets/gimpcolorscales.[ch]: removed the toggle API and implement the new methods. * libgimpwidgets/gimpcolorselect.c: added toggle buttons for the channels so the widget doesn't need external ones. * app/gui/color-notebook.c: changed accordingly. * libgimpwidgets/gimpstock.[ch] * themes/Default/images/Makefile.am * themes/Default/images/stock-color-triangle-16.png: added a (bad) icon for the triangle color selector. * modules/colorsel_triangle.c: use the new icon. * modules/colorsel_water.c: use the "Paintbrush" icon for now. * app/widgets/gimpcoloreditor.[ch]: new widget for editing the FG/BG color featuring a color notebook, stock buttons for selecting the pages and a GimpPickButton. * app/widgets/Makefile.am * app/widgets/widgets-types.h: changed accordingly. * app/gui/dialogs-constructors.[ch] * app/gui/dialogs.c: added a dockable wrapper for GimpColorEditor. * app/gui/menus.c: added it to the menus. Also added separate Layers, Channels and Paths entries. Bind <ctrl>L to the new callback so it doesn't always create a new layers dialog.
2002-11-05 08:02:56 +08:00
void
gimp_color_selector_set_toggles_sensitive (GimpColorSelector *selector,
gboolean sensitive)
{
GimpColorSelectorPrivate *priv;
added virtual functions set_toggles_visible() and set_toggles_sensitive(). 2002-11-05 Michael Natterer <mitch@gimp.org> * libgimpwidgets/gimpcolorselector.[ch]: added virtual functions set_toggles_visible() and set_toggles_sensitive(). Added a stock_id. Emit "color_changed" and "channel_changed" on set_color() and set_channel() resp. * libgimpwidgets/gimpcolornotebook.[ch]: implement the new methods. Added gimp_color_notebook_set_has_page() to control which selectors a notebook contains. * libgimpwidgets/gimpcolorscales.[ch]: removed the toggle API and implement the new methods. * libgimpwidgets/gimpcolorselect.c: added toggle buttons for the channels so the widget doesn't need external ones. * app/gui/color-notebook.c: changed accordingly. * libgimpwidgets/gimpstock.[ch] * themes/Default/images/Makefile.am * themes/Default/images/stock-color-triangle-16.png: added a (bad) icon for the triangle color selector. * modules/colorsel_triangle.c: use the new icon. * modules/colorsel_water.c: use the "Paintbrush" icon for now. * app/widgets/gimpcoloreditor.[ch]: new widget for editing the FG/BG color featuring a color notebook, stock buttons for selecting the pages and a GimpPickButton. * app/widgets/Makefile.am * app/widgets/widgets-types.h: changed accordingly. * app/gui/dialogs-constructors.[ch] * app/gui/dialogs.c: added a dockable wrapper for GimpColorEditor. * app/gui/menus.c: added it to the menus. Also added separate Layers, Channels and Paths entries. Bind <ctrl>L to the new callback so it doesn't always create a new layers dialog.
2002-11-05 08:02:56 +08:00
g_return_if_fail (GIMP_IS_COLOR_SELECTOR (selector));
priv = gimp_color_selector_get_instance_private (selector);
if (priv->toggles_sensitive != sensitive)
added virtual functions set_toggles_visible() and set_toggles_sensitive(). 2002-11-05 Michael Natterer <mitch@gimp.org> * libgimpwidgets/gimpcolorselector.[ch]: added virtual functions set_toggles_visible() and set_toggles_sensitive(). Added a stock_id. Emit "color_changed" and "channel_changed" on set_color() and set_channel() resp. * libgimpwidgets/gimpcolornotebook.[ch]: implement the new methods. Added gimp_color_notebook_set_has_page() to control which selectors a notebook contains. * libgimpwidgets/gimpcolorscales.[ch]: removed the toggle API and implement the new methods. * libgimpwidgets/gimpcolorselect.c: added toggle buttons for the channels so the widget doesn't need external ones. * app/gui/color-notebook.c: changed accordingly. * libgimpwidgets/gimpstock.[ch] * themes/Default/images/Makefile.am * themes/Default/images/stock-color-triangle-16.png: added a (bad) icon for the triangle color selector. * modules/colorsel_triangle.c: use the new icon. * modules/colorsel_water.c: use the "Paintbrush" icon for now. * app/widgets/gimpcoloreditor.[ch]: new widget for editing the FG/BG color featuring a color notebook, stock buttons for selecting the pages and a GimpPickButton. * app/widgets/Makefile.am * app/widgets/widgets-types.h: changed accordingly. * app/gui/dialogs-constructors.[ch] * app/gui/dialogs.c: added a dockable wrapper for GimpColorEditor. * app/gui/menus.c: added it to the menus. Also added separate Layers, Channels and Paths entries. Bind <ctrl>L to the new callback so it doesn't always create a new layers dialog.
2002-11-05 08:02:56 +08:00
{
GimpColorSelectorClass *selector_class;
priv->toggles_sensitive = sensitive ? TRUE : FALSE;
added virtual functions set_toggles_visible() and set_toggles_sensitive(). 2002-11-05 Michael Natterer <mitch@gimp.org> * libgimpwidgets/gimpcolorselector.[ch]: added virtual functions set_toggles_visible() and set_toggles_sensitive(). Added a stock_id. Emit "color_changed" and "channel_changed" on set_color() and set_channel() resp. * libgimpwidgets/gimpcolornotebook.[ch]: implement the new methods. Added gimp_color_notebook_set_has_page() to control which selectors a notebook contains. * libgimpwidgets/gimpcolorscales.[ch]: removed the toggle API and implement the new methods. * libgimpwidgets/gimpcolorselect.c: added toggle buttons for the channels so the widget doesn't need external ones. * app/gui/color-notebook.c: changed accordingly. * libgimpwidgets/gimpstock.[ch] * themes/Default/images/Makefile.am * themes/Default/images/stock-color-triangle-16.png: added a (bad) icon for the triangle color selector. * modules/colorsel_triangle.c: use the new icon. * modules/colorsel_water.c: use the "Paintbrush" icon for now. * app/widgets/gimpcoloreditor.[ch]: new widget for editing the FG/BG color featuring a color notebook, stock buttons for selecting the pages and a GimpPickButton. * app/widgets/Makefile.am * app/widgets/widgets-types.h: changed accordingly. * app/gui/dialogs-constructors.[ch] * app/gui/dialogs.c: added a dockable wrapper for GimpColorEditor. * app/gui/menus.c: added it to the menus. Also added separate Layers, Channels and Paths entries. Bind <ctrl>L to the new callback so it doesn't always create a new layers dialog.
2002-11-05 08:02:56 +08:00
selector_class = GIMP_COLOR_SELECTOR_GET_CLASS (selector);
if (selector_class->set_toggles_sensitive)
selector_class->set_toggles_sensitive (selector, sensitive);
}
}
/**
* gimp_color_selector_get_toggles_sensitive:
* @selector: A #GimpColorSelector widget.
*
* Returns the @sensitive property of the @selector's toggles.
*
* Returns: %TRUE if the #GimpColorSelector's toggles are sensitive.
*
* Since: 2.10
**/
gboolean
gimp_color_selector_get_toggles_sensitive (GimpColorSelector *selector)
{
GimpColorSelectorPrivate *priv;
g_return_val_if_fail (GIMP_IS_COLOR_SELECTOR (selector), FALSE);
priv = gimp_color_selector_get_instance_private (selector);
return priv->toggles_sensitive;
}
/**
* gimp_color_selector_set_show_alpha:
* @selector: A #GimpColorSelector widget.
* @show_alpha: The new @show_alpha setting.
*
* Sets the @show_alpha property of the @selector widget.
**/
void
gimp_color_selector_set_show_alpha (GimpColorSelector *selector,
gboolean show_alpha)
{
GimpColorSelectorPrivate *priv;
g_return_if_fail (GIMP_IS_COLOR_SELECTOR (selector));
priv = gimp_color_selector_get_instance_private (selector);
if (show_alpha != priv->show_alpha)
{
added virtual functions set_toggles_visible() and set_toggles_sensitive(). 2002-11-05 Michael Natterer <mitch@gimp.org> * libgimpwidgets/gimpcolorselector.[ch]: added virtual functions set_toggles_visible() and set_toggles_sensitive(). Added a stock_id. Emit "color_changed" and "channel_changed" on set_color() and set_channel() resp. * libgimpwidgets/gimpcolornotebook.[ch]: implement the new methods. Added gimp_color_notebook_set_has_page() to control which selectors a notebook contains. * libgimpwidgets/gimpcolorscales.[ch]: removed the toggle API and implement the new methods. * libgimpwidgets/gimpcolorselect.c: added toggle buttons for the channels so the widget doesn't need external ones. * app/gui/color-notebook.c: changed accordingly. * libgimpwidgets/gimpstock.[ch] * themes/Default/images/Makefile.am * themes/Default/images/stock-color-triangle-16.png: added a (bad) icon for the triangle color selector. * modules/colorsel_triangle.c: use the new icon. * modules/colorsel_water.c: use the "Paintbrush" icon for now. * app/widgets/gimpcoloreditor.[ch]: new widget for editing the FG/BG color featuring a color notebook, stock buttons for selecting the pages and a GimpPickButton. * app/widgets/Makefile.am * app/widgets/widgets-types.h: changed accordingly. * app/gui/dialogs-constructors.[ch] * app/gui/dialogs.c: added a dockable wrapper for GimpColorEditor. * app/gui/menus.c: added it to the menus. Also added separate Layers, Channels and Paths entries. Bind <ctrl>L to the new callback so it doesn't always create a new layers dialog.
2002-11-05 08:02:56 +08:00
GimpColorSelectorClass *selector_class;
priv->show_alpha = show_alpha ? TRUE : FALSE;
added virtual functions set_toggles_visible() and set_toggles_sensitive(). 2002-11-05 Michael Natterer <mitch@gimp.org> * libgimpwidgets/gimpcolorselector.[ch]: added virtual functions set_toggles_visible() and set_toggles_sensitive(). Added a stock_id. Emit "color_changed" and "channel_changed" on set_color() and set_channel() resp. * libgimpwidgets/gimpcolornotebook.[ch]: implement the new methods. Added gimp_color_notebook_set_has_page() to control which selectors a notebook contains. * libgimpwidgets/gimpcolorscales.[ch]: removed the toggle API and implement the new methods. * libgimpwidgets/gimpcolorselect.c: added toggle buttons for the channels so the widget doesn't need external ones. * app/gui/color-notebook.c: changed accordingly. * libgimpwidgets/gimpstock.[ch] * themes/Default/images/Makefile.am * themes/Default/images/stock-color-triangle-16.png: added a (bad) icon for the triangle color selector. * modules/colorsel_triangle.c: use the new icon. * modules/colorsel_water.c: use the "Paintbrush" icon for now. * app/widgets/gimpcoloreditor.[ch]: new widget for editing the FG/BG color featuring a color notebook, stock buttons for selecting the pages and a GimpPickButton. * app/widgets/Makefile.am * app/widgets/widgets-types.h: changed accordingly. * app/gui/dialogs-constructors.[ch] * app/gui/dialogs.c: added a dockable wrapper for GimpColorEditor. * app/gui/menus.c: added it to the menus. Also added separate Layers, Channels and Paths entries. Bind <ctrl>L to the new callback so it doesn't always create a new layers dialog.
2002-11-05 08:02:56 +08:00
selector_class = GIMP_COLOR_SELECTOR_GET_CLASS (selector);
if (selector_class->set_show_alpha)
selector_class->set_show_alpha (selector, show_alpha);
}
}
/**
* gimp_color_selector_get_show_alpha:
* @selector: A #GimpColorSelector widget.
*
* Returns the @selector's @show_alpha property.
*
* Returns: %TRUE if the #GimpColorSelector has alpha controls.
*
* Since: 2.10
**/
gboolean
gimp_color_selector_get_show_alpha (GimpColorSelector *selector)
{
GimpColorSelectorPrivate *priv;
g_return_val_if_fail (GIMP_IS_COLOR_SELECTOR (selector), FALSE);
priv = gimp_color_selector_get_instance_private (selector);
return priv->show_alpha;
}
/**
* gimp_color_selector_set_color:
* @selector: A #GimpColorSelector widget.
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 16:01:17 +08:00
* @color: The new color.
*
* Sets the color shown in the @selector widget.
*
* Unlike most setters, this does NOT change the model (or update views)
* when the change is not perceivable to the eye.
*
* A control cannot depend on this actually changing the model.
* A control, e.g. a chroma slider, may show a small difference from the model.
*/
Ported module loading to GTypeModule, getting rid of all own module 2002-10-20 Michael Natterer <mitch@gimp.org> Ported module loading to GTypeModule, getting rid of all own module registering/bookkeeping stuff for color selectors and display filters. The modules now simply register GimpColorSelector and GimpColorDisplay subclasses, the list of registered subclasses can then be obtained calling g_type_children() on the abstract base classes. This is work in progress and just the first working state after I started breaking everything... * app/gui/color-select.[ch] * libgimp/gimpcolordisplay.h * libgimp/gimpcolorselector.h: removed. * app/gui/Makefile.am * libgimp/Makefile.am: changed accordingly. * libgimp/gimpmodule.h: massively simplified. All voodoo is gone. * libgimpwidgets/gimpcolordisplay.[ch] * libgimpwidgets/gimpcolorselector.[ch]: new abstract base classes which need to be subclassed by modules. * libgimpwidgets/gimpcolorselect.[ch]: the built-in color selector from app/gui/color-select.* ported to be a GimpColorSelector subclass. * libgimpwidgets/Makefile.am * libgimpwidgets/gimpwidgets.h * libgimpwidgets/gimpwidgetsmarshal.list * libgimpwidgets/gimpwidgetstypes.h: changed accordingly. * app/core/gimpmoduleinfo.[ch]: made it a GTypeModule subclass * app/core/gimpmodules.c: changed accordingly. * app/core/gimpcontainer.c * app/core/gimplist.c: HACKED around to allow GimpLists of GObjects (not GimpObjects). This is EEKy, so I will either make gimp->modules a simple GList and revert this bit of change, or allow GObjects all over the place in GimpContainer land... * app/display/gimpdisplayshell-filter.[ch] * app/gui/color-notebook.c: removed all module stuff and use g_type_children() to get the list of available color_selectors and display_filters. * app/display/gimpdisplayshell-filter-dialog.c * app/display/gimpdisplayshell-render.c * app/gui/module-browser.c: changed accordingly. * app/gui/gui.c: ref the built-in color selector's class before the modules are queried so it appears first in the list of GimpColorSelector's children. * modules/Makefile.am: build the water color selector again. * modules/cdisplay_gamma.c * modules/cdisplay_highcontrast.c * modules/colorsel_triangle.c * modules/colorsel_water.c: ported them all to the new API. * modules/gimpmodregister.[ch]: removed the old EMX module hack.
2002-10-20 18:14:17 +08:00
void
gimp_color_selector_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 16:01:17 +08:00
GeglColor *color)
Ported module loading to GTypeModule, getting rid of all own module 2002-10-20 Michael Natterer <mitch@gimp.org> Ported module loading to GTypeModule, getting rid of all own module registering/bookkeeping stuff for color selectors and display filters. The modules now simply register GimpColorSelector and GimpColorDisplay subclasses, the list of registered subclasses can then be obtained calling g_type_children() on the abstract base classes. This is work in progress and just the first working state after I started breaking everything... * app/gui/color-select.[ch] * libgimp/gimpcolordisplay.h * libgimp/gimpcolorselector.h: removed. * app/gui/Makefile.am * libgimp/Makefile.am: changed accordingly. * libgimp/gimpmodule.h: massively simplified. All voodoo is gone. * libgimpwidgets/gimpcolordisplay.[ch] * libgimpwidgets/gimpcolorselector.[ch]: new abstract base classes which need to be subclassed by modules. * libgimpwidgets/gimpcolorselect.[ch]: the built-in color selector from app/gui/color-select.* ported to be a GimpColorSelector subclass. * libgimpwidgets/Makefile.am * libgimpwidgets/gimpwidgets.h * libgimpwidgets/gimpwidgetsmarshal.list * libgimpwidgets/gimpwidgetstypes.h: changed accordingly. * app/core/gimpmoduleinfo.[ch]: made it a GTypeModule subclass * app/core/gimpmodules.c: changed accordingly. * app/core/gimpcontainer.c * app/core/gimplist.c: HACKED around to allow GimpLists of GObjects (not GimpObjects). This is EEKy, so I will either make gimp->modules a simple GList and revert this bit of change, or allow GObjects all over the place in GimpContainer land... * app/display/gimpdisplayshell-filter.[ch] * app/gui/color-notebook.c: removed all module stuff and use g_type_children() to get the list of available color_selectors and display_filters. * app/display/gimpdisplayshell-filter-dialog.c * app/display/gimpdisplayshell-render.c * app/gui/module-browser.c: changed accordingly. * app/gui/gui.c: ref the built-in color selector's class before the modules are queried so it appears first in the list of GimpColorSelector's children. * modules/Makefile.am: build the water color selector again. * modules/cdisplay_gamma.c * modules/cdisplay_highcontrast.c * modules/colorsel_triangle.c * modules/colorsel_water.c: ported them all to the new API. * modules/gimpmodregister.[ch]: removed the old EMX module hack.
2002-10-20 18:14:17 +08: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 16:01:17 +08:00
GimpColorSelectorClass *selector_class;
GimpColorSelectorPrivate *priv;
added virtual functions set_toggles_visible() and set_toggles_sensitive(). 2002-11-05 Michael Natterer <mitch@gimp.org> * libgimpwidgets/gimpcolorselector.[ch]: added virtual functions set_toggles_visible() and set_toggles_sensitive(). Added a stock_id. Emit "color_changed" and "channel_changed" on set_color() and set_channel() resp. * libgimpwidgets/gimpcolornotebook.[ch]: implement the new methods. Added gimp_color_notebook_set_has_page() to control which selectors a notebook contains. * libgimpwidgets/gimpcolorscales.[ch]: removed the toggle API and implement the new methods. * libgimpwidgets/gimpcolorselect.c: added toggle buttons for the channels so the widget doesn't need external ones. * app/gui/color-notebook.c: changed accordingly. * libgimpwidgets/gimpstock.[ch] * themes/Default/images/Makefile.am * themes/Default/images/stock-color-triangle-16.png: added a (bad) icon for the triangle color selector. * modules/colorsel_triangle.c: use the new icon. * modules/colorsel_water.c: use the "Paintbrush" icon for now. * app/widgets/gimpcoloreditor.[ch]: new widget for editing the FG/BG color featuring a color notebook, stock buttons for selecting the pages and a GimpPickButton. * app/widgets/Makefile.am * app/widgets/widgets-types.h: changed accordingly. * app/gui/dialogs-constructors.[ch] * app/gui/dialogs.c: added a dockable wrapper for GimpColorEditor. * app/gui/menus.c: added it to the menus. Also added separate Layers, Channels and Paths entries. Bind <ctrl>L to the new callback so it doesn't always create a new layers dialog.
2002-11-05 08:02:56 +08:00
Ported module loading to GTypeModule, getting rid of all own module 2002-10-20 Michael Natterer <mitch@gimp.org> Ported module loading to GTypeModule, getting rid of all own module registering/bookkeeping stuff for color selectors and display filters. The modules now simply register GimpColorSelector and GimpColorDisplay subclasses, the list of registered subclasses can then be obtained calling g_type_children() on the abstract base classes. This is work in progress and just the first working state after I started breaking everything... * app/gui/color-select.[ch] * libgimp/gimpcolordisplay.h * libgimp/gimpcolorselector.h: removed. * app/gui/Makefile.am * libgimp/Makefile.am: changed accordingly. * libgimp/gimpmodule.h: massively simplified. All voodoo is gone. * libgimpwidgets/gimpcolordisplay.[ch] * libgimpwidgets/gimpcolorselector.[ch]: new abstract base classes which need to be subclassed by modules. * libgimpwidgets/gimpcolorselect.[ch]: the built-in color selector from app/gui/color-select.* ported to be a GimpColorSelector subclass. * libgimpwidgets/Makefile.am * libgimpwidgets/gimpwidgets.h * libgimpwidgets/gimpwidgetsmarshal.list * libgimpwidgets/gimpwidgetstypes.h: changed accordingly. * app/core/gimpmoduleinfo.[ch]: made it a GTypeModule subclass * app/core/gimpmodules.c: changed accordingly. * app/core/gimpcontainer.c * app/core/gimplist.c: HACKED around to allow GimpLists of GObjects (not GimpObjects). This is EEKy, so I will either make gimp->modules a simple GList and revert this bit of change, or allow GObjects all over the place in GimpContainer land... * app/display/gimpdisplayshell-filter.[ch] * app/gui/color-notebook.c: removed all module stuff and use g_type_children() to get the list of available color_selectors and display_filters. * app/display/gimpdisplayshell-filter-dialog.c * app/display/gimpdisplayshell-render.c * app/gui/module-browser.c: changed accordingly. * app/gui/gui.c: ref the built-in color selector's class before the modules are queried so it appears first in the list of GimpColorSelector's children. * modules/Makefile.am: build the water color selector again. * modules/cdisplay_gamma.c * modules/cdisplay_highcontrast.c * modules/colorsel_triangle.c * modules/colorsel_water.c: ported them all to the new API. * modules/gimpmodregister.[ch]: removed the old EMX module hack.
2002-10-20 18:14:17 +08:00
g_return_if_fail (GIMP_IS_COLOR_SELECTOR (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 16:01:17 +08:00
g_return_if_fail (GEGL_IS_COLOR (color));
priv = gimp_color_selector_get_instance_private (selector);
Ported module loading to GTypeModule, getting rid of all own module 2002-10-20 Michael Natterer <mitch@gimp.org> Ported module loading to GTypeModule, getting rid of all own module registering/bookkeeping stuff for color selectors and display filters. The modules now simply register GimpColorSelector and GimpColorDisplay subclasses, the list of registered subclasses can then be obtained calling g_type_children() on the abstract base classes. This is work in progress and just the first working state after I started breaking everything... * app/gui/color-select.[ch] * libgimp/gimpcolordisplay.h * libgimp/gimpcolorselector.h: removed. * app/gui/Makefile.am * libgimp/Makefile.am: changed accordingly. * libgimp/gimpmodule.h: massively simplified. All voodoo is gone. * libgimpwidgets/gimpcolordisplay.[ch] * libgimpwidgets/gimpcolorselector.[ch]: new abstract base classes which need to be subclassed by modules. * libgimpwidgets/gimpcolorselect.[ch]: the built-in color selector from app/gui/color-select.* ported to be a GimpColorSelector subclass. * libgimpwidgets/Makefile.am * libgimpwidgets/gimpwidgets.h * libgimpwidgets/gimpwidgetsmarshal.list * libgimpwidgets/gimpwidgetstypes.h: changed accordingly. * app/core/gimpmoduleinfo.[ch]: made it a GTypeModule subclass * app/core/gimpmodules.c: changed accordingly. * app/core/gimpcontainer.c * app/core/gimplist.c: HACKED around to allow GimpLists of GObjects (not GimpObjects). This is EEKy, so I will either make gimp->modules a simple GList and revert this bit of change, or allow GObjects all over the place in GimpContainer land... * app/display/gimpdisplayshell-filter.[ch] * app/gui/color-notebook.c: removed all module stuff and use g_type_children() to get the list of available color_selectors and display_filters. * app/display/gimpdisplayshell-filter-dialog.c * app/display/gimpdisplayshell-render.c * app/gui/module-browser.c: changed accordingly. * app/gui/gui.c: ref the built-in color selector's class before the modules are queried so it appears first in the list of GimpColorSelector's children. * modules/Makefile.am: build the water color selector again. * modules/cdisplay_gamma.c * modules/cdisplay_highcontrast.c * modules/colorsel_triangle.c * modules/colorsel_water.c: ported them all to the new API. * modules/gimpmodregister.[ch]: removed the old EMX module hack.
2002-10-20 18:14:17 +08:00
if (! gimp_color_is_perceptually_identical (priv->color, color))
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 16:01:17 +08:00
{
g_object_unref (priv->color);
priv->color = gegl_color_duplicate (color);
selector_class = GIMP_COLOR_SELECTOR_GET_CLASS (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 16:01:17 +08:00
if (selector_class->set_color)
selector_class->set_color (selector, priv->color);
gimp_color_selector_emit_color_changed (selector);
}
else
{
/* This happens often, more than you might expect.
* A single user event may yield many calls to the setter,
* some but not all of which are perceptually identical.
*/
g_debug ("%s new color perceptually identical", G_STRFUNC);
}
Ported module loading to GTypeModule, getting rid of all own module 2002-10-20 Michael Natterer <mitch@gimp.org> Ported module loading to GTypeModule, getting rid of all own module registering/bookkeeping stuff for color selectors and display filters. The modules now simply register GimpColorSelector and GimpColorDisplay subclasses, the list of registered subclasses can then be obtained calling g_type_children() on the abstract base classes. This is work in progress and just the first working state after I started breaking everything... * app/gui/color-select.[ch] * libgimp/gimpcolordisplay.h * libgimp/gimpcolorselector.h: removed. * app/gui/Makefile.am * libgimp/Makefile.am: changed accordingly. * libgimp/gimpmodule.h: massively simplified. All voodoo is gone. * libgimpwidgets/gimpcolordisplay.[ch] * libgimpwidgets/gimpcolorselector.[ch]: new abstract base classes which need to be subclassed by modules. * libgimpwidgets/gimpcolorselect.[ch]: the built-in color selector from app/gui/color-select.* ported to be a GimpColorSelector subclass. * libgimpwidgets/Makefile.am * libgimpwidgets/gimpwidgets.h * libgimpwidgets/gimpwidgetsmarshal.list * libgimpwidgets/gimpwidgetstypes.h: changed accordingly. * app/core/gimpmoduleinfo.[ch]: made it a GTypeModule subclass * app/core/gimpmodules.c: changed accordingly. * app/core/gimpcontainer.c * app/core/gimplist.c: HACKED around to allow GimpLists of GObjects (not GimpObjects). This is EEKy, so I will either make gimp->modules a simple GList and revert this bit of change, or allow GObjects all over the place in GimpContainer land... * app/display/gimpdisplayshell-filter.[ch] * app/gui/color-notebook.c: removed all module stuff and use g_type_children() to get the list of available color_selectors and display_filters. * app/display/gimpdisplayshell-filter-dialog.c * app/display/gimpdisplayshell-render.c * app/gui/module-browser.c: changed accordingly. * app/gui/gui.c: ref the built-in color selector's class before the modules are queried so it appears first in the list of GimpColorSelector's children. * modules/Makefile.am: build the water color selector again. * modules/cdisplay_gamma.c * modules/cdisplay_highcontrast.c * modules/colorsel_triangle.c * modules/colorsel_water.c: ported them all to the new API. * modules/gimpmodregister.[ch]: removed the old EMX module hack.
2002-10-20 18:14:17 +08:00
}
/**
* gimp_color_selector_get_color:
* @selector: A #GimpColorSelector widget.
*
* Retrieves the color shown in the @selector widget.
*
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 16:01:17 +08:00
* Returns: (transfer full): a copy of the selected color.
* Since: 2.10
**/
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 16:01:17 +08:00
GeglColor *
gimp_color_selector_get_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 16:01:17 +08:00
GimpColorSelectorPrivate *priv;
g_return_val_if_fail (GIMP_IS_COLOR_SELECTOR (selector), NULL);
priv = gimp_color_selector_get_instance_private (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 16:01:17 +08:00
return gegl_color_duplicate (priv->color);
}
/**
* gimp_color_selector_set_channel:
* @selector: A #GimpColorSelector widget.
* @channel: The new @channel setting.
*
* Sets the @channel property of the @selector widget.
*
* Changes between displayed channels if this @selector instance has
* the ability to show different channels.
* This will also update the color model if needed.
**/
Ported module loading to GTypeModule, getting rid of all own module 2002-10-20 Michael Natterer <mitch@gimp.org> Ported module loading to GTypeModule, getting rid of all own module registering/bookkeeping stuff for color selectors and display filters. The modules now simply register GimpColorSelector and GimpColorDisplay subclasses, the list of registered subclasses can then be obtained calling g_type_children() on the abstract base classes. This is work in progress and just the first working state after I started breaking everything... * app/gui/color-select.[ch] * libgimp/gimpcolordisplay.h * libgimp/gimpcolorselector.h: removed. * app/gui/Makefile.am * libgimp/Makefile.am: changed accordingly. * libgimp/gimpmodule.h: massively simplified. All voodoo is gone. * libgimpwidgets/gimpcolordisplay.[ch] * libgimpwidgets/gimpcolorselector.[ch]: new abstract base classes which need to be subclassed by modules. * libgimpwidgets/gimpcolorselect.[ch]: the built-in color selector from app/gui/color-select.* ported to be a GimpColorSelector subclass. * libgimpwidgets/Makefile.am * libgimpwidgets/gimpwidgets.h * libgimpwidgets/gimpwidgetsmarshal.list * libgimpwidgets/gimpwidgetstypes.h: changed accordingly. * app/core/gimpmoduleinfo.[ch]: made it a GTypeModule subclass * app/core/gimpmodules.c: changed accordingly. * app/core/gimpcontainer.c * app/core/gimplist.c: HACKED around to allow GimpLists of GObjects (not GimpObjects). This is EEKy, so I will either make gimp->modules a simple GList and revert this bit of change, or allow GObjects all over the place in GimpContainer land... * app/display/gimpdisplayshell-filter.[ch] * app/gui/color-notebook.c: removed all module stuff and use g_type_children() to get the list of available color_selectors and display_filters. * app/display/gimpdisplayshell-filter-dialog.c * app/display/gimpdisplayshell-render.c * app/gui/module-browser.c: changed accordingly. * app/gui/gui.c: ref the built-in color selector's class before the modules are queried so it appears first in the list of GimpColorSelector's children. * modules/Makefile.am: build the water color selector again. * modules/cdisplay_gamma.c * modules/cdisplay_highcontrast.c * modules/colorsel_triangle.c * modules/colorsel_water.c: ported them all to the new API. * modules/gimpmodregister.[ch]: removed the old EMX module hack.
2002-10-20 18:14:17 +08:00
void
gimp_color_selector_set_channel (GimpColorSelector *selector,
GimpColorSelectorChannel channel)
{
GimpColorSelectorPrivate *priv;
Ported module loading to GTypeModule, getting rid of all own module 2002-10-20 Michael Natterer <mitch@gimp.org> Ported module loading to GTypeModule, getting rid of all own module registering/bookkeeping stuff for color selectors and display filters. The modules now simply register GimpColorSelector and GimpColorDisplay subclasses, the list of registered subclasses can then be obtained calling g_type_children() on the abstract base classes. This is work in progress and just the first working state after I started breaking everything... * app/gui/color-select.[ch] * libgimp/gimpcolordisplay.h * libgimp/gimpcolorselector.h: removed. * app/gui/Makefile.am * libgimp/Makefile.am: changed accordingly. * libgimp/gimpmodule.h: massively simplified. All voodoo is gone. * libgimpwidgets/gimpcolordisplay.[ch] * libgimpwidgets/gimpcolorselector.[ch]: new abstract base classes which need to be subclassed by modules. * libgimpwidgets/gimpcolorselect.[ch]: the built-in color selector from app/gui/color-select.* ported to be a GimpColorSelector subclass. * libgimpwidgets/Makefile.am * libgimpwidgets/gimpwidgets.h * libgimpwidgets/gimpwidgetsmarshal.list * libgimpwidgets/gimpwidgetstypes.h: changed accordingly. * app/core/gimpmoduleinfo.[ch]: made it a GTypeModule subclass * app/core/gimpmodules.c: changed accordingly. * app/core/gimpcontainer.c * app/core/gimplist.c: HACKED around to allow GimpLists of GObjects (not GimpObjects). This is EEKy, so I will either make gimp->modules a simple GList and revert this bit of change, or allow GObjects all over the place in GimpContainer land... * app/display/gimpdisplayshell-filter.[ch] * app/gui/color-notebook.c: removed all module stuff and use g_type_children() to get the list of available color_selectors and display_filters. * app/display/gimpdisplayshell-filter-dialog.c * app/display/gimpdisplayshell-render.c * app/gui/module-browser.c: changed accordingly. * app/gui/gui.c: ref the built-in color selector's class before the modules are queried so it appears first in the list of GimpColorSelector's children. * modules/Makefile.am: build the water color selector again. * modules/cdisplay_gamma.c * modules/cdisplay_highcontrast.c * modules/colorsel_triangle.c * modules/colorsel_water.c: ported them all to the new API. * modules/gimpmodregister.[ch]: removed the old EMX module hack.
2002-10-20 18:14:17 +08:00
g_return_if_fail (GIMP_IS_COLOR_SELECTOR (selector));
priv = gimp_color_selector_get_instance_private (selector);
if (channel != priv->channel)
{
added virtual functions set_toggles_visible() and set_toggles_sensitive(). 2002-11-05 Michael Natterer <mitch@gimp.org> * libgimpwidgets/gimpcolorselector.[ch]: added virtual functions set_toggles_visible() and set_toggles_sensitive(). Added a stock_id. Emit "color_changed" and "channel_changed" on set_color() and set_channel() resp. * libgimpwidgets/gimpcolornotebook.[ch]: implement the new methods. Added gimp_color_notebook_set_has_page() to control which selectors a notebook contains. * libgimpwidgets/gimpcolorscales.[ch]: removed the toggle API and implement the new methods. * libgimpwidgets/gimpcolorselect.c: added toggle buttons for the channels so the widget doesn't need external ones. * app/gui/color-notebook.c: changed accordingly. * libgimpwidgets/gimpstock.[ch] * themes/Default/images/Makefile.am * themes/Default/images/stock-color-triangle-16.png: added a (bad) icon for the triangle color selector. * modules/colorsel_triangle.c: use the new icon. * modules/colorsel_water.c: use the "Paintbrush" icon for now. * app/widgets/gimpcoloreditor.[ch]: new widget for editing the FG/BG color featuring a color notebook, stock buttons for selecting the pages and a GimpPickButton. * app/widgets/Makefile.am * app/widgets/widgets-types.h: changed accordingly. * app/gui/dialogs-constructors.[ch] * app/gui/dialogs.c: added a dockable wrapper for GimpColorEditor. * app/gui/menus.c: added it to the menus. Also added separate Layers, Channels and Paths entries. Bind <ctrl>L to the new callback so it doesn't always create a new layers dialog.
2002-11-05 08:02:56 +08:00
GimpColorSelectorClass *selector_class;
GimpColorSelectorModel model = -1;
added virtual functions set_toggles_visible() and set_toggles_sensitive(). 2002-11-05 Michael Natterer <mitch@gimp.org> * libgimpwidgets/gimpcolorselector.[ch]: added virtual functions set_toggles_visible() and set_toggles_sensitive(). Added a stock_id. Emit "color_changed" and "channel_changed" on set_color() and set_channel() resp. * libgimpwidgets/gimpcolornotebook.[ch]: implement the new methods. Added gimp_color_notebook_set_has_page() to control which selectors a notebook contains. * libgimpwidgets/gimpcolorscales.[ch]: removed the toggle API and implement the new methods. * libgimpwidgets/gimpcolorselect.c: added toggle buttons for the channels so the widget doesn't need external ones. * app/gui/color-notebook.c: changed accordingly. * libgimpwidgets/gimpstock.[ch] * themes/Default/images/Makefile.am * themes/Default/images/stock-color-triangle-16.png: added a (bad) icon for the triangle color selector. * modules/colorsel_triangle.c: use the new icon. * modules/colorsel_water.c: use the "Paintbrush" icon for now. * app/widgets/gimpcoloreditor.[ch]: new widget for editing the FG/BG color featuring a color notebook, stock buttons for selecting the pages and a GimpPickButton. * app/widgets/Makefile.am * app/widgets/widgets-types.h: changed accordingly. * app/gui/dialogs-constructors.[ch] * app/gui/dialogs.c: added a dockable wrapper for GimpColorEditor. * app/gui/menus.c: added it to the menus. Also added separate Layers, Channels and Paths entries. Bind <ctrl>L to the new callback so it doesn't always create a new layers dialog.
2002-11-05 08:02:56 +08:00
priv->channel = channel;
added virtual functions set_toggles_visible() and set_toggles_sensitive(). 2002-11-05 Michael Natterer <mitch@gimp.org> * libgimpwidgets/gimpcolorselector.[ch]: added virtual functions set_toggles_visible() and set_toggles_sensitive(). Added a stock_id. Emit "color_changed" and "channel_changed" on set_color() and set_channel() resp. * libgimpwidgets/gimpcolornotebook.[ch]: implement the new methods. Added gimp_color_notebook_set_has_page() to control which selectors a notebook contains. * libgimpwidgets/gimpcolorscales.[ch]: removed the toggle API and implement the new methods. * libgimpwidgets/gimpcolorselect.c: added toggle buttons for the channels so the widget doesn't need external ones. * app/gui/color-notebook.c: changed accordingly. * libgimpwidgets/gimpstock.[ch] * themes/Default/images/Makefile.am * themes/Default/images/stock-color-triangle-16.png: added a (bad) icon for the triangle color selector. * modules/colorsel_triangle.c: use the new icon. * modules/colorsel_water.c: use the "Paintbrush" icon for now. * app/widgets/gimpcoloreditor.[ch]: new widget for editing the FG/BG color featuring a color notebook, stock buttons for selecting the pages and a GimpPickButton. * app/widgets/Makefile.am * app/widgets/widgets-types.h: changed accordingly. * app/gui/dialogs-constructors.[ch] * app/gui/dialogs.c: added a dockable wrapper for GimpColorEditor. * app/gui/menus.c: added it to the menus. Also added separate Layers, Channels and Paths entries. Bind <ctrl>L to the new callback so it doesn't always create a new layers dialog.
2002-11-05 08:02:56 +08:00
switch (channel)
{
case GIMP_COLOR_SELECTOR_RED:
case GIMP_COLOR_SELECTOR_GREEN:
case GIMP_COLOR_SELECTOR_BLUE:
model = GIMP_COLOR_SELECTOR_MODEL_RGB;
break;
case GIMP_COLOR_SELECTOR_HUE:
case GIMP_COLOR_SELECTOR_SATURATION:
case GIMP_COLOR_SELECTOR_VALUE:
model = GIMP_COLOR_SELECTOR_MODEL_HSV;
break;
case GIMP_COLOR_SELECTOR_LCH_LIGHTNESS:
case GIMP_COLOR_SELECTOR_LCH_CHROMA:
case GIMP_COLOR_SELECTOR_LCH_HUE:
model = GIMP_COLOR_SELECTOR_MODEL_LCH;
break;
case GIMP_COLOR_SELECTOR_ALPHA:
/* Alpha channel does not change the color model. */
break;
default:
/* Should not happen. */
g_return_if_reached ();
break;
}
selector_class = GIMP_COLOR_SELECTOR_GET_CLASS (selector);
added virtual functions set_toggles_visible() and set_toggles_sensitive(). 2002-11-05 Michael Natterer <mitch@gimp.org> * libgimpwidgets/gimpcolorselector.[ch]: added virtual functions set_toggles_visible() and set_toggles_sensitive(). Added a stock_id. Emit "color_changed" and "channel_changed" on set_color() and set_channel() resp. * libgimpwidgets/gimpcolornotebook.[ch]: implement the new methods. Added gimp_color_notebook_set_has_page() to control which selectors a notebook contains. * libgimpwidgets/gimpcolorscales.[ch]: removed the toggle API and implement the new methods. * libgimpwidgets/gimpcolorselect.c: added toggle buttons for the channels so the widget doesn't need external ones. * app/gui/color-notebook.c: changed accordingly. * libgimpwidgets/gimpstock.[ch] * themes/Default/images/Makefile.am * themes/Default/images/stock-color-triangle-16.png: added a (bad) icon for the triangle color selector. * modules/colorsel_triangle.c: use the new icon. * modules/colorsel_water.c: use the "Paintbrush" icon for now. * app/widgets/gimpcoloreditor.[ch]: new widget for editing the FG/BG color featuring a color notebook, stock buttons for selecting the pages and a GimpPickButton. * app/widgets/Makefile.am * app/widgets/widgets-types.h: changed accordingly. * app/gui/dialogs-constructors.[ch] * app/gui/dialogs.c: added a dockable wrapper for GimpColorEditor. * app/gui/menus.c: added it to the menus. Also added separate Layers, Channels and Paths entries. Bind <ctrl>L to the new callback so it doesn't always create a new layers dialog.
2002-11-05 08:02:56 +08:00
if (selector_class->set_channel)
selector_class->set_channel (selector, channel);
gimp_color_selector_emit_channel_changed (selector);
if (model != -1)
{
/* make visibility of LCH and HSV mutuallky exclusive */
if (model == GIMP_COLOR_SELECTOR_MODEL_HSV)
{
gimp_color_selector_set_model_visible (selector,
GIMP_COLOR_SELECTOR_MODEL_LCH,
FALSE);
}
else if (model == GIMP_COLOR_SELECTOR_MODEL_LCH)
{
gimp_color_selector_set_model_visible (selector,
GIMP_COLOR_SELECTOR_MODEL_HSV,
FALSE);
}
gimp_color_selector_set_model_visible (selector, model, TRUE);
}
}
Ported module loading to GTypeModule, getting rid of all own module 2002-10-20 Michael Natterer <mitch@gimp.org> Ported module loading to GTypeModule, getting rid of all own module registering/bookkeeping stuff for color selectors and display filters. The modules now simply register GimpColorSelector and GimpColorDisplay subclasses, the list of registered subclasses can then be obtained calling g_type_children() on the abstract base classes. This is work in progress and just the first working state after I started breaking everything... * app/gui/color-select.[ch] * libgimp/gimpcolordisplay.h * libgimp/gimpcolorselector.h: removed. * app/gui/Makefile.am * libgimp/Makefile.am: changed accordingly. * libgimp/gimpmodule.h: massively simplified. All voodoo is gone. * libgimpwidgets/gimpcolordisplay.[ch] * libgimpwidgets/gimpcolorselector.[ch]: new abstract base classes which need to be subclassed by modules. * libgimpwidgets/gimpcolorselect.[ch]: the built-in color selector from app/gui/color-select.* ported to be a GimpColorSelector subclass. * libgimpwidgets/Makefile.am * libgimpwidgets/gimpwidgets.h * libgimpwidgets/gimpwidgetsmarshal.list * libgimpwidgets/gimpwidgetstypes.h: changed accordingly. * app/core/gimpmoduleinfo.[ch]: made it a GTypeModule subclass * app/core/gimpmodules.c: changed accordingly. * app/core/gimpcontainer.c * app/core/gimplist.c: HACKED around to allow GimpLists of GObjects (not GimpObjects). This is EEKy, so I will either make gimp->modules a simple GList and revert this bit of change, or allow GObjects all over the place in GimpContainer land... * app/display/gimpdisplayshell-filter.[ch] * app/gui/color-notebook.c: removed all module stuff and use g_type_children() to get the list of available color_selectors and display_filters. * app/display/gimpdisplayshell-filter-dialog.c * app/display/gimpdisplayshell-render.c * app/gui/module-browser.c: changed accordingly. * app/gui/gui.c: ref the built-in color selector's class before the modules are queried so it appears first in the list of GimpColorSelector's children. * modules/Makefile.am: build the water color selector again. * modules/cdisplay_gamma.c * modules/cdisplay_highcontrast.c * modules/colorsel_triangle.c * modules/colorsel_water.c: ported them all to the new API. * modules/gimpmodregister.[ch]: removed the old EMX module hack.
2002-10-20 18:14:17 +08:00
}
/**
* gimp_color_selector_get_channel:
* @selector: A #GimpColorSelector widget.
*
* Returns the @selector's current channel.
*
* Returns: The #GimpColorSelectorChannel currently shown by the
* @selector.
*
* Since: 2.10
**/
GimpColorSelectorChannel
gimp_color_selector_get_channel (GimpColorSelector *selector)
{
GimpColorSelectorPrivate *priv;
g_return_val_if_fail (GIMP_IS_COLOR_SELECTOR (selector),
GIMP_COLOR_SELECTOR_RED);
priv = gimp_color_selector_get_instance_private (selector);
return priv->channel;
}
/**
* gimp_color_selector_set_model_visible:
* @selector: A #GimpColorSelector widget.
* @model: The affected #GimpColorSelectorModel.
* @visible: The new visible setting.
*
* Sets the @model visible/invisible on the @selector widget.
*
* Toggles visibility of displayed models if this @selector instance
* has the ability to show different color models.
*
* Since: 2.10
**/
void
gimp_color_selector_set_model_visible (GimpColorSelector *selector,
GimpColorSelectorModel model,
gboolean visible)
{
GimpColorSelectorPrivate *priv;
g_return_if_fail (GIMP_IS_COLOR_SELECTOR (selector));
priv = gimp_color_selector_get_instance_private (selector);
visible = visible ? TRUE : FALSE;
if (visible != priv->model_visible[model])
{
GimpColorSelectorClass *selector_class;
priv->model_visible[model] = visible;
selector_class = GIMP_COLOR_SELECTOR_GET_CLASS (selector);
if (selector_class->set_model_visible)
selector_class->set_model_visible (selector, model, visible);
gimp_color_selector_emit_model_visible_changed (selector, model);
}
}
/**
* gimp_color_selector_get_model_visible:
* @selector: A #GimpColorSelector widget.
* @model: The #GimpColorSelectorModel.
*
* Returns: whether @model is visible in @selector.
*
* Since: 2.10
**/
gboolean
gimp_color_selector_get_model_visible (GimpColorSelector *selector,
GimpColorSelectorModel model)
{
GimpColorSelectorPrivate *priv;
g_return_val_if_fail (GIMP_IS_COLOR_SELECTOR (selector), FALSE);
priv = gimp_color_selector_get_instance_private (selector);
return priv->model_visible[model];
}
/**
* gimp_color_selector_set_config:
* @selector: a #GimpColorSelector widget.
* @config: a #GimpColorConfig object.
*
* Sets the color management configuration to use with this color selector.
*
* Since: 2.4
*/
void
gimp_color_selector_set_config (GimpColorSelector *selector,
GimpColorConfig *config)
{
GimpColorSelectorClass *selector_class;
g_return_if_fail (GIMP_IS_COLOR_SELECTOR (selector));
g_return_if_fail (config == NULL || GIMP_IS_COLOR_CONFIG (config));
selector_class = GIMP_COLOR_SELECTOR_GET_CLASS (selector);
if (selector_class->set_config)
selector_class->set_config (selector, config);
}
/**
* gimp_color_selector_set_format
* @selector: a #GimpColorSelector widget.
* @format: a Babl format, with space.
*
* Sets the babl format representing the color model and the space this
* @selector is supposed to display values for. Depending on the type of color
* selector, it may trigger various UX changes, or none at all.
*
* Since: 3.0
*/
void
gimp_color_selector_set_format (GimpColorSelector *selector,
const Babl *format)
{
GimpColorSelectorClass *selector_class;
g_return_if_fail (GIMP_IS_COLOR_SELECTOR (selector));
selector_class = GIMP_COLOR_SELECTOR_GET_CLASS (selector);
if (selector_class->set_format)
selector_class->set_format (selector, format);
}
/**
* gimp_color_selector_set_simulation
* @selector: a #GimpColorSelector widget.
* @profile: a #GimpColorProfile object.
* @intent: a #GimpColorRenderingIntent enum.
* @bpc: a gboolean.
*
* Sets the simulation options to use with this color selector.
*
* Since: 3.0
*/
void
gimp_color_selector_set_simulation (GimpColorSelector *selector,
GimpColorProfile *profile,
GimpColorRenderingIntent intent,
gboolean bpc)
{
GimpColorSelectorClass *selector_class;
GimpColorSelectorPrivate *priv;
g_return_if_fail (GIMP_IS_COLOR_SELECTOR (selector));
g_return_if_fail (profile == NULL || GIMP_IS_COLOR_PROFILE (profile));
selector_class = GIMP_COLOR_SELECTOR_GET_CLASS (selector);
priv = gimp_color_selector_get_instance_private (selector);
if ((profile && ! priv->simulation_profile) ||
(! profile && priv->simulation_profile) ||
(profile && ! gimp_color_profile_is_equal (profile, priv->simulation_profile)) ||
intent != priv->simulation_intent ||
bpc != priv->simulation_bpc)
{
g_set_object (&priv->simulation_profile, profile);
priv->simulation_intent = intent;
priv->simulation_bpc = bpc;
if (selector_class->set_simulation)
selector_class->set_simulation (selector, profile, intent, bpc);
}
}
gboolean
gimp_color_selector_get_simulation (GimpColorSelector *selector,
GimpColorProfile **profile,
GimpColorRenderingIntent *intent,
gboolean *bpc)
{
GimpColorSelectorPrivate *priv;
g_return_val_if_fail (GIMP_IS_COLOR_SELECTOR (selector), FALSE);
priv = gimp_color_selector_get_instance_private (selector);
if (profile)
*profile = priv->simulation_profile;
if (intent)
*intent = priv->simulation_intent;
if (bpc)
*bpc = priv->simulation_bpc;
return priv->simulation;
}
gboolean
gimp_color_selector_enable_simulation (GimpColorSelector *selector,
gboolean enabled)
{
GimpColorSelectorPrivate *priv;
g_return_val_if_fail (GIMP_IS_COLOR_SELECTOR (selector), FALSE);
priv = gimp_color_selector_get_instance_private (selector);
if (priv->simulation != enabled)
{
if (! enabled || priv->simulation_profile)
{
priv->simulation = enabled;
g_signal_emit (selector, selector_signals[SIMULATION], 0, enabled);
}
}
return priv->simulation;
}
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 16:01:17 +08:00
/* Private functions. */
/**
* gimp_color_selector_emit_color_changed:
* @selector: A #GimpColorSelector widget.
*
* Emits the "color-changed" signal.
*/
static void
gimp_color_selector_emit_color_changed (GimpColorSelector *selector)
{
GimpColorSelectorPrivate *priv;
g_return_if_fail (GIMP_IS_COLOR_SELECTOR (selector));
priv = gimp_color_selector_get_instance_private (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 16:01:17 +08:00
g_signal_emit (selector, selector_signals[COLOR_CHANGED], 0, priv->color);
}
/**
* gimp_color_selector_emit_channel_changed:
* @selector: A #GimpColorSelector widget.
*
* Emits the "channel-changed" signal.
*/
static void
gimp_color_selector_emit_channel_changed (GimpColorSelector *selector)
{
GimpColorSelectorPrivate *priv;
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 16:01:17 +08:00
g_return_if_fail (GIMP_IS_COLOR_SELECTOR (selector));
priv = gimp_color_selector_get_instance_private (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 16:01:17 +08:00
g_signal_emit (selector, selector_signals[CHANNEL_CHANGED], 0,
priv->channel);
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 16:01:17 +08:00
}
/**
* gimp_color_selector_emit_model_visible_changed:
* @selector: A #GimpColorSelector widget.
* @model: The #GimpColorSelectorModel where visibility changed.
*
* Emits the "model-visible-changed" signal.
*
* Since: 2.10
*/
static void
gimp_color_selector_emit_model_visible_changed (GimpColorSelector *selector,
GimpColorSelectorModel model)
{
GimpColorSelectorPrivate *priv;
g_return_if_fail (GIMP_IS_COLOR_SELECTOR (selector));
priv = gimp_color_selector_get_instance_private (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 16:01:17 +08:00
g_signal_emit (selector, selector_signals[MODEL_VISIBLE_CHANGED], 0,
model, priv->model_visible[model]);
}