app/core/Makefile.am app/core/gimpdrawable-brightness-contrast.[ch]

2008-02-04  Michael Natterer  <mitch@gimp.org>

	* app/core/Makefile.am
	* app/core/gimpdrawable-brightness-contrast.[ch]
	* app/core/gimpdrawable-color-balance.[ch]
	* app/core/gimpdrawable-colorize.[ch]
	* app/core/gimpdrawable-curves.[ch]
	* app/core/gimpdrawable-hue-saturation.[ch]
	* app/core/gimpdrawable-posterize.[ch]
	* app/core/gimpdrawable-threshold.[ch]: new files containing all
	the code that was in pdb/color_cmds.c. Cleaned up and GEGL-enabled
	everyting.

	* tools/pdbgen/pdb/color.pdb: remove almost all code and simply call
	the new functions.

	* app/pdb/color_cmds.c: regenerated.


svn path=/trunk/; revision=24784
This commit is contained in:
Michael Natterer 2008-02-04 11:26:23 +00:00 committed by Michael Natterer
parent cdd49d57b7
commit 3a9f7d7c28
18 changed files with 1432 additions and 1019 deletions

View File

@ -1,3 +1,21 @@
2008-02-04 Michael Natterer <mitch@gimp.org>
* app/core/Makefile.am
* app/core/gimpdrawable-brightness-contrast.[ch]
* app/core/gimpdrawable-color-balance.[ch]
* app/core/gimpdrawable-colorize.[ch]
* app/core/gimpdrawable-curves.[ch]
* app/core/gimpdrawable-hue-saturation.[ch]
* app/core/gimpdrawable-posterize.[ch]
* app/core/gimpdrawable-threshold.[ch]: new files containing all
the code that was in pdb/color_cmds.c. Cleaned up and GEGL-enabled
everyting.
* tools/pdbgen/pdb/color.pdb: remove almost all code and simply call
the new functions.
* app/pdb/color_cmds.c: regenerated.
2008-02-04 Sven Neumann <sven@gimp.org>
* app/paint/gimpbrushcore.c (gimp_brush_core_create_bound_segs):

View File

