mirror of https://github.com/GNOME/gimp.git
Add Desaturate as an image-map tool with live preview (bug #533808):
2008-05-21 Sven Neumann <sven@gimp.org> Add Desaturate as an image-map tool with live preview (bug #533808): * app/gegl/Makefile.am * app/gegl/gegl-types.h * app/gegl/gimpdesaturateconfig.[ch]: added config object for the desaturate point filter. * app/gegl/gimpoperationdesaturate.[ch]: derive from GimpOperationPointFilter. Unrolled the inner loop. * app/core/gimpdrawable-desaturate.c: changed accordingly. * app/tools/Makefile.am * app/tools/gimpdesaturatetool.[ch]: added desaturate as an imagemap tool. So far only the GEGL code path is implemented. * app/tools/gimp-tools.c: register the new tool. * app/dialogs/dialogs.c: register the new tool dialog. * app/dialogs/Makefile.am * app/dialogs/desaturate-dialog.[ch]: removed the desaturate dialog. * app/actions/drawable-actions.c * app/actions/drawable-commands.[ch]: removed action "drawable-desaturate". * app/widgets/gimphelp-ids.h: changed help IDs accordingly. * menus/image-menu.xml.in: replaced "drawable-desaturate" with "tools-desaturate". * libgimpwidgets/gimpstock.h: added a define for GIMP_STOCK_TOOL_DESATURATE. svn path=/trunk/; revision=25726
This commit is contained in:
parent
1e3a887d3b
commit
e86e003224
37
ChangeLog
37
ChangeLog
|
@ -1,3 +1,40 @@
|
|||
2008-05-21 Sven Neumann <sven@gimp.org>
|
||||
|
||||
Add Desaturate as an image-map tool with live preview (bug #533808):
|
||||
|
||||
* app/gegl/Makefile.am
|
||||
* app/gegl/gegl-types.h
|
||||
* app/gegl/gimpdesaturateconfig.[ch]: added config object for the
|
||||
desaturate point filter.
|
||||
|
||||
* app/gegl/gimpoperationdesaturate.[ch]: derive from
|
||||
GimpOperationPointFilter. Unrolled the inner loop.
|
||||
|
||||
* app/core/gimpdrawable-desaturate.c: changed accordingly.
|
||||
|
||||
* app/tools/Makefile.am
|
||||
* app/tools/gimpdesaturatetool.[ch]: added desaturate as an
|
||||
imagemap tool. So far only the GEGL code path is implemented.
|
||||
|
||||
* app/tools/gimp-tools.c: register the new tool.
|
||||
|
||||
* app/dialogs/dialogs.c: register the new tool dialog.
|
||||
|
||||
* app/dialogs/Makefile.am
|
||||
* app/dialogs/desaturate-dialog.[ch]: removed the desaturate dialog.
|
||||
|
||||
* app/actions/drawable-actions.c
|
||||
* app/actions/drawable-commands.[ch]: removed action
|
||||
"drawable-desaturate".
|
||||
|
||||
* app/widgets/gimphelp-ids.h: changed help IDs accordingly.
|
||||
|
||||
* menus/image-menu.xml.in: replaced "drawable-desaturate" with
|
||||
"tools-desaturate".
|
||||
|
||||
* libgimpwidgets/gimpstock.h: added a define for
|
||||
GIMP_STOCK_TOOL_DESATURATE.
|
||||
|
||||
2008-05-21 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* plug-ins/jpeg/jpeg-save.c (save_dialog): changed badly chosen
|
||||
|
|
|
@ -41,12 +41,6 @@
|
|||
|
||||
static const GimpActionEntry drawable_actions[] =
|
||||
{
|
||||
{ "drawable-desaturate", GIMP_STOCK_CONVERT_GRAYSCALE,
|
||||
N_("_Desaturate..."), NULL,
|
||||
N_("Turn colors into shades of gray"),
|
||||
G_CALLBACK (drawable_desaturate_cmd_callback),
|
||||
GIMP_HELP_LAYER_DESATURATE },
|
||||
|
||||
{ "drawable-equalize", NULL,
|
||||
N_("_Equalize"), NULL,
|
||||
N_("Automatic contrast enhancement"),
|
||||
|
@ -190,7 +184,6 @@ drawable_actions_update (GimpActionGroup *group,
|
|||
#define SET_ACTIVE(action,condition) \
|
||||
gimp_action_group_set_action_active (group, action, (condition) != 0)
|
||||
|
||||
SET_SENSITIVE ("drawable-desaturate", drawable && is_rgb);
|
||||
SET_SENSITIVE ("drawable-equalize", drawable && ! is_indexed);
|
||||
SET_SENSITIVE ("drawable-invert", drawable && ! is_indexed);
|
||||
SET_SENSITIVE ("drawable-levels-stretch", drawable && is_rgb);
|
||||
|
|
|
@ -36,7 +36,6 @@
|
|||
#include "core/gimplayermask.h"
|
||||
#include "core/gimpprogress.h"
|
||||
|
||||
#include "dialogs/desaturate-dialog.h"
|
||||
#include "dialogs/offset-dialog.h"
|
||||
|
||||
#include "actions.h"
|
||||
|
@ -45,49 +44,8 @@
|
|||
#include "gimp-intl.h"
|
||||
|
||||
|
||||
/* local function prototypes */
|
||||
|
||||
static void desaturate_response (GtkWidget *widget,
|
||||
gint response_id,
|
||||
DesaturateDialog *dialog);
|
||||
|
||||
|
||||
/* private variables */
|
||||
|
||||
static GimpDesaturateMode desaturate_mode = GIMP_DESATURATE_LIGHTNESS;
|
||||
|
||||
|
||||
/* public functions */
|
||||
|
||||
void
|
||||
drawable_desaturate_cmd_callback (GtkAction *action,
|
||||
gpointer data)
|
||||
{
|
||||
DesaturateDialog *dialog;
|
||||
GimpImage *image;
|
||||
GimpDrawable *drawable;
|
||||
GtkWidget *widget;
|
||||
return_if_no_drawable (image, drawable, data);
|
||||
return_if_no_widget (widget, data);
|
||||
|
||||
if (! gimp_drawable_is_rgb (drawable))
|
||||
{
|
||||
gimp_message (image->gimp, G_OBJECT (widget), GIMP_MESSAGE_WARNING,
|
||||
_("Desaturate operates only on RGB color layers."));
|
||||
return;
|
||||
}
|
||||
|
||||
dialog = desaturate_dialog_new (drawable,
|
||||
action_data_get_context (data),
|
||||
widget, desaturate_mode);
|
||||
|
||||
g_signal_connect (dialog->dialog, "response",
|
||||
G_CALLBACK (desaturate_response),
|
||||
dialog);
|
||||
|
||||
gtk_widget_show (dialog->dialog);
|
||||
}
|
||||
|
||||
void
|
||||
drawable_equalize_cmd_callback (GtkAction *action,
|
||||
gpointer data)
|
||||
|
@ -325,26 +283,3 @@ drawable_rotate_cmd_callback (GtkAction *action,
|
|||
|
||||
gimp_image_flush (image);
|
||||
}
|
||||
|
||||
/* private functions */
|
||||
|
||||
static void
|
||||
desaturate_response (GtkWidget *widget,
|
||||
gint response_id,
|
||||
DesaturateDialog *dialog)
|
||||
{
|
||||
if (response_id == GTK_RESPONSE_OK)
|
||||
{
|
||||
GimpDrawable *drawable = dialog->drawable;
|
||||
GimpImage *image = gimp_item_get_image (GIMP_ITEM (drawable));
|
||||
|
||||
/* remember for next invocation of the dialog */
|
||||
desaturate_mode = dialog->mode;
|
||||
|
||||
gimp_drawable_desaturate (drawable, desaturate_mode);
|
||||
|
||||
gimp_image_flush (image);
|
||||
}
|
||||
|
||||
gtk_widget_destroy (dialog->dialog);
|
||||
}
|
||||
|
|
|
@ -20,8 +20,6 @@
|
|||
#define __DRAWABLE_COMMANDS_H__
|
||||
|
||||
|
||||
void drawable_desaturate_cmd_callback (GtkAction *action,
|
||||
gpointer data);
|
||||
void drawable_equalize_cmd_callback (GtkAction *action,
|
||||
gpointer data);
|
||||
void drawable_invert_cmd_callback (GtkAction *action,
|
||||
|
@ -43,4 +41,5 @@ void drawable_rotate_cmd_callback (GtkAction *action,
|
|||
gint value,
|
||||
gpointer data);
|
||||
|
||||
|
||||
#endif /* __DRAWABLE_COMMANDS_H__ */
|
||||
|
|
|
@ -27,6 +27,8 @@
|
|||
#include "base/pixel-processor.h"
|
||||
#include "base/pixel-region.h"
|
||||
|
||||
#include "gegl/gimpdesaturateconfig.h"
|
||||
|
||||
/* temp */
|
||||
#include "gimp.h"
|
||||
#include "gimpimage.h"
|
||||
|
@ -63,15 +65,22 @@ gimp_drawable_desaturate (GimpDrawable *drawable,
|
|||
if (gimp_use_gegl (GIMP_ITEM (drawable)->image->gimp))
|
||||
{
|
||||
GeglNode *desaturate;
|
||||
GObject *config;
|
||||
|
||||
desaturate = g_object_new (GEGL_TYPE_NODE,
|
||||
"operation", "gimp-desaturate",
|
||||
NULL);
|
||||
|
||||
config = g_object_new (GIMP_TYPE_DESATURATE_CONFIG,
|
||||
"mode", mode,
|
||||
NULL);
|
||||
|
||||
gegl_node_set (desaturate,
|
||||
"mode", mode,
|
||||
"config", config,
|
||||
NULL);
|
||||
|
||||
g_object_unref (config);
|
||||
|
||||
gimp_drawable_apply_operation (drawable, desaturate, TRUE,
|
||||
NULL, _("Desaturate"));
|
||||
|
||||
|
|
|
@ -26,8 +26,6 @@ libappdialogs_a_sources = \
|
|||
channel-options-dialog.h \
|
||||
convert-dialog.c \
|
||||
convert-dialog.h \
|
||||
desaturate-dialog.c \
|
||||
desaturate-dialog.h \
|
||||
fade-dialog.c \
|
||||
fade-dialog.h \
|
||||
file-open-dialog.c \
|
||||
|
|
|
@ -1,114 +0,0 @@
|
|||
/* GIMP - The GNU Image Manipulation Program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "libgimpwidgets/gimpwidgets.h"
|
||||
|
||||
#include "dialogs-types.h"
|
||||
|
||||
#include "core/gimpcontext.h"
|
||||
#include "core/gimplayer.h"
|
||||
|
||||
#include "widgets/gimphelp-ids.h"
|
||||
#include "widgets/gimpviewabledialog.h"
|
||||
|
||||
#include "desaturate-dialog.h"
|
||||
|
||||
#include "gimp-intl.h"
|
||||
|
||||
|
||||
static void desaturate_dialog_free (DesaturateDialog *dialog);
|
||||
|
||||
|
||||
DesaturateDialog *
|
||||
desaturate_dialog_new (GimpDrawable *drawable,
|
||||
GimpContext *context,
|
||||
GtkWidget *parent,
|
||||
GimpDesaturateMode mode)
|
||||
{
|
||||
DesaturateDialog *dialog;
|
||||
GtkWidget *vbox;
|
||||
GtkWidget *frame;
|
||||
GtkWidget *button;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), NULL);
|
||||
g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
|
||||
g_return_val_if_fail (GTK_IS_WIDGET (parent), NULL);
|
||||
|
||||
dialog = g_slice_new0 (DesaturateDialog);
|
||||
|
||||
dialog->drawable = drawable;
|
||||
dialog->mode = mode;
|
||||
|
||||
dialog->dialog =
|
||||
gimp_viewable_dialog_new (GIMP_VIEWABLE (drawable), context,
|
||||
_("Desaturate"), "gimp-drawable-desaturate",
|
||||
GIMP_STOCK_CONVERT_GRAYSCALE,
|
||||
_("Remove Colors"),
|
||||
parent,
|
||||
gimp_standard_help_func,
|
||||
GIMP_HELP_LAYER_DESATURATE,
|
||||
|
||||
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
|
||||
|
||||
NULL);
|
||||
|
||||
button = gtk_dialog_add_button (GTK_DIALOG (dialog->dialog),
|
||||
_("_Desaturate"), GTK_RESPONSE_OK);
|
||||
gtk_button_set_image (GTK_BUTTON (button),
|
||||
gtk_image_new_from_stock (GIMP_STOCK_CONVERT_GRAYSCALE,
|
||||
GTK_ICON_SIZE_BUTTON));
|
||||
|
||||
gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog->dialog),
|
||||
GTK_RESPONSE_OK,
|
||||
GTK_RESPONSE_CANCEL,
|
||||
-1);
|
||||
|
||||
gtk_window_set_resizable (GTK_WINDOW (dialog->dialog), FALSE);
|
||||
|
||||
g_object_weak_ref (G_OBJECT (dialog->dialog),
|
||||
(GWeakNotify) desaturate_dialog_free, dialog);
|
||||
|
||||
vbox = gtk_vbox_new (FALSE, 12);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), 12);
|
||||
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog->dialog)->vbox), vbox);
|
||||
gtk_widget_show (vbox);
|
||||
|
||||
frame =
|
||||
gimp_enum_radio_frame_new (GIMP_TYPE_DESATURATE_MODE,
|
||||
gtk_label_new (_("Choose shade of gray based on:")),
|
||||
G_CALLBACK (gimp_radio_button_update),
|
||||
&dialog->mode,
|
||||
&button);
|
||||
|
||||
gimp_int_radio_group_set_active (GTK_RADIO_BUTTON (button), dialog->mode);
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
|
||||
gtk_widget_show (frame);
|
||||
|
||||
return dialog;
|
||||
}
|
||||
|
||||
static void
|
||||
desaturate_dialog_free (DesaturateDialog *dialog)
|
||||
{
|
||||
g_slice_free (DesaturateDialog, dialog);
|
||||
}
|
|
@ -1,40 +0,0 @@
|
|||
/* GIMP - The GNU Image Manipulation Program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef __DESATURATE_DIALOG_H__
|
||||
#define __DESATURATE_DIALOG_H__
|
||||
|
||||
|
||||
typedef struct _DesaturateDialog DesaturateDialog;
|
||||
|
||||
struct _DesaturateDialog
|
||||
{
|
||||
GtkWidget *dialog;
|
||||
|
||||
GimpDrawable *drawable;
|
||||
GimpDesaturateMode mode;
|
||||
};
|
||||
|
||||
|
||||
DesaturateDialog * desaturate_dialog_new (GimpDrawable *drawable,
|
||||
GimpContext *context,
|
||||
GtkWidget *parent,
|
||||
GimpDesaturateMode mode);
|
||||
|
||||
|
||||
#endif /* __DESATURATE_DIALOG_H__ */
|
|
@ -49,11 +49,11 @@ GimpDialogFactory *global_display_factory = NULL;
|
|||
GimpContainer *global_recent_docks = NULL;
|
||||
|
||||
|
||||
#define FOREIGN(id,singleton,remember_size) \
|
||||
#define FOREIGN(id, singleton, remember_size) \
|
||||
{ id, NULL, NULL, NULL, NULL, \
|
||||
NULL, 0, singleton, TRUE, remember_size, FALSE }
|
||||
|
||||
#define TOPLEVEL(id,new_func,singleton,session_managed,remember_size) \
|
||||
#define TOPLEVEL(id, new_func, singleton, session_managed, remember_size) \
|
||||
{ id, NULL, NULL, NULL, NULL, \
|
||||
new_func, 0, singleton, session_managed, remember_size, FALSE }
|
||||
|
||||
|
@ -62,11 +62,12 @@ static const GimpDialogFactoryEntry toplevel_entries[] =
|
|||
{
|
||||
/* foreign toplevels without constructor */
|
||||
FOREIGN ("gimp-brightness-contrast-tool-dialog", TRUE, FALSE),
|
||||
FOREIGN ("gimp-color-balance-tool-dialog", TRUE, FALSE),
|
||||
FOREIGN ("gimp-color-picker-tool-dialog", TRUE, TRUE),
|
||||
FOREIGN ("gimp-colorize-tool-dialog", TRUE, FALSE),
|
||||
FOREIGN ("gimp-crop-tool-dialog", TRUE, FALSE),
|
||||
FOREIGN ("gimp-curves-tool-dialog", TRUE, TRUE),
|
||||
FOREIGN ("gimp-color-balance-tool-dialog", TRUE, FALSE),
|
||||
FOREIGN ("gimp-desaturate-tool-dialog", TRUE, FALSE),
|
||||
FOREIGN ("gimp-gegl-tool-dialog", TRUE, FALSE),
|
||||
FOREIGN ("gimp-hue-saturation-tool-dialog", TRUE, FALSE),
|
||||
FOREIGN ("gimp-levels-tool-dialog", TRUE, TRUE),
|
||||
|
|
|
@ -17,6 +17,8 @@ libappgegl_a_SOURCES = \
|
|||
gimpcolorizeconfig.h \
|
||||
gimpcurvesconfig.c \
|
||||
gimpcurvesconfig.h \
|
||||
gimpdesaturateconfig.c \
|
||||
gimpdesaturateconfig.h \
|
||||
gimphuesaturationconfig.c \
|
||||
gimphuesaturationconfig.h \
|
||||
gimplevelsconfig.c \
|
||||
|
|
|
@ -47,6 +47,7 @@ typedef struct _GimpBrightnessContrastConfig GimpBrightnessContrastConfig;
|
|||
typedef struct _GimpColorBalanceConfig GimpColorBalanceConfig;
|
||||
typedef struct _GimpColorizeConfig GimpColorizeConfig;
|
||||
typedef struct _GimpCurvesConfig GimpCurvesConfig;
|
||||
typedef struct _GimpDesaturateConfig GimpDesaturateConfig;
|
||||
typedef struct _GimpHueSaturationConfig GimpHueSaturationConfig;
|
||||
typedef struct _GimpLevelsConfig GimpLevelsConfig;
|
||||
typedef struct _GimpPosterizeConfig GimpPosterizeConfig;
|
||||
|
|
|
@ -0,0 +1,118 @@
|
|||
/* GIMP - The GNU Image Manipulation Program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* gimpdesaturateconfig.c
|
||||
* Copyright (C) 2008 Sven Neumann <sven@gimp.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <gegl.h>
|
||||
|
||||
#include "libgimpconfig/gimpconfig.h"
|
||||
|
||||
#include "gegl-types.h"
|
||||
|
||||
#include "gimpdesaturateconfig.h"
|
||||
|
||||
|
||||
enum
|
||||
{
|
||||
PROP_0,
|
||||
PROP_MODE
|
||||
};
|
||||
|
||||
|
||||
static void gimp_desaturate_config_get_property (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gimp_desaturate_config_set_property (GObject *object,
|
||||
guint property_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec);
|
||||
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (GimpDesaturateConfig, gimp_desaturate_config,
|
||||
GIMP_TYPE_IMAGE_MAP_CONFIG,
|
||||
G_IMPLEMENT_INTERFACE (GIMP_TYPE_CONFIG, NULL))
|
||||
|
||||
#define parent_class gimp_desaturate_config_parent_class
|
||||
|
||||
|
||||
static void
|
||||
gimp_desaturate_config_class_init (GimpDesaturateConfigClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
GimpViewableClass *viewable_class = GIMP_VIEWABLE_CLASS (klass);
|
||||
|
||||
object_class->set_property = gimp_desaturate_config_set_property;
|
||||
object_class->get_property = gimp_desaturate_config_get_property;
|
||||
|
||||
viewable_class->default_stock_id = "gimp-tool-desaturate";
|
||||
|
||||
GIMP_CONFIG_INSTALL_PROP_ENUM (object_class, PROP_MODE,
|
||||
"mode",
|
||||
"Desaturate mode",
|
||||
GIMP_TYPE_DESATURATE_MODE,
|
||||
GIMP_DESATURATE_LIGHTNESS, 0);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_desaturate_config_init (GimpDesaturateConfig *self)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_desaturate_config_get_property (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GimpDesaturateConfig *self = GIMP_DESATURATE_CONFIG (object);
|
||||
|
||||
switch (property_id)
|
||||
{
|
||||
case PROP_MODE:
|
||||
g_value_set_enum (value, self->mode);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_desaturate_config_set_property (GObject *object,
|
||||
guint property_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GimpDesaturateConfig *self = GIMP_DESATURATE_CONFIG (object);
|
||||
|
||||
switch (property_id)
|
||||
{
|
||||
case PROP_MODE:
|
||||
self->mode = g_value_get_enum (value);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
/* GIMP - The GNU Image Manipulation Program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* gimpdesaturateconfig.h
|
||||
* Copyright (C) 2008 Sven Neumann <sven@gimp.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef __GIMP_DESATURATE_CONFIG_H__
|
||||
#define __GIMP_DESATURATE_CONFIG_H__
|
||||
|
||||
|
||||
#include "core/gimpimagemapconfig.h"
|
||||
|
||||
|
||||
#define GIMP_TYPE_DESATURATE_CONFIG (gimp_desaturate_config_get_type ())
|
||||
#define GIMP_DESATURATE_CONFIG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_DESATURATE_CONFIG, GimpDesaturateConfig))
|
||||
#define GIMP_DESATURATE_CONFIG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_DESATURATE_CONFIG, GimpDesaturateConfigClass))
|
||||
#define GIMP_IS_DESATURATE_CONFIG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_DESATURATE_CONFIG))
|
||||
#define GIMP_IS_DESATURATE_CONFIG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_DESATURATE_CONFIG))
|
||||
#define GIMP_DESATURATE_CONFIG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_DESATURATE_CONFIG, GimpDesaturateConfigClass))
|
||||
|
||||
|
||||
typedef struct _GimpDesaturateConfigClass GimpDesaturateConfigClass;
|
||||
|
||||
struct _GimpDesaturateConfig
|
||||
{
|
||||
GimpImageMapConfig parent_instance;
|
||||
|
||||
GimpDesaturateMode mode;
|
||||
};
|
||||
|
||||
struct _GimpDesaturateConfigClass
|
||||
{
|
||||
GimpImageMapConfigClass parent_class;
|
||||
};
|
||||
|
||||
|
||||
GType gimp_desaturate_config_get_type (void) G_GNUC_CONST;
|
||||
|
||||
|
||||
#endif /* __GIMP_DESATURATE_CONFIG_H__ */
|
|
@ -28,32 +28,17 @@
|
|||
#include "gegl-types.h"
|
||||
|
||||
#include "gimpoperationdesaturate.h"
|
||||
#include "gimpdesaturateconfig.h"
|
||||
|
||||
|
||||
enum
|
||||
{
|
||||
PROP_0,
|
||||
PROP_MODE
|
||||
};
|
||||
|
||||
|
||||
static void gimp_operation_desaturate_get_property (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gimp_operation_desaturate_set_property (GObject *object,
|
||||
guint property_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec);
|
||||
|
||||
static gboolean gimp_operation_desaturate_process (GeglOperation *operation,
|
||||
void *in_buf,
|
||||
void *out_buf,
|
||||
glong samples);
|
||||
static gboolean gimp_operation_desaturate_process (GeglOperation *operation,
|
||||
void *in_buf,
|
||||
void *out_buf,
|
||||
glong samples);
|
||||
|
||||
|
||||
G_DEFINE_TYPE (GimpOperationDesaturate, gimp_operation_desaturate,
|
||||
GEGL_TYPE_OPERATION_POINT_FILTER)
|
||||
GIMP_TYPE_OPERATION_POINT_FILTER)
|
||||
|
||||
#define parent_class gimp_operation_desaturate_parent_class
|
||||
|
||||
|
@ -65,8 +50,8 @@ gimp_operation_desaturate_class_init (GimpOperationDesaturateClass *klass)
|
|||
GeglOperationClass *operation_class = GEGL_OPERATION_CLASS (klass);
|
||||
GeglOperationPointFilterClass *point_class = GEGL_OPERATION_POINT_FILTER_CLASS (klass);
|
||||
|
||||
object_class->set_property = gimp_operation_desaturate_set_property;
|
||||
object_class->get_property = gimp_operation_desaturate_get_property;
|
||||
object_class->set_property = gimp_operation_point_filter_set_property;
|
||||
object_class->get_property = gimp_operation_point_filter_get_property;
|
||||
|
||||
operation_class->name = "gimp-desaturate";
|
||||
operation_class->categories = "color";
|
||||
|
@ -75,14 +60,13 @@ gimp_operation_desaturate_class_init (GimpOperationDesaturateClass *klass)
|
|||
point_class->process = gimp_operation_desaturate_process;
|
||||
|
||||
g_object_class_install_property (object_class,
|
||||
PROP_MODE,
|
||||
g_param_spec_enum ("mode",
|
||||
"Mode",
|
||||
"The desaturate mode",
|
||||
GIMP_TYPE_DESATURATE_MODE,
|
||||
GIMP_DESATURATE_LIGHTNESS,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_CONSTRUCT));
|
||||
GIMP_OPERATION_POINT_FILTER_PROP_CONFIG,
|
||||
g_param_spec_object ("config",
|
||||
"Config",
|
||||
"The config object",
|
||||
GIMP_TYPE_DESATURATE_CONFIG,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_CONSTRUCT));
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -90,97 +74,70 @@ gimp_operation_desaturate_init (GimpOperationDesaturate *self)
|
|||
{
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_operation_desaturate_get_property (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GimpOperationDesaturate *self = GIMP_OPERATION_DESATURATE (object);
|
||||
|
||||
switch (property_id)
|
||||
{
|
||||
case PROP_MODE:
|
||||
g_value_set_enum (value, self->mode);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_operation_desaturate_set_property (GObject *object,
|
||||
guint property_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GimpOperationDesaturate *self = GIMP_OPERATION_DESATURATE (object);
|
||||
|
||||
switch (property_id)
|
||||
{
|
||||
case PROP_MODE:
|
||||
self->mode = g_value_get_enum (value);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gimp_operation_desaturate_process (GeglOperation *operation,
|
||||
void *in_buf,
|
||||
void *out_buf,
|
||||
glong samples)
|
||||
{
|
||||
GimpOperationDesaturate *self = GIMP_OPERATION_DESATURATE (operation);
|
||||
gfloat *src = in_buf;
|
||||
gfloat *dest = out_buf;
|
||||
GimpOperationPointFilter *point = GIMP_OPERATION_POINT_FILTER (operation);
|
||||
GimpDesaturateConfig *config = GIMP_DESATURATE_CONFIG (point->config);
|
||||
gfloat *src = in_buf;
|
||||
gfloat *dest = out_buf;
|
||||
|
||||
while (samples--)
|
||||
switch (config->mode)
|
||||
{
|
||||
gfloat value = 0.0;
|
||||
|
||||
switch (self->mode)
|
||||
case GIMP_DESATURATE_LIGHTNESS:
|
||||
while (samples--)
|
||||
{
|
||||
case GIMP_DESATURATE_LIGHTNESS:
|
||||
{
|
||||
gfloat min, max;
|
||||
gfloat min, max, value;
|
||||
|
||||
#ifdef __GNUC__
|
||||
#warning FIXME: cant use FOO_PIX but have no constants from babl???
|
||||
#endif
|
||||
max = MAX (src[0], src[1]);
|
||||
max = MAX (max, src[2]);
|
||||
min = MIN (src[0], src[1]);
|
||||
min = MIN (min, src[2]);
|
||||
|
||||
max = MAX (src[RED_PIX], src[GREEN_PIX]);
|
||||
max = MAX (max, src[BLUE_PIX]);
|
||||
min = MIN (src[RED_PIX], src[GREEN_PIX]);
|
||||
min = MIN (min, src[BLUE_PIX]);
|
||||
value = (max + min) / 2;
|
||||
|
||||
value = (max + min) / 2;
|
||||
}
|
||||
break;
|
||||
dest[0] = value;
|
||||
dest[1] = value;
|
||||
dest[2] = value;
|
||||
dest[3] = src[3];
|
||||
|
||||
case GIMP_DESATURATE_LUMINOSITY:
|
||||
value = GIMP_RGB_LUMINANCE (src[RED_PIX],
|
||||
src[GREEN_PIX],
|
||||
src[BLUE_PIX]);
|
||||
break;
|
||||
|
||||
case GIMP_DESATURATE_AVERAGE:
|
||||
value = (src[RED_PIX] + src[GREEN_PIX] + src[BLUE_PIX]) / 3;
|
||||
break;
|
||||
src += 4;
|
||||
dest += 4;
|
||||
}
|
||||
break;
|
||||
|
||||
dest[RED_PIX] = value;
|
||||
dest[GREEN_PIX] = value;
|
||||
dest[BLUE_PIX] = value;
|
||||
dest[ALPHA_PIX] = src[ALPHA_PIX];
|
||||
case GIMP_DESATURATE_LUMINOSITY:
|
||||
while (samples--)
|
||||
{
|
||||
gfloat value = GIMP_RGB_LUMINANCE (src[0], src[1], src[2]);
|
||||
|
||||
src += 4;
|
||||
dest += 4;
|
||||
dest[0] = value;
|
||||
dest[1] = value;
|
||||
dest[2] = value;
|
||||
dest[3] = src[3];
|
||||
|
||||
src += 4;
|
||||
dest += 4;
|
||||
}
|
||||
break;
|
||||
|
||||
case GIMP_DESATURATE_AVERAGE:
|
||||
while (samples--)
|
||||
{
|
||||
gfloat value = (src[0] + src[1] + src[2]) / 3;
|
||||
|
||||
dest[0] = value;
|
||||
dest[1] = value;
|
||||
dest[2] = value;
|
||||
dest[3] = src[3];
|
||||
|
||||
src += 4;
|
||||
dest += 4;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
|
|
|
@ -22,8 +22,8 @@
|
|||
#ifndef __GIMP_OPERATION_DESATURATE_H__
|
||||
#define __GIMP_OPERATION_DESATURATE_H__
|
||||
|
||||
#include <gegl-plugin.h>
|
||||
#include <operation/gegl-operation-point-filter.h>
|
||||
|
||||
#include "gimpoperationpointfilter.h"
|
||||
|
||||
|
||||
#define GIMP_TYPE_OPERATION_DESATURATE (gimp_operation_desaturate_get_type ())
|
||||
|
@ -36,14 +36,12 @@ typedef struct _GimpOperationDesaturateClass GimpOperationDesaturateClass;
|
|||
|
||||
struct _GimpOperationDesaturate
|
||||
{
|
||||
GeglOperationPointFilter parent_instance;
|
||||
|
||||
GimpDesaturateMode mode;
|
||||
GimpOperationPointFilter parent_instance;
|
||||
};
|
||||
|
||||
struct _GimpOperationDesaturateClass
|
||||
{
|
||||
GeglOperationPointFilterClass parent_class;
|
||||
GimpOperationPointFilterClass parent_class;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -54,6 +54,8 @@ libapptools_a_sources = \
|
|||
gimpcroptool.h \
|
||||
gimpcurvestool.c \
|
||||
gimpcurvestool.h \
|
||||
gimpdesaturatetool.c \
|
||||
gimpdesaturatetool.h \
|
||||
gimpdodgeburntool.c \
|
||||
gimpdodgeburntool.h \
|
||||
gimpdrawtool.c \
|
||||
|
|
|
@ -50,6 +50,7 @@
|
|||
#include "gimpconvolvetool.h"
|
||||
#include "gimpcroptool.h"
|
||||
#include "gimpcurvestool.h"
|
||||
#include "gimpdesaturatetool.h"
|
||||
#include "gimpdodgeburntool.h"
|
||||
#include "gimpellipseselecttool.h"
|
||||
#include "gimperasertool.h"
|
||||
|
@ -125,6 +126,7 @@ gimp_tools_init (Gimp *gimp)
|
|||
gimp_colorize_tool_register,
|
||||
gimp_hue_saturation_tool_register,
|
||||
gimp_color_balance_tool_register,
|
||||
gimp_desaturate_tool_register,
|
||||
|
||||
/* paint tools */
|
||||
|
||||
|
|
|
@ -0,0 +1,229 @@
|
|||
/* GIMP - The GNU Image Manipulation Program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <gegl.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "libgimpmath/gimpmath.h"
|
||||
#include "libgimpconfig/gimpconfig.h"
|
||||
#include "libgimpwidgets/gimpwidgets.h"
|
||||
|
||||
#include "tools-types.h"
|
||||
|
||||
#include "base/gimplut.h"
|
||||
#include "base/lut-funcs.h"
|
||||
|
||||
#include "gegl/gimpdesaturateconfig.h"
|
||||
|
||||
#include "core/gimpdrawable.h"
|
||||
#include "core/gimpimage.h"
|
||||
|
||||
#include "widgets/gimphelp-ids.h"
|
||||
|
||||
#include "display/gimpdisplay.h"
|
||||
|
||||
#include "gimpimagemapoptions.h"
|
||||
#include "gimpdesaturatetool.h"
|
||||
|
||||
#include "gimp-intl.h"
|
||||
|
||||
|
||||
static gboolean gimp_desaturate_tool_initialize (GimpTool *tool,
|
||||
GimpDisplay *display,
|
||||
GError **error);
|
||||
|
||||
static GeglNode * gimp_desaturate_tool_get_operation (GimpImageMapTool *im_tool,
|
||||
GObject **config);
|
||||
static void gimp_desaturate_tool_map (GimpImageMapTool *im_tool);
|
||||
static void gimp_desaturate_tool_dialog (GimpImageMapTool *im_tool);
|
||||
|
||||
static void gimp_desaturate_tool_config_notify (GObject *object,
|
||||
GParamSpec *pspec,
|
||||
GimpDesaturateTool *desaturate_tool);
|
||||
static void gimp_desaturate_tool_mode_changed (GtkWidget *button,
|
||||
GimpDesaturateTool *desaturate_tool);
|
||||
|
||||
|
||||
G_DEFINE_TYPE (GimpDesaturateTool, gimp_desaturate_tool,
|
||||
GIMP_TYPE_IMAGE_MAP_TOOL)
|
||||
|
||||
#define parent_class gimp_desaturate_tool_parent_class
|
||||
|
||||
|
||||
void
|
||||
gimp_desaturate_tool_register (GimpToolRegisterCallback callback,
|
||||
gpointer data)
|
||||
{
|
||||
(* callback) (GIMP_TYPE_DESATURATE_TOOL,
|
||||
GIMP_TYPE_IMAGE_MAP_OPTIONS, NULL,
|
||||
0,
|
||||
"gimp-desaturate-tool",
|
||||
_("Desaturate"),
|
||||
_("Desaturate Tool: Turn colors into shades of gray"),
|
||||
N_("_Desaturate..."), NULL,
|
||||
NULL, GIMP_HELP_TOOL_DESATURATE,
|
||||
GIMP_STOCK_TOOL_DESATURATE,
|
||||
data);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_desaturate_tool_class_init (GimpDesaturateToolClass *klass)
|
||||
{
|
||||
GimpToolClass *tool_class = GIMP_TOOL_CLASS (klass);
|
||||
GimpImageMapToolClass *im_tool_class = GIMP_IMAGE_MAP_TOOL_CLASS (klass);
|
||||
|
||||
tool_class->initialize = gimp_desaturate_tool_initialize;
|
||||
|
||||
im_tool_class->shell_desc = _("Desaturate (Remove Colors)");
|
||||
im_tool_class->settings_name = "desaturate";
|
||||
im_tool_class->load_dialog_title = _("Load Desaturate Settings");
|
||||
im_tool_class->load_button_tip = _("Load desaturate settings from file");
|
||||
im_tool_class->save_dialog_title = _("Save Desaturate Settings");
|
||||
im_tool_class->save_button_tip = _("Save desaturate settings to file");
|
||||
|
||||
im_tool_class->get_operation = gimp_desaturate_tool_get_operation;
|
||||
im_tool_class->map = gimp_desaturate_tool_map;
|
||||
im_tool_class->dialog = gimp_desaturate_tool_dialog;
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_desaturate_tool_init (GimpDesaturateTool *desaturate_tool)
|
||||
{
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gimp_desaturate_tool_initialize (GimpTool *tool,
|
||||
GimpDisplay *display,
|
||||
GError **error)
|
||||
{
|
||||
GimpDesaturateTool *desaturate_tool = GIMP_DESATURATE_TOOL (tool);
|
||||
GimpDrawable *drawable;
|
||||
|
||||
drawable = gimp_image_get_active_drawable (display->image);
|
||||
|
||||
if (! drawable)
|
||||
return FALSE;
|
||||
|
||||
if (! gimp_drawable_is_rgb (drawable))
|
||||
{
|
||||
g_set_error (error, 0, 0,
|
||||
_("Desaturate does only operate on RGB layers."));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gimp_config_reset (GIMP_CONFIG (desaturate_tool->config));
|
||||
|
||||
GIMP_TOOL_CLASS (parent_class)->initialize (tool, display, error);
|
||||
|
||||
gimp_int_radio_group_set_active (GTK_RADIO_BUTTON (desaturate_tool->button),
|
||||
desaturate_tool->config->mode);
|
||||
|
||||
gimp_image_map_tool_preview (GIMP_IMAGE_MAP_TOOL (desaturate_tool));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static GeglNode *
|
||||
gimp_desaturate_tool_get_operation (GimpImageMapTool *image_map_tool,
|
||||
GObject **config)
|
||||
{
|
||||
GimpDesaturateTool *desaturate_tool = GIMP_DESATURATE_TOOL (image_map_tool);
|
||||
GeglNode *node;
|
||||
|
||||
node = g_object_new (GEGL_TYPE_NODE,
|
||||
"operation", "gimp-desaturate",
|
||||
NULL);
|
||||
|
||||
desaturate_tool->config = g_object_new (GIMP_TYPE_DESATURATE_CONFIG, NULL);
|
||||
|
||||
*config = G_OBJECT (desaturate_tool->config);
|
||||
|
||||
g_signal_connect_object (desaturate_tool->config, "notify",
|
||||
G_CALLBACK (gimp_desaturate_tool_config_notify),
|
||||
G_OBJECT (desaturate_tool), 0);
|
||||
|
||||
gegl_node_set (node,
|
||||
"config", desaturate_tool->config,
|
||||
NULL);
|
||||
|
||||
return node;
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_desaturate_tool_map (GimpImageMapTool *image_map_tool)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/**********************/
|
||||
/* Desaturate dialog */
|
||||
/**********************/
|
||||
|
||||
static void
|
||||
gimp_desaturate_tool_dialog (GimpImageMapTool *image_map_tool)
|
||||
{
|
||||
GimpDesaturateTool *desaturate_tool = GIMP_DESATURATE_TOOL (image_map_tool);
|
||||
GtkWidget *frame;
|
||||
|
||||
/* The table containing sliders */
|
||||
frame = gimp_enum_radio_frame_new (GIMP_TYPE_DESATURATE_MODE,
|
||||
gtk_label_new (_("Choose shade of gray based on:")),
|
||||
G_CALLBACK (gimp_desaturate_tool_mode_changed),
|
||||
desaturate_tool,
|
||||
&desaturate_tool->button);
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (image_map_tool->main_vbox), frame,
|
||||
FALSE, FALSE, 0);
|
||||
gtk_widget_show (frame);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_desaturate_tool_config_notify (GObject *object,
|
||||
GParamSpec *pspec,
|
||||
GimpDesaturateTool *desaturate_tool)
|
||||
{
|
||||
GimpDesaturateConfig *config = GIMP_DESATURATE_CONFIG (object);
|
||||
|
||||
if (! desaturate_tool->button)
|
||||
return;
|
||||
|
||||
gimp_int_radio_group_set_active (GTK_RADIO_BUTTON (desaturate_tool->button),
|
||||
config->mode);
|
||||
|
||||
gimp_image_map_tool_preview (GIMP_IMAGE_MAP_TOOL (desaturate_tool));
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_desaturate_tool_mode_changed (GtkWidget *button,
|
||||
GimpDesaturateTool *desaturate_tool)
|
||||
{
|
||||
GimpDesaturateConfig *config = desaturate_tool->config;
|
||||
GimpDesaturateMode mode;
|
||||
|
||||
mode = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (button),
|
||||
"gimp-item-data"));
|
||||
|
||||
if (config->mode != mode)
|
||||
{
|
||||
g_object_set (config,
|
||||
"mode", mode,
|
||||
NULL);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,59 @@
|
|||
/* GIMP - The GNU Image Manipulation Program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef __GIMP_DESATURATE_TOOL_H__
|
||||
#define __GIMP_DESATURATE_TOOL_H__
|
||||
|
||||
|
||||
#include "gimpimagemaptool.h"
|
||||
|
||||
|
||||
#define GIMP_TYPE_DESATURATE_TOOL (gimp_desaturate_tool_get_type ())
|
||||
#define GIMP_DESATURATE_TOOL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_DESATURATE_TOOL, GimpDesaturateTool))
|
||||
#define GIMP_DESATURATE_TOOL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_DESATURATE_TOOL, GimpDesaturateToolClass))
|
||||
#define GIMP_IS_DESATURATE_TOOL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_DESATURATE_TOOL))
|
||||
#define GIMP_IS_DESATURATE_TOOL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_DESATURATE_TOOL))
|
||||
#define GIMP_DESATURATE_TOOL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_DESATURATE_TOOL, GimpDesaturateToolClass))
|
||||
|
||||
|
||||
typedef struct _GimpDesaturateTool GimpDesaturateTool;
|
||||
typedef struct _GimpDesaturateToolClass GimpDesaturateToolClass;
|
||||
|
||||
struct _GimpDesaturateTool
|
||||
{
|
||||
GimpImageMapTool parent_instance;
|
||||
|
||||
GimpDesaturateConfig *config;
|
||||
|
||||
/* dialog */
|
||||
GtkWidget *button;
|
||||
};
|
||||
|
||||
struct _GimpDesaturateToolClass
|
||||
{
|
||||
GimpImageMapToolClass parent_class;
|
||||
};
|
||||
|
||||
|
||||
void gimp_desaturate_tool_register (GimpToolRegisterCallback callback,
|
||||
gpointer data);
|
||||
|
||||
GType gimp_desaturate_tool_get_type (void) G_GNUC_CONST;
|
||||
|
||||
|
||||
#endif /* __GIMP_DESATURATE_TOOL_H__ */
|
|
@ -155,7 +155,6 @@
|
|||
#define GIMP_HELP_LAYER_RAISE_TO_TOP "gimp-layer-raise-to-top"
|
||||
#define GIMP_HELP_LAYER_LOWER "gimp-layer-lower"
|
||||
#define GIMP_HELP_LAYER_LOWER_TO_BOTTOM "gimp-layer-lower-to-bottom"
|
||||
#define GIMP_HELP_LAYER_DESATURATE "gimp-layer-desaturate"
|
||||
#define GIMP_HELP_LAYER_INVERT "gimp-layer-invert"
|
||||
#define GIMP_HELP_LAYER_WHITE_BALANCE "gimp-layer-white-balance"
|
||||
#define GIMP_HELP_LAYER_EQUALIZE "gimp-layer-equalize"
|
||||
|
@ -248,6 +247,7 @@
|
|||
#define GIMP_HELP_TOOL_CROP "gimp-tool-crop"
|
||||
#define GIMP_HELP_TOOL_CURVES "gimp-tool-curves"
|
||||
#define GIMP_HELP_TOOL_CURVES "gimp-tool-curves"
|
||||
#define GIMP_HELP_TOOL_DESATURATE "gimp-tool-desaturate"
|
||||
#define GIMP_HELP_TOOL_DODGE_BURN "gimp-tool-dodge-burn"
|
||||
#define GIMP_HELP_TOOL_ELLIPSE_SELECT "gimp-tool-ellipse-select"
|
||||
#define GIMP_HELP_TOOL_ERASER "gimp-tool-eraser"
|
||||
|
|
|
@ -275,6 +275,7 @@ G_BEGIN_DECLS
|
|||
#define GIMP_STOCK_GRADIENT GIMP_STOCK_TOOL_BLEND
|
||||
#define GIMP_STOCK_PALETTE GTK_STOCK_SELECT_COLOR
|
||||
#define GIMP_STOCK_PATTERN GIMP_STOCK_TOOL_BUCKET_FILL
|
||||
#define GIMP_STOCK_TOOL_DESATURATE GIMP_STOCK_CONVERT_GRAYSCALE
|
||||
|
||||
|
||||
void gimp_stock_init (void);
|
||||
|
|
|
@ -479,7 +479,7 @@
|
|||
<menuitem action="tools-curves" />
|
||||
<menuitem action="tools-posterize" />
|
||||
<separator />
|
||||
<menuitem action="drawable-desaturate" />
|
||||
<menuitem action="tools-desaturate" />
|
||||
<placeholder name="Invert">
|
||||
<menuitem action="drawable-invert" />
|
||||
</placeholder>
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
2008-05-21 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* POTFILES.in: updated.
|
||||
|
||||
2008-05-18 Wadim Dziedzic <wadimd@svn.gnome.org>
|
||||
|
||||
* pl.po: Updated polish translation
|
||||
|
|
|
@ -164,7 +164,6 @@ app/core/gimpunit.c
|
|||
app/dialogs/about-dialog.c
|
||||
app/dialogs/channel-options-dialog.c
|
||||
app/dialogs/convert-dialog.c
|
||||
app/dialogs/desaturate-dialog.c
|
||||
app/dialogs/dialogs-constructors.c
|
||||
app/dialogs/dialogs.c
|
||||
app/dialogs/fade-dialog.c
|
||||
|
@ -306,6 +305,7 @@ app/tools/gimpconvolvetool.c
|
|||
app/tools/gimpcropoptions.c
|
||||
app/tools/gimpcroptool.c
|
||||
app/tools/gimpcurvestool.c
|
||||
app/tools/gimpdesaturatetool.c
|
||||
app/tools/gimpdodgeburntool.c
|
||||
app/tools/gimpeditselectiontool.c
|
||||
app/tools/gimpellipseselecttool.c
|
||||
|
@ -320,6 +320,7 @@ app/tools/gimpgegltool.c
|
|||
app/tools/gimphealtool.c
|
||||
app/tools/gimphistogramoptions.c
|
||||
app/tools/gimphuesaturationtool.c
|
||||
app/tools/gimpimagemaptool-settings.c
|
||||
app/tools/gimpimagemaptool.c
|
||||
app/tools/gimpinkoptions-gui.c
|
||||
app/tools/gimpinktool.c
|
||||
|
|
Loading…
Reference in New Issue