changed to take a pointer as first argument as all PixelProcessor
2008-05-21 Sven Neumann <sven@gimp.org> * app/base/desaturate.[ch]: changed to take a pointer as first argument as all PixelProcessor functions. * app/core/gimpdrawable-desaturate.c: changed accordingly. * app/tools/gimpdesaturatetool.[ch]: added legacy code path. svn path=/trunk/; revision=25730
This commit is contained in:

committed by
Sven Neumann

parent
9519a1751d
commit
c19b2170ff
@ -1,3 +1,12 @@
|
|||||||
|
2008-05-21 Sven Neumann <sven@gimp.org>
|
||||||
|
|
||||||
|
* app/base/desaturate.[ch]: changed to take a pointer as first
|
||||||
|
argument as all PixelProcessor functions.
|
||||||
|
|
||||||
|
* app/core/gimpdrawable-desaturate.c: changed accordingly.
|
||||||
|
|
||||||
|
* app/tools/gimpdesaturatetool.[ch]: added legacy code path.
|
||||||
|
|
||||||
2008-05-21 Sven Neumann <sven@gimp.org>
|
2008-05-21 Sven Neumann <sven@gimp.org>
|
||||||
|
|
||||||
* app/base/Makefile.am
|
* app/base/Makefile.am
|
||||||
|
@ -40,14 +40,15 @@ static void desaturate_region_average (PixelRegion *srcPR,
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
desaturate_region (GimpDesaturateMode mode,
|
desaturate_region (GimpDesaturateMode *mode,
|
||||||
PixelRegion *srcPR,
|
PixelRegion *srcPR,
|
||||||
PixelRegion *destPR)
|
PixelRegion *destPR)
|
||||||
{
|
{
|
||||||
|
g_return_if_fail (mode != NULL);
|
||||||
g_return_if_fail (srcPR->bytes == destPR->bytes);
|
g_return_if_fail (srcPR->bytes == destPR->bytes);
|
||||||
g_return_if_fail (srcPR->bytes == 3 || srcPR->bytes == 4);
|
g_return_if_fail (srcPR->bytes == 3 || srcPR->bytes == 4);
|
||||||
|
|
||||||
switch (mode)
|
switch (*mode)
|
||||||
{
|
{
|
||||||
case GIMP_DESATURATE_LIGHTNESS:
|
case GIMP_DESATURATE_LIGHTNESS:
|
||||||
desaturate_region_lightness (srcPR, destPR, srcPR->bytes == 4);
|
desaturate_region_lightness (srcPR, destPR, srcPR->bytes == 4);
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
#define __DESATURATE_H__
|
#define __DESATURATE_H__
|
||||||
|
|
||||||
|
|
||||||
void desaturate_region (GimpDesaturateMode mode,
|
void desaturate_region (GimpDesaturateMode *mode,
|
||||||
PixelRegion *srcPR,
|
PixelRegion *srcPR,
|
||||||
PixelRegion *destPR);
|
PixelRegion *destPR);
|
||||||
|
|
||||||
|
@ -88,7 +88,7 @@ gimp_drawable_desaturate (GimpDrawable *drawable,
|
|||||||
x, y, width, height, TRUE);
|
x, y, width, height, TRUE);
|
||||||
|
|
||||||
pixel_regions_process_parallel ((PixelProcessorFunc) desaturate_region,
|
pixel_regions_process_parallel ((PixelProcessorFunc) desaturate_region,
|
||||||
GINT_TO_POINTER (mode),
|
&mode,
|
||||||
2, &srcPR, &destPR);
|
2, &srcPR, &destPR);
|
||||||
|
|
||||||
gimp_drawable_merge_shadow_tiles (drawable, TRUE, _("Desaturate"));
|
gimp_drawable_merge_shadow_tiles (drawable, TRUE, _("Desaturate"));
|
||||||
|
@ -27,8 +27,7 @@
|
|||||||
|
|
||||||
#include "tools-types.h"
|
#include "tools-types.h"
|
||||||
|
|
||||||
#include "base/gimplut.h"
|
#include "base/desaturate.h"
|
||||||
#include "base/lut-funcs.h"
|
|
||||||
|
|
||||||
#include "gegl/gimpdesaturateconfig.h"
|
#include "gegl/gimpdesaturateconfig.h"
|
||||||
|
|
||||||
@ -106,6 +105,10 @@ gimp_desaturate_tool_class_init (GimpDesaturateToolClass *klass)
|
|||||||
static void
|
static void
|
||||||
gimp_desaturate_tool_init (GimpDesaturateTool *desaturate_tool)
|
gimp_desaturate_tool_init (GimpDesaturateTool *desaturate_tool)
|
||||||
{
|
{
|
||||||
|
GimpImageMapTool *im_tool = GIMP_IMAGE_MAP_TOOL (desaturate_tool);
|
||||||
|
|
||||||
|
im_tool->apply_func = (GimpImageMapApplyFunc) desaturate_region;
|
||||||
|
im_tool->apply_data = &desaturate_tool->mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
@ -114,7 +117,7 @@ gimp_desaturate_tool_initialize (GimpTool *tool,
|
|||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
GimpDesaturateTool *desaturate_tool = GIMP_DESATURATE_TOOL (tool);
|
GimpDesaturateTool *desaturate_tool = GIMP_DESATURATE_TOOL (tool);
|
||||||
GimpDrawable *drawable;
|
GimpDrawable *drawable;
|
||||||
|
|
||||||
drawable = gimp_image_get_active_drawable (display->image);
|
drawable = gimp_image_get_active_drawable (display->image);
|
||||||
|
|
||||||
@ -145,7 +148,7 @@ gimp_desaturate_tool_get_operation (GimpImageMapTool *image_map_tool,
|
|||||||
GObject **config)
|
GObject **config)
|
||||||
{
|
{
|
||||||
GimpDesaturateTool *desaturate_tool = GIMP_DESATURATE_TOOL (image_map_tool);
|
GimpDesaturateTool *desaturate_tool = GIMP_DESATURATE_TOOL (image_map_tool);
|
||||||
GeglNode *node;
|
GeglNode *node;
|
||||||
|
|
||||||
node = g_object_new (GEGL_TYPE_NODE,
|
node = g_object_new (GEGL_TYPE_NODE,
|
||||||
"operation", "gimp-desaturate",
|
"operation", "gimp-desaturate",
|
||||||
@ -169,6 +172,9 @@ gimp_desaturate_tool_get_operation (GimpImageMapTool *image_map_tool,
|
|||||||
static void
|
static void
|
||||||
gimp_desaturate_tool_map (GimpImageMapTool *image_map_tool)
|
gimp_desaturate_tool_map (GimpImageMapTool *image_map_tool)
|
||||||
{
|
{
|
||||||
|
GimpDesaturateTool *desaturate_tool = GIMP_DESATURATE_TOOL (image_map_tool);
|
||||||
|
|
||||||
|
desaturate_tool->mode = desaturate_tool->config->mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -195,9 +201,9 @@ gimp_desaturate_tool_dialog (GimpImageMapTool *image_map_tool)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gimp_desaturate_tool_config_notify (GObject *object,
|
gimp_desaturate_tool_config_notify (GObject *object,
|
||||||
GParamSpec *pspec,
|
GParamSpec *pspec,
|
||||||
GimpDesaturateTool *desaturate_tool)
|
GimpDesaturateTool *desaturate_tool)
|
||||||
{
|
{
|
||||||
GimpDesaturateConfig *config = GIMP_DESATURATE_CONFIG (object);
|
GimpDesaturateConfig *config = GIMP_DESATURATE_CONFIG (object);
|
||||||
|
|
||||||
|
@ -39,6 +39,7 @@ struct _GimpDesaturateTool
|
|||||||
GimpImageMapTool parent_instance;
|
GimpImageMapTool parent_instance;
|
||||||
|
|
||||||
GimpDesaturateConfig *config;
|
GimpDesaturateConfig *config;
|
||||||
|
GimpDesaturateMode mode; /* only for legacy mode */
|
||||||
|
|
||||||
/* dialog */
|
/* dialog */
|
||||||
GtkWidget *button;
|
GtkWidget *button;
|
||||||
|
Reference in New Issue
Block a user