@ -18,295 +18,309 @@ INCLUDES = \
noinst_LIBRARIES = libappcore.a
libappcore_a_sources = \
core-enums.h \
core-types.h \
gimp.c \
gimp.h \
gimp-contexts.c \
gimp-contexts.h \
gimp-documents.c \
gimp-documents.h \
gimp-edit.c \
gimp-edit.h \
gimp-gradients.c \
gimp-gradients.h \
gimp-gui.c \
gimp-gui.h \
gimp-modules.c \
gimp-modules.h \
gimp-parasites.c \
gimp-parasites.h \
gimp-templates.c \
gimp-templates.h \
gimp-transform-region.c \
gimp-transform-region.h \
gimp-transform-resize.c \
gimp-transform-resize.h \
gimp-transform-utils.c \
gimp-transform-utils.h \
gimp-units.c \
gimp-units.h \
gimp-user-install.c \
gimp-user-install.h \
gimp-utils.c \
gimp-utils.h \
gimparea.c \
gimparea.h \
gimpbrush.c \
gimpbrush.h \
gimpbrush-header.h \
gimpbrush-load.c \
gimpbrush-load.h \
gimpbrush-scale.c \
gimpbrush-scale.h \
gimpbrushclipboard.c \
gimpbrushclipboard.h \
gimpbrushgenerated.c \
gimpbrushgenerated.h \
gimpbrushgenerated-load.c \
gimpbrushgenerated-load.h \
gimpbrushgenerated-save.c \
gimpbrushgenerated-save.h \
gimpbrushpipe.c \
gimpbrushpipe.h \
gimpbrushpipe-load.c \
gimpbrushpipe-load.h \
gimpbuffer.c \
gimpbuffer.h \
gimpchannel.c \
gimpchannel.h \
gimpchannel-combine.c \
gimpchannel-combine.h \
gimpchannel-select.c \
gimpchannel-select.h \
gimpchannelpropundo.c \
gimpchannelpropundo.h \
gimpchannelundo.c \
gimpchannelundo.h \
gimpcontainer.c \
gimpcontainer.h \
gimpcontainer-filter.c \
gimpcontainer-filter.h \
gimpcontext.c \
gimpcontext.h \
gimpcoords.c \
gimpcoords.h \
gimpcurve.c \
gimpcurve.h \
gimpcurve-load.c \
gimpcurve-load.h \
gimpcurve-save.c \
gimpcurve-save.h \
gimpdashpattern.c \
gimpdashpattern.h \
gimpdata.c \
gimpdata.h \
gimpdatafactory.c \
gimpdatafactory.h \
gimpdocumentlist.c \
gimpdocumentlist.h \
gimpdrawable.c \
gimpdrawable.h \
gimpdrawable-blend.c \
gimpdrawable-blend.h \
gimpdrawable-bucket-fill.c \
gimpdrawable-bucket-fill.h \
gimpdrawable-combine.c \
gimpdrawable-combine.h \
gimpdrawable-convert.c \
gimpdrawable-convert.h \
gimpdrawable-desaturate.c \
gimpdrawable-desaturate.h \
gimpdrawable-equalize.c \
gimpdrawable-equalize.h \
gimpdrawable-foreground-extract.c\
gimpdrawable-foreground-extract.h\
gimpdrawable-histogram.c \
gimpdrawable-histogram.h \
gimpdrawable-invert.c \
gimpdrawable-invert.h \
gimpdrawable-levels.c \
gimpdrawable-levels.h \
gimpdrawable-offset.c \
gimpdrawable-offset.h \
gimpdrawable-operation.c \
gimpdrawable-operation.h \
gimpdrawable-preview.c \
gimpdrawable-preview.h \
gimpdrawable-stroke.c \
gimpdrawable-stroke.h \
gimpdrawable-transform.c \
gimpdrawable-transform.h \
gimpdrawablemodundo.c \
gimpdrawablemodundo.h \
gimpdrawableundo.c \
gimpdrawableundo.h \
gimpfloatingselundo.c \
gimpfloatingselundo.h \
gimpgradient.c \
gimpgradient.h \
gimpgradient-load.c \
gimpgradient-load.h \
gimpgradient-save.c \
gimpgradient-save.h \
gimpgrid.c \
gimpgrid.h \
gimpguide.c \
gimpguide.h \
gimpguideundo.c \
gimpguideundo.h \
gimpimage.c \
gimpimage.h \
gimpimage-arrange.c \
gimpimage-arrange.h \
gimpimage-colorhash.c \
gimpimage-colorhash.h \
gimpimage-colormap.c \
gimpimage-colormap.h \
gimpimage-contiguous-region.c \
gimpimage-contiguous-region.h \
gimpimage-convert.c \
gimpimage-convert.h \
gimpimage-convert-fsdither.h \
gimpimage-convert-data.h \
gimpimage-crop.c \
gimpimage-crop.h \
gimpimage-duplicate.c \
gimpimage-duplicate.h \
gimpimage-flip.c \
gimpimage-flip.h \
gimpimage-grid.h \
gimpimage-grid.c \
gimpimage-guides.c \
gimpimage-guides.h \
gimpimage-item-list.c \
gimpimage-item-list.h \
gimpimage-merge.c \
gimpimage-merge.h \
gimpimage-new.c \
gimpimage-new.h \
gimpimage-pick-color.c \
gimpimage-pick-color.h \
gimpimage-preview.c \
gimpimage-preview.h \
gimpimage-quick-mask.c \
gimpimage-quick-mask.h \
gimpimage-resize.c \
gimpimage-resize.h \
gimpimage-rotate.c \
gimpimage-rotate.h \
gimpimage-sample-points.c \
gimpimage-sample-points.h \
gimpimage-scale.c \
gimpimage-scale.h \
gimpimage-snap.c \
gimpimage-snap.h \
gimpimage-undo.c \
gimpimage-undo.h \
gimpimage-undo-push.c \
gimpimage-undo-push.h \
gimpimageundo.c \
gimpimageundo.h \
gimpimagefile.c \
gimpimagefile.h \
gimpimagemap.c \
gimpimagemap.h \
gimpitem.c \
gimpitem.h \
gimpitem-linked.c \
gimpitem-linked.h \
gimpitem-preview.c \
gimpitem-preview.h \
gimpitempropundo.c \
gimpitempropundo.h \
gimpitemundo.c \
gimpitemundo.h \
gimplayer.c \
gimplayer.h \
gimplayer-floating-sel.c \
gimplayer-floating-sel.h \
gimplayermask.c \
gimplayermask.h \
gimplayermaskpropundo.c \
gimplayermaskpropundo.h \
gimplayermaskundo.c \
gimplayermaskundo.h \
gimplayerpropundo.c \
gimplayerpropundo.h \
gimplayerundo.c \
gimplayerundo.h \
gimplist.c \
gimplist.h \
gimpmaskundo.c \
gimpmaskundo.h \
gimpobject.c \
gimpobject.h \
gimppaintinfo.c \
gimppaintinfo.h \
gimppattern.c \
gimppattern.h \
gimppattern-header.h \
gimppattern-load.c \
gimppattern-load.h \
gimppatternclipboard.c \
gimppatternclipboard.h \
gimppalette.c \
gimppalette.h \
gimppalette-import.c \
gimppalette-import.h \
gimppalette-load.c \
gimppalette-load.h \
gimppalette-save.c \
gimppalette-save.h \
gimpparamspecs.c \
gimpparamspecs.h \
gimpparamspecs-desc.c \
gimpparamspecs-desc.h \
gimpparasitelist.c \
gimpparasitelist.h \
gimppdbprogress.c \
gimppdbprogress.h \
gimppickable.c \
gimppickable.h \
gimppreviewcache.c \
gimppreviewcache.h \
gimpprogress.c \
gimpprogress.h \
gimpprojection.c \
gimpprojection.h \
gimpprojection-construct.c \
gimpprojection-construct.h \
gimpsamplepoint.c \
gimpsamplepoint.h \
gimpsamplepointundo.c \
gimpsamplepointundo.h \
gimpscanconvert.c \
gimpscanconvert.h \
gimpselection.c \
gimpselection.h \
gimpstrokedesc.c \
gimpstrokedesc.h \
gimpstrokeoptions.c \
gimpstrokeoptions.h \
gimpsubprogress.c \
gimpsubprogress.h \
gimptagged.c \
gimptagged.h \
gimptemplate.c \
gimptemplate.h \
gimptoolinfo.c \
gimptoolinfo.h \
gimptooloptions.c \
gimptooloptions.h \
gimptoolpresets.c \
gimptoolpresets.h \
gimpunit.c \
gimpunit.h \
gimpundo.c \
gimpundo.h \
gimpundostack.c \
gimpundostack.h \
gimpviewable.c \
core-enums.h \
core-types.h \
gimp.c \
gimp.h \
gimp-contexts.c \
gimp-contexts.h \
gimp-documents.c \
gimp-documents.h \
gimp-edit.c \
gimp-edit.h \
gimp-gradients.c \
gimp-gradients.h \
gimp-gui.c \
gimp-gui.h \
gimp-modules.c \
gimp-modules.h \
gimp-parasites.c \
gimp-parasites.h \
gimp-templates.c \
gimp-templates.h \
gimp-transform-region.c \
gimp-transform-region.h \
gimp-transform-resize.c \
gimp-transform-resize.h \
gimp-transform-utils.c \
gimp-transform-utils.h \
gimp-units.c \
gimp-units.h \
gimp-user-install.c \
gimp-user-install.h \
gimp-utils.c \
gimp-utils.h \
gimparea.c \
gimparea.h \
gimpbrush.c \
gimpbrush.h \
gimpbrush-header.h \
gimpbrush-load.c \
gimpbrush-load.h \
gimpbrush-scale.c \
gimpbrush-scale.h \
gimpbrushclipboard.c \
gimpbrushclipboard.h \
gimpbrushgenerated.c \
gimpbrushgenerated.h \
gimpbrushgenerated-load.c \
gimpbrushgenerated-load.h \
gimpbrushgenerated-save.c \
gimpbrushgenerated-save.h \
gimpbrushpipe.c \
gimpbrushpipe.h \
gimpbrushpipe-load.c \
gimpbrushpipe-load.h \
gimpbuffer.c \
gimpbuffer.h \
gimpchannel.c \
gimpchannel.h \
gimpchannel-combine.c \
gimpchannel-combine.h \
gimpchannel-select.c \
gimpchannel-select.h \
gimpchannelpropundo.c \
gimpchannelpropundo.h \
gimpchannelundo.c \
gimpchannelundo.h \
gimpcontainer.c \
gimpcontainer.h \
gimpcontainer-filter.c \
gimpcontainer-filter.h \
gimpcontext.c \
gimpcontext.h \
gimpcoords.c \
gimpcoords.h \
gimpcurve.c \
gimpcurve.h \
gimpcurve-load.c \
gimpcurve-load.h \
gimpcurve-save.c \
gimpcurve-save.h \
gimpdashpattern.c \
gimpdashpattern.h \
gimpdata.c \
gimpdata.h \
gimpdatafactory.c \
gimpdatafactory.h \
gimpdocumentlist.c \
gimpdocumentlist.h \
gimpdrawable.c \
gimpdrawable.h \
gimpdrawable-blend.c \
gimpdrawable-blend.h \
gimpdrawable-brightness-contrast.c \
gimpdrawable-brightness-contrast.h \
gimpdrawable-bucket-fill.c \
gimpdrawable-bucket-fill.h \
gimpdrawable-color-balance.c \
gimpdrawable-color-balance.h \
gimpdrawable-colorize.c \
gimpdrawable-colorize.h \
gimpdrawable-combine.c \
gimpdrawable-combine.h \
gimpdrawable-convert.c \
gimpdrawable-convert.h \
gimpdrawable-curves.c \
gimpdrawable-curves.h \
gimpdrawable-desaturate.c \
gimpdrawable-desaturate.h \
gimpdrawable-equalize.c \
gimpdrawable-equalize.h \
gimpdrawable-foreground-extract.c \
gimpdrawable-foreground-extract.h \
gimpdrawable-histogram.c \
gimpdrawable-histogram.h \
gimpdrawable-hue-saturation.c \
gimpdrawable-hue-saturation.h \
gimpdrawable-invert.c \
gimpdrawable-invert.h \
gimpdrawable-levels.c \
gimpdrawable-levels.h \
gimpdrawable-offset.c \
gimpdrawable-offset.h \
gimpdrawable-operation.c \
gimpdrawable-operation.h \
gimpdrawable-posterize.c \
gimpdrawable-posterize.h \
gimpdrawable-preview.c \
gimpdrawable-preview.h \
gimpdrawable-stroke.c \
gimpdrawable-stroke.h \
gimpdrawable-threshold.c \
gimpdrawable-threshold.h \
gimpdrawable-transform.c \
gimpdrawable-transform.h \
gimpdrawablemodundo.c \
gimpdrawablemodundo.h \
gimpdrawableundo.c \
gimpdrawableundo.h \
gimpfloatingselundo.c \
gimpfloatingselundo.h \
gimpgradient.c \
gimpgradient.h \
gimpgradient-load.c \
gimpgradient-load.h \
gimpgradient-save.c \
gimpgradient-save.h \
gimpgrid.c \
gimpgrid.h \
gimpguide.c \
gimpguide.h \
gimpguideundo.c \
gimpguideundo.h \
gimpimage.c \
gimpimage.h \
gimpimage-arrange.c \
gimpimage-arrange.h \
gimpimage-colorhash.c \
gimpimage-colorhash.h \
gimpimage-colormap.c \
gimpimage-colormap.h \
gimpimage-contiguous-region.c \
gimpimage-contiguous-region.h \
gimpimage-convert.c \
gimpimage-convert.h \
gimpimage-convert-fsdither.h \
gimpimage-convert-data.h \
gimpimage-crop.c \
gimpimage-crop.h \
gimpimage-duplicate.c \
gimpimage-duplicate.h \
gimpimage-flip.c \
gimpimage-flip.h \
gimpimage-grid.h \
gimpimage-grid.c \
gimpimage-guides.c \
gimpimage-guides.h \
gimpimage-item-list.c \
gimpimage-item-list.h \
gimpimage-merge.c \
gimpimage-merge.h \
gimpimage-new.c \
gimpimage-new.h \
gimpimage-pick-color.c \
gimpimage-pick-color.h \
gimpimage-preview.c \
gimpimage-preview.h \
gimpimage-quick-mask.c \
gimpimage-quick-mask.h \
gimpimage-resize.c \
gimpimage-resize.h \
gimpimage-rotate.c \
gimpimage-rotate.h \
gimpimage-sample-points.c \
gimpimage-sample-points.h \
gimpimage-scale.c \
gimpimage-scale.h \
gimpimage-snap.c \
gimpimage-snap.h \
gimpimage-undo.c \
gimpimage-undo.h \
gimpimage-undo-push.c \
gimpimage-undo-push.h \
gimpimageundo.c \
gimpimageundo.h \
gimpimagefile.c \
gimpimagefile.h \
gimpimagemap.c \
gimpimagemap.h \
gimpitem.c \
gimpitem.h \
gimpitem-linked.c \
gimpitem-linked.h \
gimpitem-preview.c \
gimpitem-preview.h \
gimpitempropundo.c \
gimpitempropundo.h \
gimpitemundo.c \
gimpitemundo.h \
gimplayer.c \
gimplayer.h \
gimplayer-floating-sel.c \
gimplayer-floating-sel.h \
gimplayermask.c \
gimplayermask.h \
gimplayermaskpropundo.c \
gimplayermaskpropundo.h \
gimplayermaskundo.c \
gimplayermaskundo.h \
gimplayerpropundo.c \
gimplayerpropundo.h \
gimplayerundo.c \
gimplayerundo.h \
gimplist.c \
gimplist.h \
gimpmaskundo.c \
gimpmaskundo.h \
gimpobject.c \
gimpobject.h \
gimppaintinfo.c \
gimppaintinfo.h \
gimppattern.c \
gimppattern.h \
gimppattern-header.h \
gimppattern-load.c \
gimppattern-load.h \
gimppatternclipboard.c \
gimppatternclipboard.h \
gimppalette.c \
gimppalette.h \
gimppalette-import.c \
gimppalette-import.h \
gimppalette-load.c \
gimppalette-load.h \
gimppalette-save.c \
gimppalette-save.h \
gimpparamspecs.c \
gimpparamspecs.h \
gimpparamspecs-desc.c \
gimpparamspecs-desc.h \
gimpparasitelist.c \
gimpparasitelist.h \
gimppdbprogress.c \
gimppdbprogress.h \
gimppickable.c \
gimppickable.h \
gimppreviewcache.c \
gimppreviewcache.h \
gimpprogress.c \
gimpprogress.h \
gimpprojection.c \
gimpprojection.h \
gimpprojection-construct.c \
gimpprojection-construct.h \
gimpsamplepoint.c \
gimpsamplepoint.h \
gimpsamplepointundo.c \
gimpsamplepointundo.h \
gimpscanconvert.c \
gimpscanconvert.h \
gimpselection.c \
gimpselection.h \
gimpstrokedesc.c \
gimpstrokedesc.h \
gimpstrokeoptions.c \
gimpstrokeoptions.h \
gimpsubprogress.c \
gimpsubprogress.h \
gimptagged.c \
gimptagged.h \
gimptemplate.c \
gimptemplate.h \
gimptoolinfo.c \
gimptoolinfo.h \
gimptooloptions.c \
gimptooloptions.h \
gimptoolpresets.c \
gimptoolpresets.h \
gimpunit.c \
gimpunit.h \
gimpundo.c \
gimpundo.h \
gimpundostack.c \
gimpundostack.h \
gimpviewable.c \
gimpviewable.h
libappcore_a_built_sources = \

View File

@ -0,0 +1,108 @@
/* 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 "core-types.h"
#include "base/gimplut.h"
#include "base/lut-funcs.h"
#include "base/pixel-processor.h"
#include "base/pixel-region.h"
#include "gegl/gimpbrightnesscontrastconfig.h"
/* temp */
#include "gimp.h"
#include "gimpimage.h"
#include "gimpdrawable.h"
#include "gimpdrawable-brightness-contrast.h"
#include "gimpdrawable-operation.h"
#include "gimp-intl.h"
/* public functions */
void
gimp_drawable_brightness_contrast (GimpDrawable *drawable,
GimpProgress *progress,
gint brightness,
gint contrast)
{
GimpBrightnessContrastConfig *config;
g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
g_return_if_fail (! gimp_drawable_is_indexed (drawable));
g_return_if_fail (gimp_item_is_attached (GIMP_ITEM (drawable)));
config = g_object_new (GIMP_TYPE_BRIGHTNESS_CONTRAST_CONFIG,
"brightness", brightness / 127.0,
"contrast", contrast / 127.0,
NULL);
if (gimp_use_gegl (GIMP_ITEM (drawable)->image->gimp))
{
GeglNode *node;
node = g_object_new (GEGL_TYPE_NODE,
"operation", "brightness-contrast",
NULL);
gimp_brightness_contrast_config_set_node (config, node);
gimp_drawable_apply_operation (drawable, node, TRUE,
progress, _("Brightness_Contrast"));
g_object_unref (node);
}
else
{
gint x, y, width, height;
/* The application should occur only within selection bounds */
if (gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
{
GimpLut *lut;
PixelRegion srcPR, destPR;
lut = brightness_contrast_lut_new (config->brightness / 2.0,
config->contrast,
gimp_drawable_bytes (drawable));
pixel_region_init (&srcPR, gimp_drawable_get_tiles (drawable),
x, y, width, height, FALSE);
pixel_region_init (&destPR, gimp_drawable_get_shadow_tiles (drawable),
x, y, width, height, TRUE);
pixel_regions_process_parallel ((PixelProcessorFunc)
gimp_lut_process,
lut, 2, &srcPR, &destPR);
gimp_lut_free (lut);
gimp_drawable_merge_shadow (drawable, TRUE,
_("Brightness-Contrast"));
gimp_drawable_update (drawable, x, y, width, height);
}
}
g_object_unref (config);
}

View File

@ -0,0 +1,29 @@
/* 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_DRAWABLE_BRIGHTNESS_CONTRAST_H__
#define __GIMP_DRAWABLE_BRIGHTNESS_CONTRAST_H__
void gimp_drawable_brightness_contrast (GimpDrawable *drawable,
GimpProgress *progress,
gint brightness,
gint contrast);
#endif /* __GIMP_DRAWABLE_BRIGHTNESS_CONTRAST_H__ */

View File

@ -0,0 +1,112 @@
/* 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 "core-types.h"
#include "base/color-balance.h"
#include "base/pixel-processor.h"
#include "base/pixel-region.h"
#include "gegl/gimpcolorbalanceconfig.h"
/* temp */
#include "gimp.h"
#include "gimpimage.h"
#include "gimpdrawable.h"
#include "gimpdrawable-color-balance.h"
#include "gimpdrawable-operation.h"
#include "gimp-intl.h"
/* public functions */
void
gimp_drawable_color_balance (GimpDrawable *drawable,
GimpProgress *progress,
GimpTransferMode range,
gdouble cyan_red,
gdouble magenta_green,
gdouble yellow_blue,
gboolean preserve_luminosity)
{
GimpColorBalanceConfig *config;
g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
g_return_if_fail (! gimp_drawable_is_indexed (drawable));
g_return_if_fail (gimp_item_is_attached (GIMP_ITEM (drawable)));
config = g_object_new (GIMP_TYPE_COLOR_BALANCE_CONFIG,
"range", range,
"preserve-luminosity", preserve_luminosity,
NULL);
g_object_set (config,
"cyan-red", cyan_red / 100.0,
"magenta-green", magenta_green / 100.0,
"yellow-blue", yellow_blue / 100.0,
NULL);
if (gimp_use_gegl (GIMP_ITEM (drawable)->image->gimp))
{
GeglNode *node;
node = g_object_new (GEGL_TYPE_NODE,
"operation", "gimp-color-balance",
NULL);
gegl_node_set (node,
"config", config,
NULL);
gimp_drawable_apply_operation (drawable, node, TRUE,
progress, _("Color Balance"));
g_object_unref (node);
}
else
{
gint x, y, width, height;
/* The application should occur only within selection bounds */
if (gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
{
ColorBalance cruft;
PixelRegion srcPR, destPR;
gimp_color_balance_config_to_cruft (config, &cruft);
pixel_region_init (&srcPR, gimp_drawable_get_tiles (drawable),
x, y, width, height, FALSE);
pixel_region_init (&destPR, gimp_drawable_get_shadow_tiles (drawable),
x, y, width, height, TRUE);
pixel_regions_process_parallel ((PixelProcessorFunc) color_balance,
&cruft, 2, &srcPR, &destPR);
gimp_drawable_merge_shadow (drawable, TRUE, _("Color Balance"));
gimp_drawable_update (drawable, x, y, width, height);
}
}
g_object_unref (config);
}

View File

@ -0,0 +1,32 @@
/* 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_DRAWABLE_COLOR_BALANCE_H__
#define __GIMP_DRAWABLE_COLOR_BALANCE_H__
void gimp_drawable_color_balance (GimpDrawable *drawable,
GimpProgress *progress,
GimpTransferMode range,
gdouble cyan_red,
gdouble magenta_green,
gdouble yellow_blue,
gboolean preserve_luminosity);
#endif /* __GIMP_DRAWABLE_COLOR_BALANCE_H__ */

View File

@ -0,0 +1,105 @@
/* 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 "core-types.h"
#include "base/colorize.h"
#include "base/pixel-processor.h"
#include "base/pixel-region.h"
#include "gegl/gimpcolorizeconfig.h"
/* temp */
#include "gimp.h"
#include "gimpimage.h"
#include "gimpdrawable.h"
#include "gimpdrawable-operation.h"
#include "gimpdrawable-colorize.h"
#include "gimp-intl.h"
/* public functions */
void
gimp_drawable_colorize (GimpDrawable *drawable,
GimpProgress *progress,
gdouble hue,
gdouble saturation,
gdouble lightness)
{
GimpColorizeConfig *config;
g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
g_return_if_fail (! gimp_drawable_is_indexed (drawable));
g_return_if_fail (gimp_item_is_attached (GIMP_ITEM (drawable)));
config = g_object_new (GIMP_TYPE_COLORIZE_CONFIG,
"hue", hue / 360.0,
"saturation", saturation / 100.0,
"lightness", lightness / 100.0,
NULL);
if (gimp_use_gegl (GIMP_ITEM (drawable)->image->gimp))
{
GeglNode *node;
node = g_object_new (GEGL_TYPE_NODE,
"operation", "gimp-colorize",
NULL);
gegl_node_set (node,
"config", config,
NULL);
gimp_drawable_apply_operation (drawable, node, TRUE,
progress, _("Colorize"));
g_object_unref (node);
}
else
{
gint x, y, width, height;
/* The application should occur only within selection bounds */
if (gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
{
Colorize cruft;
PixelRegion srcPR, destPR;
gimp_colorize_config_to_cruft (config, &cruft);
pixel_region_init (&srcPR, gimp_drawable_get_tiles (drawable),
x, y, width, height, FALSE);
pixel_region_init (&destPR, gimp_drawable_get_shadow_tiles (drawable),
x, y, width, height, TRUE);
pixel_regions_process_parallel ((PixelProcessorFunc) colorize,
&cruft, 2, &srcPR, &destPR);
gimp_drawable_merge_shadow (drawable, TRUE, _("Colorize"));
gimp_drawable_update (drawable, x, y, width, height);
}
}
g_object_unref (config);
}

View File

@ -0,0 +1,30 @@
/* 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_DRAWABLE_COLORIZE_H__
#define __GIMP_DRAWABLE_COLORIZE_H__
void gimp_drawable_colorize (GimpDrawable *drawable,
GimpProgress *progress,
gdouble hue,
gdouble saturation,
gdouble lightness);
#endif /* __GIMP_DRAWABLE_COLORIZE_H__ */

View File

@ -0,0 +1,200 @@
/* 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 "core-types.h"
#include "base/curves.h"
#include "base/gimplut.h"
#include "base/pixel-processor.h"
#include "base/pixel-region.h"
#include "gegl/gimpcurvesconfig.h"
/* temp */
#include "gimp.h"
#include "gimpimage.h"
#include "gimpcurve.h"
#include "gimpdrawable.h"
#include "gimpdrawable-curves.h"
#include "gimpdrawable-operation.h"
#include "gimp-intl.h"
/* local function prototypes */
static void gimp_drawable_curves (GimpDrawable *drawable,
GimpProgress *progress,
GimpCurvesConfig *config);
/* public functions */
void
gimp_drawable_curves_spline (GimpDrawable *drawable,
GimpProgress *progress,
gint32 channel,
const guint8 *points,
gint n_points)
{
GimpCurvesConfig *config;
GimpCurve *curve;
gint i;
g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
g_return_if_fail (! gimp_drawable_is_indexed (drawable));
g_return_if_fail (gimp_item_is_attached (GIMP_ITEM (drawable)));
g_return_if_fail (channel >= GIMP_HISTOGRAM_VALUE &&
channel <= GIMP_HISTOGRAM_ALPHA);
if (channel == GIMP_HISTOGRAM_ALPHA)
g_return_if_fail (gimp_drawable_has_alpha (drawable));
if (gimp_drawable_is_gray (drawable))
g_return_if_fail (channel == GIMP_HISTOGRAM_VALUE ||
channel == GIMP_HISTOGRAM_ALPHA);
config = g_object_new (GIMP_TYPE_CURVES_CONFIG, NULL);
curve = config->curve[channel];
gimp_data_freeze (GIMP_DATA (curve));
/* unset the last point */
gimp_curve_set_point (curve, GIMP_CURVE_NUM_POINTS - 1, -1, -1);
for (i = 0; i < n_points / 2; i++)
gimp_curve_set_point (curve, i,
points[i * 2],
points[i * 2 + 1]);
gimp_data_thaw (GIMP_DATA (curve));
gimp_drawable_curves (drawable, progress, config);
g_object_unref (config);
}
void
gimp_drawable_curves_explicit (GimpDrawable *drawable,
GimpProgress *progress,
gint32 channel,
const guint8 *points,
gint n_points)
{
GimpCurvesConfig *config;
GimpCurve *curve;
gint i;
g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
g_return_if_fail (! gimp_drawable_is_indexed (drawable));
g_return_if_fail (gimp_item_is_attached (GIMP_ITEM (drawable)));
g_return_if_fail (channel >= GIMP_HISTOGRAM_VALUE &&
channel <= GIMP_HISTOGRAM_ALPHA);
if (channel == GIMP_HISTOGRAM_ALPHA)
g_return_if_fail (gimp_drawable_has_alpha (drawable));
if (gimp_drawable_is_gray (drawable))
g_return_if_fail (channel == GIMP_HISTOGRAM_VALUE ||
channel == GIMP_HISTOGRAM_ALPHA);
config = g_object_new (GIMP_TYPE_CURVES_CONFIG, NULL);
curve = config->curve[channel];
gimp_data_freeze (GIMP_DATA (curve));
gimp_curve_set_curve_type (curve, GIMP_CURVE_SMOOTH);
for (i = 0; i < 256; i++)
gimp_curve_set_curve (curve, i, points[i]);
gimp_data_thaw (GIMP_DATA (curve));
gimp_drawable_curves (drawable, progress, config);
g_object_unref (config);
}
/* private functions */
static void
gimp_drawable_curves (GimpDrawable *drawable,
GimpProgress *progress,
GimpCurvesConfig *config)
{
if (gimp_use_gegl (GIMP_ITEM (drawable)->image->gimp))
{
GeglNode *node;
node = g_object_new (GEGL_TYPE_NODE,
"operation", "gimp-curves",
NULL);
gegl_node_set (node,
"config", config,
NULL);
gimp_drawable_apply_operation (drawable, node, TRUE,
progress, _("Curves"));
g_object_unref (node);
}
else
{
gint x, y, width, height;
/* The application should occur only within selection bounds */
if (gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
{
Curves cruft;
PixelRegion srcPR, destPR;
GimpLut *lut;
lut = gimp_lut_new ();
gimp_curves_config_to_cruft (config, &cruft,
gimp_drawable_is_rgb (drawable));
gimp_lut_setup (lut,
(GimpLutFunc) curves_lut_func,
&cruft,
gimp_drawable_bytes (drawable));
pixel_region_init (&srcPR, gimp_drawable_get_tiles (drawable),
x, y, width, height, FALSE);
pixel_region_init (&destPR, gimp_drawable_get_shadow_tiles (drawable),
x, y, width, height, TRUE);
pixel_regions_process_parallel ((PixelProcessorFunc)
gimp_lut_process,
lut, 2, &srcPR, &destPR);
gimp_lut_free (lut);
gimp_drawable_merge_shadow (drawable, TRUE, _("Curves"));
gimp_drawable_update (drawable, x, y, width, height);
}
}
}

View File

@ -0,0 +1,35 @@
/* 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_DRAWABLE_CURVES_H__
#define __GIMP_DRAWABLE_CURVES_H__
void gimp_drawable_curves_spline (GimpDrawable *drawable,
GimpProgress *progress,
gint32 channel,
const guint8 *points,
gint n_points);
void gimp_drawable_curves_explicit (GimpDrawable *drawable,
GimpProgress *progress,
gint32 channel,
const guint8 *points,
gint n_points);
#endif /* __GIMP_DRAWABLE_CURVES_H__ */

View File

@ -0,0 +1,110 @@
/* 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 "core-types.h"
#include "base/hue-saturation.h"
#include "base/pixel-processor.h"
#include "base/pixel-region.h"
#include "gegl/gimphuesaturationconfig.h"
/* temp */
#include "gimp.h"
#include "gimpimage.h"
#include "gimpdrawable.h"
#include "gimpdrawable-operation.h"
#include "gimpdrawable-hue-saturation.h"
#include "gimp-intl.h"
/* public functions */
void
gimp_drawable_hue_saturation (GimpDrawable *drawable,
GimpProgress *progress,
GimpHueRange range,
gdouble hue,
gdouble saturation,
gdouble lightness)
{
GimpHueSaturationConfig *config;
g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
g_return_if_fail (! gimp_drawable_is_indexed (drawable));
g_return_if_fail (gimp_item_is_attached (GIMP_ITEM (drawable)));
config = g_object_new (GIMP_TYPE_HUE_SATURATION_CONFIG,
"range", range,
NULL);
g_object_set (config,
"hue", hue / 100.0,
"saturation", saturation / 100.0,
"lightness", lightness / 100.0,
NULL);
if (gimp_use_gegl (GIMP_ITEM (drawable)->image->gimp))
{
GeglNode *node;
node = g_object_new (GEGL_TYPE_NODE,
"operation", "gimp-hue-saturation",
NULL);
gegl_node_set (node,
"config", config,
NULL);
gimp_drawable_apply_operation (drawable, node, TRUE,
progress, _("Hue-Saturation"));
g_object_unref (node);
}
else
{
gint x, y, width, height;
/* The application should occur only within selection bounds */
if (gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
{
HueSaturation cruft;
PixelRegion srcPR, destPR;
gimp_hue_saturation_config_to_cruft (config, &cruft);
pixel_region_init (&srcPR, gimp_drawable_get_tiles (drawable),
x, y, width, height, FALSE);
pixel_region_init (&destPR, gimp_drawable_get_shadow_tiles (drawable),
x, y, width, height, TRUE);
pixel_regions_process_parallel ((PixelProcessorFunc) hue_saturation,
&cruft, 2, &srcPR, &destPR);
gimp_drawable_merge_shadow (drawable, TRUE, _("Hue_Saturation"));
gimp_drawable_update (drawable, x, y, width, height);
}
}
g_object_unref (config);
}

View File

@ -0,0 +1,31 @@
/* 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_DRAWABLE_HUE_SATURATION_H__
#define __GIMP_DRAWABLE_HUE_SATURATION_H__
void gimp_drawable_hue_saturation (GimpDrawable *drawable,
GimpProgress *progress,
GimpHueRange range,
gdouble hue,
gdouble saturation,
gdouble lightness);
#endif /* __GIMP_DRAWABLE_HUE_SATURATION_H__ */

View File

@ -0,0 +1,105 @@
/* 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 "core-types.h"
#include "base/gimplut.h"
#include "base/lut-funcs.h"
#include "base/pixel-processor.h"
#include "base/pixel-region.h"
#include "gegl/gimpposterizeconfig.h"
/* temp */
#include "gimp.h"
#include "gimpimage.h"
#include "gimpdrawable.h"
#include "gimpdrawable-operation.h"
#include "gimpdrawable-posterize.h"
#include "gimp-intl.h"
/* public functions */
void
gimp_drawable_posterize (GimpDrawable *drawable,
GimpProgress *progress,
gint levels)
{
GimpPosterizeConfig *config;
g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
g_return_if_fail (! gimp_drawable_is_indexed (drawable));
g_return_if_fail (gimp_item_is_attached (GIMP_ITEM (drawable)));
config = g_object_new (GIMP_TYPE_POSTERIZE_CONFIG,
"levels", levels,
NULL);
if (gimp_use_gegl (GIMP_ITEM (drawable)->image->gimp))
{
GeglNode *node;
node = g_object_new (GEGL_TYPE_NODE,
"operation", "gimp-posterize",
NULL);
gegl_node_set (node,
"config", config,
NULL);
gimp_drawable_apply_operation (drawable, node, TRUE,
progress, _("Posterize"));
g_object_unref (node);
}
else
{
gint x, y, width, height;
/* The application should occur only within selection bounds */
if (gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
{
GimpLut *lut;
PixelRegion srcPR, destPR;
lut = posterize_lut_new (config->levels,
gimp_drawable_bytes (drawable));
pixel_region_init (&srcPR, gimp_drawable_get_tiles (drawable),
x, y, width, height, FALSE);
pixel_region_init (&destPR, gimp_drawable_get_shadow_tiles (drawable),
x, y, width, height, TRUE);
pixel_regions_process_parallel ((PixelProcessorFunc) gimp_lut_process,
lut, 2, &srcPR, &destPR);
gimp_lut_free (lut);
gimp_drawable_merge_shadow (drawable, TRUE, _("Posterize"));
gimp_drawable_update (drawable, x, y, width, height);
}
}
g_object_unref (config);
}

View File

@ -0,0 +1,28 @@
/* 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_DRAWABLE_POSTERIZE_H__
#define __GIMP_DRAWABLE_POSTERIZE_H__
void gimp_drawable_posterize (GimpDrawable *drawable,
GimpProgress *progress,
gint levels);
#endif /* __GIMP_DRAWABLE_POSTERIZE_H__ */

View File

@ -0,0 +1,104 @@
/* 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 "core-types.h"
#include "base/pixel-processor.h"
#include "base/pixel-region.h"
#include "base/threshold.h"
#include "gegl/gimpthresholdconfig.h"
/* temp */
#include "gimp.h"
#include "gimpimage.h"
#include "gimpdrawable.h"
#include "gimpdrawable-operation.h"
#include "gimpdrawable-threshold.h"
#include "gimp-intl.h"
/* public functions */
void
gimp_drawable_threshold (GimpDrawable *drawable,
GimpProgress *progress,
gint low,
gint high)
{
GimpThresholdConfig *config;
g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
g_return_if_fail (! gimp_drawable_is_indexed (drawable));
g_return_if_fail (gimp_item_is_attached (GIMP_ITEM (drawable)));
config = g_object_new (GIMP_TYPE_THRESHOLD_CONFIG,
"low", low / 255.0,
"high", high / 255.0,
NULL);
if (gimp_use_gegl (GIMP_ITEM (drawable)->image->gimp))
{
GeglNode *node;
node = g_object_new (GEGL_TYPE_NODE,
"operation", "gimp-threshold",
NULL);
gegl_node_set (node,
"config", config,
NULL);
gimp_drawable_apply_operation (drawable, node, TRUE,
progress, _("Threshold"));
g_object_unref (node);
}
else
{
gint x, y, width, height;
/* The application should occur only within selection bounds */
if (gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
{
Threshold cruft;
PixelRegion srcPR, destPR;
gimp_threshold_config_to_cruft (config, &cruft,
gimp_drawable_is_rgb (drawable));
pixel_region_init (&srcPR, gimp_drawable_get_tiles (drawable),
x, y, width, height, FALSE);
pixel_region_init (&destPR, gimp_drawable_get_shadow_tiles (drawable),
x, y, width, height, TRUE);
pixel_regions_process_parallel ((PixelProcessorFunc) threshold,
&cruft, 2, &srcPR, &destPR);
gimp_drawable_merge_shadow (drawable, TRUE, _("Threshold"));
gimp_drawable_update (drawable, x, y, width, height);
}
}
g_object_unref (config);
}

View File

@ -0,0 +1,29 @@
/* 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_DRAWABLE_THRESHOLD_H__
#define __GIMP_DRAWABLE_THRESHOLD_H__
void gimp_drawable_threshold (GimpDrawable *drawable,
GimpProgress *progress,
gint low,
gint high);
#endif /* __GIMP_DRAWABLE_THRESHOLD_H__ */

View File

@ -29,26 +29,20 @@
#include "gimpprocedure.h"
#include "core/gimpparamspecs.h"
#include "base/color-balance.h"
#include "base/colorize.h"
#include "base/curves.h"
#include "base/gimphistogram.h"
#include "base/gimplut.h"
#include "base/hue-saturation.h"
#include "base/lut-funcs.h"
#include "base/pixel-processor.h"
#include "base/pixel-region.h"
#include "base/threshold.h"
#include "core/gimp.h"
#include "core/gimpcurve.h"
#include "core/gimpdrawable-brightness-contrast.h"
#include "core/gimpdrawable-color-balance.h"
#include "core/gimpdrawable-colorize.h"
#include "core/gimpdrawable-curves.h"
#include "core/gimpdrawable-desaturate.h"
#include "core/gimpdrawable-equalize.h"
#include "core/gimpdrawable-histogram.h"
#include "core/gimpdrawable-hue-saturation.h"
#include "core/gimpdrawable-invert.h"
#include "core/gimpdrawable-levels.h"
#include "core/gimpdrawable-operation.h"
#include "core/gimpdrawable-posterize.h"
#include "core/gimpdrawable-threshold.h"
#include "core/gimpdrawable.h"
#include "core/gimpimage.h"
#include "gimp-intl.h"
#include "internal_procs.h"
@ -78,55 +72,8 @@ brightness_contrast_invoker (GimpProcedure *procedure,
success = FALSE;
if (success)
{
if (gimp_use_gegl (gimp))
{
GeglNode *node = g_object_new (GEGL_TYPE_NODE,
"operation", "brightness-contrast",
NULL);
gegl_node_set (node,
"brightness", brightness / 127.0,
"contrast", (contrast < 0 ?
(contrast + 127.0) / 127.0 :
contrast * 4.0 / 127.0 + 1),
NULL);
gimp_drawable_apply_operation (drawable, node, TRUE,
progress, _("Brightness-Contrast"));
g_object_unref (node);
}
else
{
gint x, y, width, height;
/* The application should occur only within selection bounds */
if (gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
{
GimpLut *lut;
PixelRegion srcPR, destPR;
lut = brightness_contrast_lut_new (brightness / 255.0,
contrast / 127.0,
gimp_drawable_bytes (drawable));
pixel_region_init (&srcPR, gimp_drawable_get_tiles (drawable),
x, y, width, height, FALSE);
pixel_region_init (&destPR, gimp_drawable_get_shadow_tiles (drawable),
x, y, width, height, TRUE);
pixel_regions_process_parallel ((PixelProcessorFunc)
gimp_lut_process,
lut, 2, &srcPR, &destPR);
gimp_lut_free (lut);
gimp_drawable_merge_shadow (drawable, TRUE, _("Brightness-Contrast"));
gimp_drawable_update (drawable, x, y, width, height);
}
}
}
gimp_drawable_brightness_contrast (drawable, progress,
brightness, contrast);
}
return gimp_procedure_get_return_values (procedure, success);
@ -252,50 +199,7 @@ posterize_invoker (GimpProcedure *procedure,
success = FALSE;
if (success)
{
if (gimp_use_gegl (gimp))
{
GeglNode *node = g_object_new (GEGL_TYPE_NODE,
"operation", "gimp-posterize",
NULL);
gegl_node_set (node,
"levels", levels,
NULL);
gimp_drawable_apply_operation (drawable, node, TRUE,
progress, _("Levels"));
g_object_unref (node);
}
else
{
gint x, y, width, height;
/* The application should occur only within selection bounds */
if (gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
{
GimpLut *lut;
PixelRegion srcPR, destPR;
lut = posterize_lut_new (levels, gimp_drawable_bytes (drawable));
pixel_region_init (&srcPR, gimp_drawable_get_tiles (drawable),
x, y, width, height, FALSE);
pixel_region_init (&destPR, gimp_drawable_get_shadow_tiles (drawable),
x, y, width, height, TRUE);
pixel_regions_process_parallel ((PixelProcessorFunc)
gimp_lut_process,
lut, 2, &srcPR, &destPR);
gimp_lut_free (lut);
gimp_drawable_merge_shadow (drawable, TRUE, _("Posterize"));
gimp_drawable_update (drawable, x, y, width, height);
}
}
}
gimp_drawable_posterize (drawable, progress, levels);
}
return gimp_procedure_get_return_values (procedure, success);
@ -439,65 +343,8 @@ curves_spline_invoker (GimpProcedure *procedure,
success = FALSE;
if (success)
{
gint x, y, width, height;
/* The application should occur only within selection bounds */
if (gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
{
GimpCurve *curve;
Curves c;
gint j;
PixelRegion srcPR, destPR;
GimpLut *lut;
/* FIXME: hack */
if (gimp_drawable_is_gray (drawable) &&
channel == GIMP_HISTOGRAM_ALPHA)
channel = 1;
lut = gimp_lut_new ();
curves_init (&c);
curve = GIMP_CURVE (gimp_curve_new ("curves_spline"));
gimp_data_freeze (GIMP_DATA (curve));
/* unset the last point */
gimp_curve_set_point (curve, GIMP_CURVE_NUM_POINTS - 1, -1, -1);
for (j = 0; j < num_points / 2; j++)
gimp_curve_set_point (curve, j,
control_pts[j * 2],
control_pts[j * 2 + 1]);
gimp_data_thaw (GIMP_DATA (curve));
gimp_curve_get_uchar (curve, c.curve[channel]);
g_object_unref (curve);
gimp_lut_setup (lut,
(GimpLutFunc) curves_lut_func,
&c,
gimp_drawable_bytes (drawable));
pixel_region_init (&srcPR, gimp_drawable_get_tiles (drawable),
x, y, width, height, FALSE);
pixel_region_init (&destPR, gimp_drawable_get_shadow_tiles (drawable),
x, y, width, height, TRUE);
pixel_regions_process_parallel ((PixelProcessorFunc)
gimp_lut_process,
lut, 2, &srcPR, &destPR);
gimp_lut_free (lut);
gimp_drawable_merge_shadow (drawable, TRUE, _("Curves"));
gimp_drawable_update (drawable, x, y, width, height);
}
}
gimp_drawable_curves_spline (drawable, progress,
channel, control_pts, num_points);
}
return gimp_procedure_get_return_values (procedure, success);
@ -533,49 +380,8 @@ curves_explicit_invoker (GimpProcedure *procedure,
success = FALSE;
if (success)
{
gint x, y, width, height;
/* The application should occur only within selection bounds */
if (gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
{
Curves c;
gint j;
PixelRegion srcPR, destPR;
GimpLut *lut;
/* FIXME: hack */
if (gimp_drawable_is_gray (drawable) &&
channel == GIMP_HISTOGRAM_ALPHA)
channel = 1;
lut = gimp_lut_new ();
curves_init (&c);
for (j = 0; j < 256; j++)
c.curve[channel][j] = curve[j];
gimp_lut_setup (lut,
(GimpLutFunc) curves_lut_func,
&c,
gimp_drawable_bytes (drawable));
pixel_region_init (&srcPR, gimp_drawable_get_tiles (drawable),
x, y, width, height, FALSE);
pixel_region_init (&destPR, gimp_drawable_get_shadow_tiles (drawable),
x, y, width, height, TRUE);
pixel_regions_process_parallel ((PixelProcessorFunc)
gimp_lut_process,
lut, 2, &srcPR, &destPR);
gimp_lut_free (lut);
gimp_drawable_merge_shadow (drawable, TRUE, _("Curves"));
gimp_drawable_update (drawable, x, y, width, height);
}
}
gimp_drawable_curves_explicit (drawable, progress,
channel, curve, num_bytes);
}
return gimp_procedure_get_return_values (procedure, success);
@ -611,37 +417,10 @@ color_balance_invoker (GimpProcedure *procedure,
success = FALSE;
if (success)
{
gint x, y, width, height;
/* The application should occur only within selection bounds */
if (gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
{
ColorBalance cb;
PixelRegion srcPR, destPR;
color_balance_init (&cb);
cb.preserve_luminosity = preserve_lum;
cb.cyan_red[transfer_mode] = cyan_red;
cb.magenta_green[transfer_mode] = magenta_green;
cb.yellow_blue[transfer_mode] = yellow_blue;
color_balance_create_lookup_tables (&cb);
pixel_region_init (&srcPR, gimp_drawable_get_tiles (drawable),
x, y, width, height, FALSE);
pixel_region_init (&destPR, gimp_drawable_get_shadow_tiles (drawable),
x, y, width, height, TRUE);
pixel_regions_process_parallel ((PixelProcessorFunc) color_balance,
&cb, 2, &srcPR, &destPR);
gimp_drawable_merge_shadow (drawable, TRUE, _("Color Balance"));
gimp_drawable_update (drawable, x, y, width, height);
}
}
gimp_drawable_color_balance (drawable, progress,
transfer_mode,
cyan_red, magenta_green, yellow_blue,
preserve_lum);
}
return gimp_procedure_get_return_values (procedure, success);
@ -673,55 +452,8 @@ colorize_invoker (GimpProcedure *procedure,
success = FALSE;
if (success)
{
if (gimp_use_gegl (gimp))
{
GeglNode *node = g_object_new (GEGL_TYPE_NODE,
"operation", "gimp-colorize",
NULL);
gegl_node_set (node,
"hue", hue,
"saturation", saturation,
"lightness", lightness,
NULL);
gimp_drawable_apply_operation (drawable, node, TRUE,
progress, _("Colorize"));
g_object_unref (node);
}
else
{
gint x, y, width, height;
/* The application should occur only within selection bounds */
if (gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
{
Colorize colors;
PixelRegion srcPR, destPR;
colorize_init (&colors);
colors.hue = hue;
colors.saturation = saturation;
colors.lightness = lightness;
colorize_calculate (&colors);
pixel_region_init (&srcPR, gimp_drawable_get_tiles (drawable),
x, y, width, height, FALSE);
pixel_region_init (&destPR, gimp_drawable_get_shadow_tiles (drawable),
x, y, width, height, TRUE);
pixel_regions_process_parallel ((PixelProcessorFunc) colorize,
&colors, 2, &srcPR, &destPR);
gimp_drawable_merge_shadow (drawable, TRUE, _("Colorize"));
gimp_drawable_update (drawable, x, y, width, height);
}
}
}
gimp_drawable_colorize (drawable, progress,
hue, saturation, lightness);
}
return gimp_procedure_get_return_values (procedure, success);
@ -827,36 +559,8 @@ hue_saturation_invoker (GimpProcedure *procedure,
success = FALSE;
if (success)
{
gint x, y, width, height;
/* The application should occur only within selection bounds */
if (gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
{
HueSaturation hs;
PixelRegion srcPR, destPR;
hue_saturation_init (&hs);
hs.hue[hue_range] = hue_offset;
hs.lightness[hue_range] = lightness;
hs.saturation[hue_range] = saturation;
/* Calculate the transfer arrays */
hue_saturation_calculate_transfers (&hs);
pixel_region_init (&srcPR, gimp_drawable_get_tiles (drawable),
x, y, width, height, FALSE);
pixel_region_init (&destPR, gimp_drawable_get_shadow_tiles (drawable),
x, y, width, height, TRUE);
pixel_regions_process_parallel ((PixelProcessorFunc) hue_saturation,
&hs, 2, &srcPR, &destPR);
gimp_drawable_merge_shadow (drawable, TRUE, _("Hue-Saturation"));
gimp_drawable_update (drawable, x, y, width, height);
}
}
gimp_drawable_hue_saturation (drawable, progress,
hue_range, hue_offset, saturation, lightness);
}
return gimp_procedure_get_return_values (procedure, success);
@ -887,50 +591,8 @@ threshold_invoker (GimpProcedure *procedure,
success = FALSE;
if (success)
{
if (gimp_use_gegl (gimp))
{
GeglNode *node = g_object_new (GEGL_TYPE_NODE,
"operation", "gimp-threshold",
NULL);
gegl_node_set (node,
"low", low_threshold / 255.0,
"high", high_threshold / 255.0,
NULL);
gimp_drawable_apply_operation (drawable, node, TRUE,
progress, _("Threshold"));
g_object_unref (node);
}
else
{
gint x, y, width, height;
/* The application should occur only within selection bounds */
if (gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
{
Threshold tr;
PixelRegion srcPR, destPR;
tr.color = gimp_drawable_is_rgb (drawable);
tr.low_threshold = low_threshold;
tr.high_threshold = high_threshold;
pixel_region_init (&srcPR, gimp_drawable_get_tiles (drawable),
x, y, width, height, FALSE);
pixel_region_init (&destPR, gimp_drawable_get_shadow_tiles (drawable),
x, y, width, height, TRUE);
pixel_regions_process_parallel ((PixelProcessorFunc) threshold,
&tr, 2, &srcPR, &destPR);
gimp_drawable_merge_shadow (drawable, TRUE, _("Threshold"));
gimp_drawable_update (drawable, x, y, width, height);
}
}
}
gimp_drawable_threshold (drawable, progress,
low_threshold, high_threshold);
}
return gimp_procedure_get_return_values (procedure, success);

View File

@ -39,6 +39,7 @@ HELP
);
%invoke = (
headers => [ qw("core/gimpdrawable-brightness-contrast.h") ],
code => <<'CODE'
{
if (! gimp_item_is_attached (GIMP_ITEM (drawable)) ||
@ -46,55 +47,8 @@ HELP
success = FALSE;
if (success)
{
if (gimp_use_gegl (gimp))
{
GeglNode *node = g_object_new (GEGL_TYPE_NODE,
"operation", "brightness-contrast",
NULL);
gegl_node_set (node,
"brightness", brightness / 127.0,
"contrast", (contrast < 0 ?
(contrast + 127.0) / 127.0 :
contrast * 4.0 / 127.0 + 1),
NULL);
gimp_drawable_apply_operation (drawable, node, TRUE,
progress, _("Brightness-Contrast"));
g_object_unref (node);
}
else
{
gint x, y, width, height;
/* The application should occur only within selection bounds */
if (gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
{
GimpLut *lut;
PixelRegion srcPR, destPR;
lut = brightness_contrast_lut_new (brightness / 255.0,
contrast / 127.0,
gimp_drawable_bytes (drawable));
pixel_region_init (&srcPR, gimp_drawable_get_tiles (drawable),
x, y, width, height, FALSE);
pixel_region_init (&destPR, gimp_drawable_get_shadow_tiles (drawable),
x, y, width, height, TRUE);
pixel_regions_process_parallel ((PixelProcessorFunc)
gimp_lut_process,
lut, 2, &srcPR, &destPR);
gimp_lut_free (lut);
gimp_drawable_merge_shadow (drawable, TRUE, _("Brightness-Contrast"));
gimp_drawable_update (drawable, x, y, width, height);
}
}
}
gimp_drawable_brightness_contrast (drawable, progress,
brightness, contrast);
}
CODE
);
@ -179,8 +133,7 @@ HELP
);
%invoke = (
headers => [ qw("core/gimpdrawable-histogram.h"
"core/gimpdrawable-levels.h") ],
headers => [ qw("core/gimpdrawable-levels.h") ],
code => <<'CODE'
{
if (! gimp_item_is_attached (GIMP_ITEM (drawable)) ||
@ -203,8 +156,7 @@ sub levels_auto {
);
%invoke = (
headers => [ qw("core/gimpdrawable-histogram.h"
"core/gimpdrawable-levels.h") ],
headers => [ qw("core/gimpdrawable-levels.h") ],
code => <<'CODE'
{
if (! gimp_item_is_attached (GIMP_ITEM (drawable)) ||
@ -237,6 +189,7 @@ HELP
);
%invoke = (
headers => [ qw("core/gimpdrawable-posterize.h") ],
code => <<'CODE'
{
if (! gimp_item_is_attached (GIMP_ITEM (drawable)) ||
@ -244,50 +197,7 @@ HELP
success = FALSE;
if (success)
{
if (gimp_use_gegl (gimp))
{
GeglNode *node = g_object_new (GEGL_TYPE_NODE,
"operation", "gimp-posterize",
NULL);
gegl_node_set (node,
"levels", levels,
NULL);
gimp_drawable_apply_operation (drawable, node, TRUE,
progress, _("Levels"));
g_object_unref (node);
}
else
{
gint x, y, width, height;
/* The application should occur only within selection bounds */
if (gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
{
GimpLut *lut;
PixelRegion srcPR, destPR;
lut = posterize_lut_new (levels, gimp_drawable_bytes (drawable));
pixel_region_init (&srcPR, gimp_drawable_get_tiles (drawable),
x, y, width, height, FALSE);
pixel_region_init (&destPR, gimp_drawable_get_shadow_tiles (drawable),
x, y, width, height, TRUE);
pixel_regions_process_parallel ((PixelProcessorFunc)
gimp_lut_process,
lut, 2, &srcPR, &destPR);
gimp_lut_free (lut);
gimp_drawable_merge_shadow (drawable, TRUE, _("Posterize"));
gimp_drawable_update (drawable, x, y, width, height);
}
}
}
gimp_drawable_posterize (drawable, progress, levels);
}
CODE
);
@ -456,7 +366,7 @@ HELP
);
%invoke = (
headers => [ qw("base/curves.h" "core/gimpcurve.h") ],
headers => [ qw("core/gimpdrawable-curves.h") ],
code => <<'CODE'
{
if (! gimp_item_is_attached (GIMP_ITEM (drawable)) ||
@ -468,65 +378,8 @@ HELP
success = FALSE;
if (success)
{
gint x, y, width, height;
/* The application should occur only within selection bounds */
if (gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
{
GimpCurve *curve;
Curves c;
gint j;
PixelRegion srcPR, destPR;
GimpLut *lut;
/* FIXME: hack */
if (gimp_drawable_is_gray (drawable) &&
channel == GIMP_HISTOGRAM_ALPHA)
channel = 1;
lut = gimp_lut_new ();
curves_init (&c);
curve = GIMP_CURVE (gimp_curve_new ("curves_spline"));
gimp_data_freeze (GIMP_DATA (curve));
/* unset the last point */
gimp_curve_set_point (curve, GIMP_CURVE_NUM_POINTS - 1, -1, -1);
for (j = 0; j < num_points / 2; j++)
gimp_curve_set_point (curve, j,
control_pts[j * 2],
control_pts[j * 2 + 1]);
gimp_data_thaw (GIMP_DATA (curve));
gimp_curve_get_uchar (curve, c.curve[channel]);
g_object_unref (curve);
gimp_lut_setup (lut,
(GimpLutFunc) curves_lut_func,
&c,
gimp_drawable_bytes (drawable));
pixel_region_init (&srcPR, gimp_drawable_get_tiles (drawable),
x, y, width, height, FALSE);
pixel_region_init (&destPR, gimp_drawable_get_shadow_tiles (drawable),
x, y, width, height, TRUE);
pixel_regions_process_parallel ((PixelProcessorFunc)
gimp_lut_process,
lut, 2, &srcPR, &destPR);
gimp_lut_free (lut);
gimp_drawable_merge_shadow (drawable, TRUE, _("Curves"));
gimp_drawable_update (drawable, x, y, width, height);
}
}
gimp_drawable_curves_spline (drawable, progress,
channel, control_pts, num_points);
}
CODE
);
@ -559,7 +412,7 @@ HELP
);
%invoke = (
headers => [ qw("base/curves.h") ],
headers => [ qw("core/gimpdrawable-curves.h") ],
code => <<'CODE'
{
if (! gimp_item_is_attached (GIMP_ITEM (drawable)) ||
@ -571,49 +424,8 @@ HELP
success = FALSE;
if (success)
{
gint x, y, width, height;
/* The application should occur only within selection bounds */
if (gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
{
Curves c;
gint j;
PixelRegion srcPR, destPR;
GimpLut *lut;
/* FIXME: hack */
if (gimp_drawable_is_gray (drawable) &&
channel == GIMP_HISTOGRAM_ALPHA)
channel = 1;
lut = gimp_lut_new ();
curves_init (&c);
for (j = 0; j < 256; j++)
c.curve[channel][j] = curve[j];
gimp_lut_setup (lut,
(GimpLutFunc) curves_lut_func,
&c,
gimp_drawable_bytes (drawable));
pixel_region_init (&srcPR, gimp_drawable_get_tiles (drawable),
x, y, width, height, FALSE);
pixel_region_init (&destPR, gimp_drawable_get_shadow_tiles (drawable),
x, y, width, height, TRUE);
pixel_regions_process_parallel ((PixelProcessorFunc)
gimp_lut_process,
lut, 2, &srcPR, &destPR);
gimp_lut_free (lut);
gimp_drawable_merge_shadow (drawable, TRUE, _("Curves"));
gimp_drawable_update (drawable, x, y, width, height);
}
}
gimp_drawable_curves_explicit (drawable, progress,
channel, curve, num_bytes);
}
CODE
);
@ -651,7 +463,7 @@ HELP
);
%invoke = (
headers => [ qw("base/color-balance.h") ],
headers => [ qw("core/gimpdrawable-color-balance.h") ],
code => <<'CODE'
{
if (! gimp_item_is_attached (GIMP_ITEM (drawable)) ||
@ -659,37 +471,10 @@ HELP
success = FALSE;
if (success)
{
gint x, y, width, height;
/* The application should occur only within selection bounds */
if (gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
{
ColorBalance cb;
PixelRegion srcPR, destPR;
color_balance_init (&cb);
cb.preserve_luminosity = preserve_lum;
cb.cyan_red[transfer_mode] = cyan_red;
cb.magenta_green[transfer_mode] = magenta_green;
cb.yellow_blue[transfer_mode] = yellow_blue;
color_balance_create_lookup_tables (&cb);
pixel_region_init (&srcPR, gimp_drawable_get_tiles (drawable),
x, y, width, height, FALSE);
pixel_region_init (&destPR, gimp_drawable_get_shadow_tiles (drawable),
x, y, width, height, TRUE);
pixel_regions_process_parallel ((PixelProcessorFunc) color_balance,
&cb, 2, &srcPR, &destPR);
gimp_drawable_merge_shadow (drawable, TRUE, _("Color Balance"));
gimp_drawable_update (drawable, x, y, width, height);
}
}
gimp_drawable_color_balance (drawable, progress,
transfer_mode,
cyan_red, magenta_green, yellow_blue,
preserve_lum);
}
CODE
);
@ -718,7 +503,7 @@ HELP
);
%invoke = (
headers => [ qw("base/colorize.h") ],
headers => [ qw("core/gimpdrawable-colorize.h") ],
code => <<'CODE'
{
if (! gimp_item_is_attached (GIMP_ITEM (drawable)) ||
@ -726,55 +511,8 @@ HELP
success = FALSE;
if (success)
{
if (gimp_use_gegl (gimp))
{
GeglNode *node = g_object_new (GEGL_TYPE_NODE,
"operation", "gimp-colorize",
NULL);
gegl_node_set (node,
"hue", hue,
"saturation", saturation,
"lightness", lightness,
NULL);
gimp_drawable_apply_operation (drawable, node, TRUE,
progress, _("Colorize"));
g_object_unref (node);
}
else
{
gint x, y, width, height;
/* The application should occur only within selection bounds */
if (gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
{
Colorize colors;
PixelRegion srcPR, destPR;
colorize_init (&colors);
colors.hue = hue;
colors.saturation = saturation;
colors.lightness = lightness;
colorize_calculate (&colors);
pixel_region_init (&srcPR, gimp_drawable_get_tiles (drawable),
x, y, width, height, FALSE);
pixel_region_init (&destPR, gimp_drawable_get_shadow_tiles (drawable),
x, y, width, height, TRUE);
pixel_regions_process_parallel ((PixelProcessorFunc) colorize,
&colors, 2, &srcPR, &destPR);
gimp_drawable_merge_shadow (drawable, TRUE, _("Colorize"));
gimp_drawable_update (drawable, x, y, width, height);
}
}
}
gimp_drawable_colorize (drawable, progress,
hue, saturation, lightness);
}
CODE
);
@ -828,7 +566,8 @@ HELP
);
%invoke = (
headers => [ qw("core/gimpdrawable-histogram.h") ],
headers => [ qw("base/gimphistogram.h"
"core/gimpdrawable-histogram.h") ],
code => <<'CODE'
{
if (! gimp_item_is_attached (GIMP_ITEM (drawable)) ||
@ -891,7 +630,7 @@ HELP
);
%invoke = (
headers => [ qw("base/hue-saturation.h") ],
headers => [ qw("core/gimpdrawable-hue-saturation.h") ],
code => <<'CODE'
{
if (! gimp_item_is_attached (GIMP_ITEM (drawable)) ||
@ -899,36 +638,8 @@ HELP
success = FALSE;
if (success)
{
gint x, y, width, height;
/* The application should occur only within selection bounds */
if (gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
{
HueSaturation hs;
PixelRegion srcPR, destPR;
hue_saturation_init (&hs);
hs.hue[hue_range] = hue_offset;
hs.lightness[hue_range] = lightness;
hs.saturation[hue_range] = saturation;
/* Calculate the transfer arrays */
hue_saturation_calculate_transfers (&hs);
pixel_region_init (&srcPR, gimp_drawable_get_tiles (drawable),
x, y, width, height, FALSE);
pixel_region_init (&destPR, gimp_drawable_get_shadow_tiles (drawable),
x, y, width, height, TRUE);
pixel_regions_process_parallel ((PixelProcessorFunc) hue_saturation,
&hs, 2, &srcPR, &destPR);
gimp_drawable_merge_shadow (drawable, TRUE, _("Hue-Saturation"));
gimp_drawable_update (drawable, x, y, width, height);
}
}
gimp_drawable_hue_saturation (drawable, progress,
hue_range, hue_offset, saturation, lightness);
}
CODE
);
@ -956,7 +667,7 @@ HELP
);
%invoke = (
headers => [ qw("base/threshold.h") ],
headers => [ qw("core/gimpdrawable-threshold.h") ],
code => <<'CODE'
{
if (! gimp_item_is_attached (GIMP_ITEM (drawable)) ||
@ -965,50 +676,8 @@ HELP
success = FALSE;
if (success)
{
if (gimp_use_gegl (gimp))
{
GeglNode *node = g_object_new (GEGL_TYPE_NODE,
"operation", "gimp-threshold",
NULL);
gegl_node_set (node,
"low", low_threshold / 255.0,
"high", high_threshold / 255.0,
NULL);
gimp_drawable_apply_operation (drawable, node, TRUE,
progress, _("Threshold"));
g_object_unref (node);
}
else
{
gint x, y, width, height;
/* The application should occur only within selection bounds */
if (gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
{
Threshold tr;
PixelRegion srcPR, destPR;
tr.color = gimp_drawable_is_rgb (drawable);
tr.low_threshold = low_threshold;
tr.high_threshold = high_threshold;
pixel_region_init (&srcPR, gimp_drawable_get_tiles (drawable),
x, y, width, height, FALSE);
pixel_region_init (&destPR, gimp_drawable_get_shadow_tiles (drawable),
x, y, width, height, TRUE);
pixel_regions_process_parallel ((PixelProcessorFunc) threshold,
&tr, 2, &srcPR, &destPR);
gimp_drawable_merge_shadow (drawable, TRUE, _("Threshold"));
gimp_drawable_update (drawable, x, y, width, height);
}
}
}
gimp_drawable_threshold (drawable, progress,
low_threshold, high_threshold);
}
CODE
);
@ -1016,15 +685,7 @@ CODE
@headers = qw(<gegl.h>
"base/gimphistogram.h"
"base/gimplut.h"
"base/lut-funcs.h"
"base/pixel-region.h"
"base/pixel-processor.h"
"core/gimp.h"
"core/gimpdrawable.h"
"core/gimpdrawable-operation.h"
"core/gimpimage.h"
"gimp-intl.h");
@procs = qw(brightness_contrast