app/Makefile.am app/brush_header.h app/pattern_header.h

2001-04-19  Michael Natterer  <mitch@gimp.org>

	* app/Makefile.am
	* app/brush_header.h
	* app/pattern_header.h
	* app/desaturate.[ch]
	* app/equalize.[ch]
	* app/invert.[ch]: removed.

	* app/gimpbrush-header.h
	* app/gimppattern-header.h
	* app/gimpdrawable-desaturate.[ch]
	* app/gimpdrawable-equalize.[ch]
	* app/gimpdrawable-invert.[ch]: new files.

	* app/gui/commands.c: put some stuff from desaturate, equalize and
	invert here. While it's ok to check the drawable type in the
	callback, this is the wrong place for PDB wrappers.

	* app/gimpbrush.c
	* app/gimpbrushpipe.c
	* app/gimplayer.c
	* app/gimppattern.c
	* app/pdb/color_cmds.c
	* plug-ins/common/gbr.c
	* plug-ins/common/gih.c
	* plug-ins/common/pat.c
	* po/POTFILES.in
	* tools/pdbgen/pdb/color.pdb: changed accordingly.
This commit is contained in:
Michael Natterer 2001-04-19 00:23:43 +00:00 committed by Michael Natterer
parent 8de3fb6452
commit 26dee23042
46 changed files with 359 additions and 826 deletions

View File

@ -1,3 +1,33 @@
2001-04-19 Michael Natterer <mitch@gimp.org>
* app/Makefile.am
* app/brush_header.h
* app/pattern_header.h
* app/desaturate.[ch]
* app/equalize.[ch]
* app/invert.[ch]: removed.
* app/gimpbrush-header.h
* app/gimppattern-header.h
* app/gimpdrawable-desaturate.[ch]
* app/gimpdrawable-equalize.[ch]
* app/gimpdrawable-invert.[ch]: new files.
* app/gui/commands.c: put some stuff from desaturate, equalize and
invert here. While it's ok to check the drawable type in the
callback, this is the wrong place for PDB wrappers.
* app/gimpbrush.c
* app/gimpbrushpipe.c
* app/gimplayer.c
* app/gimppattern.c
* app/pdb/color_cmds.c
* plug-ins/common/gbr.c
* plug-ins/common/gih.c
* plug-ins/common/pat.c
* po/POTFILES.in
* tools/pdbgen/pdb/color.pdb: changed accordingly.
2001-04-18 Michael Natterer <mitch@gimp.org> 2001-04-18 Michael Natterer <mitch@gimp.org>
* app/gimpdrawable-offset.[ch]: renamed ChannelOffsetType to * app/gimpdrawable-offset.[ch]: renamed ChannelOffsetType to

View File

@ -65,6 +65,10 @@ gimp_SOURCES = \
## ##
disp_callbacks.c \ disp_callbacks.c \
disp_callbacks.h \ disp_callbacks.h \
gdisplay.c \
gdisplay.h \
gdisplay_ops.c \
gdisplay_ops.h \
gximage.c \ gximage.c \
gximage.h \ gximage.h \
image_render.c \ image_render.c \
@ -81,10 +85,6 @@ gimp_SOURCES = \
## ##
## stuff that needs to be split up in core / ui files ## stuff that needs to be split up in core / ui files
## ##
gdisplay.c \
gdisplay.h \
gdisplay_ops.c \
gdisplay_ops.h \
global_edit.c \ global_edit.c \
global_edit.h \ global_edit.h \
image_map.c \ image_map.c \
@ -94,7 +94,78 @@ gimp_SOURCES = \
user_install.c \ user_install.c \
user_install.h \ user_install.h \
## ##
## core stuff ## base stuff that does not depend on anything else in app/
##
gimpcontainer.c \
gimpcontainer.h \
gimpdata.c \
gimpdata.h \
gimpdatafactory.c \
gimpdatafactory.h \
gimpdatalist.c \
gimpdatalist.h \
gimplist.c \
gimplist.h \
gimpobject.c \
gimpobject.h \
gimpviewable.c \
gimpviewable.h \
##
## the core object system
##
gimpbrush.c \
gimpbrush.h \
gimpbrush-header.h \
gimpbrushgenerated.c \
gimpbrushgenerated.h \
gimpbrushpipe.c \
gimpbrushpipe.h \
gimpchannel.c \
gimpchannel.h \
gimpcontext.c \
gimpcontext.h \
gimpdrawable.c \
gimpdrawable.h \
gimpdrawable-desaturate.c \
gimpdrawable-desaturate.h \
gimpdrawable-equalize.c \
gimpdrawable-equalize.h \
gimpdrawable-invert.c \
gimpdrawable-invert.h \
gimpdrawable-offset.c \
gimpdrawable-offset.h \
gimpdrawable-preview.c \
gimpdrawable-preview.h \
gimpgradient.c \
gimpgradient.h \
gimpimage.c \
gimpimage.h \
gimpimage-convert.c \
gimpimage-convert.h \
gimpimage-duplicate.c \
gimpimage-duplicate.h \
gimpimage-undo.c \
gimpimage-undo.h \
gimplayer.c \
gimplayer.h \
gimplayermask.c \
gimplayermask.h \
gimpmarshal.c \
gimpmarshal.h \
gimppattern.c \
gimppattern.h \
gimppattern-header.h \
gimppalette.c \
gimppalette.h \
gimppalette-import.c \
gimppalette-import.h \
gimpundo.c \
gimpundo.h \
gimpundostack.c \
gimpundostack.h \
##
## stuff that needs to be sorted into yet undecided subsystems, split up,
## removed or otherwise tortured
## ##
app_procs.c \ app_procs.c \
app_procs.h \ app_procs.h \
@ -108,7 +179,6 @@ gimp_SOURCES = \
batch.h \ batch.h \
boundary.c \ boundary.c \
boundary.h \ boundary.h \
brush_header.h \
brush_scale.c \ brush_scale.c \
brush_scale.h \ brush_scale.h \
color_transfer.c \ color_transfer.c \
@ -117,14 +187,10 @@ gimp_SOURCES = \
context_manager.h \ context_manager.h \
datafiles.c \ datafiles.c \
datafiles.h \ datafiles.h \
desaturate.c \
desaturate.h \
drawable.c \ drawable.c \
drawable.h \ drawable.h \
errors.c \ errors.c \
errors.h \ errors.h \
equalize.c \
equalize.h \
file-open.c \ file-open.c \
file-open.h \ file-open.h \
file-save.c \ file-save.c \
@ -140,79 +206,21 @@ gimp_SOURCES = \
gimage.h \ gimage.h \
gimage_mask.c \ gimage_mask.c \
gimage_mask.h \ gimage_mask.h \
gimpbrush.c \
gimpbrush.h \
gimpbrushgenerated.c \
gimpbrushgenerated.h \
gimpbrushpipe.c \
gimpbrushpipe.h \
gimpchannel.c \
gimpchannel.h \
gimpcontainer.c \
gimpcontainer.h \
gimpcontext.c \
gimpcontext.h \
gimpdata.c \
gimpdata.h \
gimpdatafactory.c \
gimpdatafactory.h \
gimpdatalist.c \
gimpdatalist.h \
gimpdrawable.c \
gimpdrawable.h \
gimpdrawable-offset.c \
gimpdrawable-offset.h \
gimpdrawable-preview.c \
gimpdrawable-preview.h \
gimpgradient.c \
gimpgradient.h \
gimphelp.c \ gimphelp.c \
gimphelp.h \ gimphelp.h \
gimphistogram.c \ gimphistogram.c \
gimphistogram.h \ gimphistogram.h \
gimpimage.c \
gimpimage.h \
gimpimage-convert.c \
gimpimage-convert.h \
gimpimage-duplicate.c \
gimpimage-duplicate.h \
gimpimage-undo.c \
gimpimage-undo.h \
gimplayer.c \
gimplayer.h \
gimplayermask.c \
gimplayermask.h \
gimplist.c \
gimplist.h \
gimplut.c \ gimplut.c \
gimplut.h \ gimplut.h \
gimpmarshal.c \
gimpmarshal.h \
gimpobject.c \
gimpobject.h \
gimppattern.c \
gimppattern.h \
gimppalette.c \
gimppalette.h \
gimppalette-import.c \
gimppalette-import.h \
gimpparasite.c \ gimpparasite.c \
gimpparasite.h \ gimpparasite.h \
gimppreviewcache.h \ gimppreviewcache.h \
gimppreviewcache.c \ gimppreviewcache.c \
gimprc.c \ gimprc.c \
gimprc.h \ gimprc.h \
gimpundo.c \
gimpundo.h \
gimpundostack.c \
gimpundostack.h \
gimpunit.c \ gimpunit.c \
gimpviewable.c \
gimpviewable.h \
image_new.c \ image_new.c \
image_new.h \ image_new.h \
invert.c \
invert.h \
libgimp_glue.c \ libgimp_glue.c \
libgimp_glue.h \ libgimp_glue.h \
lut_funcs.c \ lut_funcs.c \
@ -228,7 +236,6 @@ gimp_SOURCES = \
path_curves.c \ path_curves.c \
path_bezier.h \ path_bezier.h \
path_bezier.c \ path_bezier.c \
pattern_header.h \
pixel_processor.c \ pixel_processor.c \
pixel_processor.h \ pixel_processor.h \
pixel_region.c \ pixel_region.c \

View File

@ -43,8 +43,6 @@
#include "app_procs.h" #include "app_procs.h"
#include "context_manager.h" #include "context_manager.h"
#include "desaturate.h"
#include "equalize.h"
#include "file-open.h" #include "file-open.h"
#include "file-save.h" #include "file-save.h"
#include "floating_sel.h" #include "floating_sel.h"
@ -53,6 +51,9 @@
#include "gimpcontainer.h" #include "gimpcontainer.h"
#include "gimpcontext.h" #include "gimpcontext.h"
#include "gimpdrawable.h" #include "gimpdrawable.h"
#include "gimpdrawable-desaturate.h"
#include "gimpdrawable-equalize.h"
#include "gimpdrawable-invert.h"
#include "gimphelp.h" #include "gimphelp.h"
#include "gimpimage.h" #include "gimpimage.h"
#include "gimpimage-duplicate.h" #include "gimpimage-duplicate.h"
@ -62,7 +63,6 @@
#include "global_edit.h" #include "global_edit.h"
#include "image_render.h" #include "image_render.h"
#include "nav_window.h" #include "nav_window.h"
#include "invert.h"
#include "lc_dialog.h" #include "lc_dialog.h"
#include "layers_dialogP.h" #include "layers_dialogP.h"
#include "plug_in.h" #include "plug_in.h"
@ -779,9 +779,19 @@ image_desaturate_cmd_callback (GtkWidget *widget,
gpointer client_data) gpointer client_data)
{ {
GDisplay *gdisp; GDisplay *gdisp;
GimpDrawable *drawable;
return_if_no_display (gdisp); return_if_no_display (gdisp);
image_desaturate (gdisp->gimage); drawable = gimp_image_active_drawable (gdisp->gimage);
if (! gimp_drawable_is_rgb (drawable))
{
g_message (_("Desaturate operates only on RGB color drawables."));
return;
}
gimp_drawable_desaturate (drawable);
gdisplays_flush (); gdisplays_flush ();
} }
@ -790,9 +800,30 @@ image_invert_cmd_callback (GtkWidget *widget,
gpointer client_data) gpointer client_data)
{ {
GDisplay *gdisp; GDisplay *gdisp;
GimpDrawable *drawable;
Argument *return_vals;
gint nreturn_vals;
return_if_no_display (gdisp); return_if_no_display (gdisp);
image_invert (gdisp->gimage); drawable = gimp_image_active_drawable (gdisp->gimage);
if (gimp_drawable_is_indexed (drawable))
{
g_message (_("Invert does not operate on indexed drawables."));
return;
}
return_vals =
procedural_db_run_proc ("gimp_invert",
&nreturn_vals,
PDB_DRAWABLE, gimp_drawable_get_ID (drawable),
PDB_END);
if (!return_vals || return_vals[0].value.pdb_int != PDB_SUCCESS)
g_message (_("Invert operation failed."));
procedural_db_destroy_args (return_vals, nreturn_vals);
gdisplays_flush (); gdisplays_flush ();
} }
@ -801,9 +832,19 @@ image_equalize_cmd_callback (GtkWidget *widget,
gpointer client_data) gpointer client_data)
{ {
GDisplay *gdisp; GDisplay *gdisp;
GimpDrawable *drawable;
return_if_no_display (gdisp); return_if_no_display (gdisp);
image_equalize (gdisp->gimage); drawable = gimp_image_active_drawable (gdisp->gimage);
if (gimp_drawable_is_indexed (drawable))
{
g_message (_("Equalize does not operate on indexed drawables."));
return;
}
gimp_drawable_equalize (drawable, TRUE);
gdisplays_flush (); gdisplays_flush ();
} }

View File

@ -1,44 +0,0 @@
/* The GIMP -- an 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 __BRUSH_HEADER_H__
#define __BRUSH_HEADER_H__
#define GBRUSH_FILE_VERSION 2
#define GBRUSH_MAGIC (('G' << 24) + ('I' << 16) + ('M' << 8) + ('P' << 0))
/* All field entries are MSB */
typedef struct _BrushHeader BrushHeader;
struct _BrushHeader
{
guint header_size; /* header_size = sizeof (BrushHeader) + brush name */
guint version; /* brush file version # */
guint width; /* width of brush */
guint height; /* height of brush */
guint bytes; /* depth of brush in bytes--always 1 */
guint magic_number; /* GIMP brush magic number */
guint spacing; /* brush spacing */
};
/* In a brush file, next comes the brush name, null-terminated. After that
* comes the brush data--width * height * bytes bytes of it...
*/
#endif /* ! __BRUSH_HEADER_H__ */

View File

@ -16,8 +16,8 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
#ifndef __BRUSH_HEADER_H__ #ifndef __GIMP_BRUSH_HEADER_H__
#define __BRUSH_HEADER_H__ #define __GIMP_BRUSH_HEADER_H__
#define GBRUSH_FILE_VERSION 2 #define GBRUSH_FILE_VERSION 2
#define GBRUSH_MAGIC (('G' << 24) + ('I' << 16) + ('M' << 8) + ('P' << 0)) #define GBRUSH_MAGIC (('G' << 24) + ('I' << 16) + ('M' << 8) + ('P' << 0))
@ -41,4 +41,4 @@ struct _BrushHeader
* comes the brush data--width * height * bytes bytes of it... * comes the brush data--width * height * bytes bytes of it...
*/ */
#endif /* ! __BRUSH_HEADER_H__ */ #endif /* __GIMP_BRUSH_HEADER_H__ */

View File

@ -43,9 +43,9 @@
#include "apptypes.h" #include "apptypes.h"
#include "brush_header.h"
#include "brush_scale.h" #include "brush_scale.h"
#include "gimpbrush.h" #include "gimpbrush.h"
#include "gimpbrush-header.h"
#include "gimpbrushgenerated.h" #include "gimpbrushgenerated.h"
#include "gimprc.h" #include "gimprc.h"
#include "temp_buf.h" #include "temp_buf.h"

View File

@ -43,9 +43,9 @@
#include "apptypes.h" #include "apptypes.h"
#include "brush_header.h"
#include "brush_scale.h" #include "brush_scale.h"
#include "gimpbrush.h" #include "gimpbrush.h"
#include "gimpbrush-header.h"
#include "gimpbrushgenerated.h" #include "gimpbrushgenerated.h"
#include "gimprc.h" #include "gimprc.h"
#include "temp_buf.h" #include "temp_buf.h"

View File

@ -46,10 +46,10 @@
#include "apptypes.h" #include "apptypes.h"
#include "appenv.h" #include "appenv.h"
#include "brush_header.h"
#include "pattern_header.h"
#include "gimpbrush.h" #include "gimpbrush.h"
#include "gimpbrush-header.h"
#include "gimpbrushpipe.h" #include "gimpbrushpipe.h"
#include "gimppattern-header.h"
#include "gimprc.h" #include "gimprc.h"
/* this needs to go away */ /* this needs to go away */

View File

@ -46,10 +46,10 @@
#include "apptypes.h" #include "apptypes.h"
#include "appenv.h" #include "appenv.h"
#include "brush_header.h"
#include "pattern_header.h"
#include "gimpbrush.h" #include "gimpbrush.h"
#include "gimpbrush-header.h"
#include "gimpbrushpipe.h" #include "gimpbrushpipe.h"
#include "gimppattern-header.h"
#include "gimprc.h" #include "gimprc.h"
/* this needs to go away */ /* this needs to go away */

View File

@ -24,35 +24,14 @@
#include "paint-funcs/paint-funcs.h" #include "paint-funcs/paint-funcs.h"
#include "appenv.h"
#include "drawable.h" #include "drawable.h"
#include "desaturate.h" #include "gimpdrawable-desaturate.h"
#include "gimpimage.h" #include "gimpimage.h"
#include "pixel_region.h" #include "pixel_region.h"
#include "libgimp/gimpintl.h"
void void
image_desaturate (GimpImage *gimage) gimp_drawable_desaturate (GimpDrawable *drawable)
{
GimpDrawable *drawable;
drawable = gimp_image_active_drawable (gimage);
if (! gimp_drawable_is_rgb (drawable))
{
g_message (_("Desaturate operates only on RGB color drawables."));
return;
}
desaturate (drawable);
}
/* Desaturater */
void
desaturate (GimpDrawable *drawable)
{ {
PixelRegion srcPR, destPR; PixelRegion srcPR, destPR;
guchar *src, *s; guchar *src, *s;
@ -63,8 +42,8 @@ desaturate (GimpDrawable *drawable)
gpointer pr; gpointer pr;
gint x1, y1, x2, y2; gint x1, y1, x2, y2;
if (!drawable) g_return_if_fail (drawable != NULL);
return; g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
has_alpha = gimp_drawable_has_alpha (drawable); has_alpha = gimp_drawable_has_alpha (drawable);
gimp_drawable_mask_bounds (drawable, &x1, &y1, &x2, &y2); gimp_drawable_mask_bounds (drawable, &x1, &y1, &x2, &y2);
@ -113,5 +92,6 @@ desaturate (GimpDrawable *drawable)
} }
gimp_drawable_merge_shadow (drawable, TRUE); gimp_drawable_merge_shadow (drawable, TRUE);
drawable_update (drawable, x1, y1, (x2 - x1), (y2 - y1)); drawable_update (drawable, x1, y1, (x2 - x1), (y2 - y1));
} }

View File

@ -16,12 +16,13 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
#ifndef __DESATURATE_H__ #ifndef __GIMP_DRAWABLE_DESATURATE_H__
#define __DESATURATE_H__ #define __GIMP_DRAWABLE_DESATURATE_H__
void image_desaturate (GimpImage *gimage); void image_desaturate (GimpImage *gimage);
void desaturate (GimpDrawable *drawable);
void gimp_drawable_desaturate (GimpDrawable *drawable);
#endif /* __DESATURATE_H__ */ #endif /* __GIMP_DRAWABLE_DESATURATE_H__ */

View File

@ -23,7 +23,7 @@
#include "apptypes.h" #include "apptypes.h"
#include "drawable.h" #include "drawable.h"
#include "equalize.h" #include "gimpdrawable-equalize.h"
#include "gimpimage.h" #include "gimpimage.h"
#include "gimplut.h" #include "gimplut.h"
#include "lut_funcs.h" #include "lut_funcs.h"
@ -31,29 +31,9 @@
#include "pixel_processor.h" #include "pixel_processor.h"
#include "pixel_region.h" #include "pixel_region.h"
#include "libgimp/gimpintl.h"
void void
image_equalize (GimpImage *gimage) gimp_drawable_equalize (GimpDrawable *drawable,
{
GimpDrawable *drawable;
drawable = gimp_image_active_drawable (gimage);
if (gimp_drawable_is_indexed (drawable))
{
g_message (_("Equalize does not operate on indexed drawables."));
return;
}
equalize (gimage, drawable, TRUE);
}
void
equalize (GimpImage *gimage,
GimpDrawable *drawable,
gboolean mask_only) gboolean mask_only)
{ {
PixelRegion srcPR, destPR; PixelRegion srcPR, destPR;
@ -64,6 +44,9 @@ equalize (GimpImage *gimage,
GimpHistogram *hist; GimpHistogram *hist;
GimpLut *lut; GimpLut *lut;
g_return_if_fail (drawable != NULL);
g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
mask = NULL; mask = NULL;
bytes = gimp_drawable_bytes (drawable); bytes = gimp_drawable_bytes (drawable);

View File

@ -16,14 +16,12 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
#ifndef __EQUALIZE_H__ #ifndef __GIMP_DRAWABLE_EQUALIZE_H__
#define __EQUALIZE_H__ #define __GIMP_DRAWABLE_EQUALIZE_H__
void image_equalize (GimpImage *gimage); void gimp_drawable_equalize (GimpDrawable *drawable,
void equalize (GimpImage *gimage,
GimpDrawable *drawable,
gboolean mask_only); gboolean mask_only);
#endif /* __INVERT_H__ */ #endif /* __GIMP_DRAWABLE_EQUALIZE_H__ */

View File

@ -18,55 +18,20 @@
#include "config.h" #include "config.h"
#include <gtk/gtk.h> #include <glib.h>
#include "apptypes.h" #include "apptypes.h"
#include "drawable.h" #include "drawable.h"
#include "gimpimage.h" #include "gimpdrawable-invert.h"
#include "gimplut.h" #include "gimplut.h"
#include "invert.h"
#include "lut_funcs.h" #include "lut_funcs.h"
#include "pixel_processor.h" #include "pixel_processor.h"
#include "pixel_region.h" #include "pixel_region.h"
#include "pdb/procedural_db.h"
#include "libgimp/gimpintl.h"
void void
image_invert (GimpImage *gimage) gimp_drawable_invert (GimpDrawable *drawable)
{
GimpDrawable *drawable;
Argument *return_vals;
gint nreturn_vals;
drawable = gimp_image_active_drawable (gimage);
if (gimp_drawable_is_indexed (drawable))
{
g_message (_("Invert does not operate on indexed drawables."));
return;
}
return_vals =
procedural_db_run_proc ("gimp_invert",
&nreturn_vals,
PDB_DRAWABLE, gimp_drawable_get_ID (drawable),
PDB_END);
if (!return_vals || return_vals[0].value.pdb_int != PDB_SUCCESS)
g_message (_("Invert operation failed."));
procedural_db_destroy_args (return_vals, nreturn_vals);
}
/* Inverter */
void
invert (GimpDrawable *drawable)
{ {
PixelRegion srcPR, destPR; PixelRegion srcPR, destPR;
gint x1, y1, x2, y2; gint x1, y1, x2, y2;

View File

@ -16,12 +16,11 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
#ifndef __INVERT_H__ #ifndef __GIMP_DRAWABLE_INVERT_H__
#define __INVERT_H__ #define __GIMP_DRAWABLE_INVERT_H__
void image_invert (GimpImage *gimage); void gimp_drawable_invert (GimpDrawable *drawable);
void invert (GimpDrawable *drawable);
#endif /* __INVERT_H__ */ #endif /* __GIMP_DRAWABLE_INVERT_H__ */

View File

@ -36,6 +36,7 @@
#include "floating_sel.h" #include "floating_sel.h"
#include "gdisplay.h" #include "gdisplay.h"
#include "gimage_mask.h" #include "gimage_mask.h"
#include "gimpdrawable-invert.h"
#include "gimpimage.h" #include "gimpimage.h"
#include "gimplayer.h" #include "gimplayer.h"
#include "gimplayermask.h" #include "gimplayermask.h"
@ -45,7 +46,6 @@
#include "temp_buf.h" #include "temp_buf.h"
#include "tile_manager.h" #include "tile_manager.h"
#include "tile.h" #include "tile.h"
#include "invert.h"
#include "libgimp/gimpparasite.h" #include "libgimp/gimpparasite.h"
@ -615,7 +615,8 @@ gimp_layer_create_mask (GimpLayer *layer,
GIMP_DRAWABLE (layer)->height, GIMP_DRAWABLE (layer)->height,
FALSE); FALSE);
copy_region (&layerPR, &maskPR); copy_region (&layerPR, &maskPR);
invert(GIMP_DRAWABLE(mask));
gimp_drawable_invert (GIMP_DRAWABLE (mask));
break; break;
} }

View File

@ -16,8 +16,8 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
#ifndef __PATTERN_HEADER_H__ #ifndef __GIMP_PATTERN_HEADER_H__
#define __PATTERN_HEADER_H__ #define __GIMP_PATTERN_HEADER_H__
#define GPATTERN_FILE_VERSION 1 #define GPATTERN_FILE_VERSION 1
#define GPATTERN_MAGIC (('G' << 24) + ('P' << 16) + ('A' << 8) + ('T' << 0)) #define GPATTERN_MAGIC (('G' << 24) + ('P' << 16) + ('A' << 8) + ('T' << 0))
@ -40,4 +40,4 @@ struct _PatternHeader
* comes the pattern data--width * height * bytes bytes of it... * comes the pattern data--width * height * bytes bytes of it...
*/ */
#endif /* __PATTERN_HEADER_H__ */ #endif /* __GIMP_PATTERN_HEADER_H__ */

View File

@ -44,8 +44,8 @@
#include "gimpimage.h" #include "gimpimage.h"
#include "gimppattern.h" #include "gimppattern.h"
#include "gimppattern-header.h"
#include "gimprc.h" #include "gimprc.h"
#include "pattern_header.h"
#include "temp_buf.h" #include "temp_buf.h"
#include "libgimp/gimpintl.h" #include "libgimp/gimpintl.h"

View File

@ -44,8 +44,8 @@
#include "gimpimage.h" #include "gimpimage.h"
#include "gimppattern.h" #include "gimppattern.h"
#include "gimppattern-header.h"
#include "gimprc.h" #include "gimprc.h"
#include "pattern_header.h"
#include "temp_buf.h" #include "temp_buf.h"
#include "libgimp/gimpintl.h" #include "libgimp/gimpintl.h"

View File

@ -1,117 +0,0 @@
/* The GIMP -- an 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 "apptypes.h"
#include "paint-funcs/paint-funcs.h"
#include "appenv.h"
#include "drawable.h"
#include "desaturate.h"
#include "gimpimage.h"
#include "pixel_region.h"
#include "libgimp/gimpintl.h"
void
image_desaturate (GimpImage *gimage)
{
GimpDrawable *drawable;
drawable = gimp_image_active_drawable (gimage);
if (! gimp_drawable_is_rgb (drawable))
{
g_message (_("Desaturate operates only on RGB color drawables."));
return;
}
desaturate (drawable);
}
/* Desaturater */
void
desaturate (GimpDrawable *drawable)
{
PixelRegion srcPR, destPR;
guchar *src, *s;
guchar *dest, *d;
gint h, j;
gint lightness, min, max;
gint has_alpha;
gpointer pr;
gint x1, y1, x2, y2;
if (!drawable)
return;
has_alpha = gimp_drawable_has_alpha (drawable);
gimp_drawable_mask_bounds (drawable, &x1, &y1, &x2, &y2);
pixel_region_init (&srcPR, gimp_drawable_data (drawable),
x1, y1, (x2 - x1), (y2 - y1), FALSE);
pixel_region_init (&destPR, gimp_drawable_shadow (drawable),
x1, y1, (x2 - x1), (y2 - y1), TRUE);
for (pr = pixel_regions_register (2, &srcPR, &destPR);
pr != NULL;
pr = pixel_regions_process (pr))
{
src = srcPR.data;
dest = destPR.data;
h = srcPR.h;
while (h--)
{
s = src;
d = dest;
for (j = 0; j < srcPR.w; j++)
{
max = MAX (s[RED_PIX], s[GREEN_PIX]);
max = MAX (max, s[BLUE_PIX]);
min = MIN (s[RED_PIX], s[GREEN_PIX]);
min = MIN (min, s[BLUE_PIX]);
lightness = (max + min) / 2;
d[RED_PIX] = lightness;
d[GREEN_PIX] = lightness;
d[BLUE_PIX] = lightness;
if (has_alpha)
d[ALPHA_PIX] = s[ALPHA_PIX];
d += destPR.bytes;
s += srcPR.bytes;
}
src += srcPR.rowstride;
dest += destPR.rowstride;
}
}
gimp_drawable_merge_shadow (drawable, TRUE);
drawable_update (drawable, x1, y1, (x2 - x1), (y2 - y1));
}

View File

@ -1,27 +0,0 @@
/* The GIMP -- an 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_H__
#define __DESATURATE_H__
void image_desaturate (GimpImage *gimage);
void desaturate (GimpDrawable *drawable);
#endif /* __DESATURATE_H__ */

View File

@ -1,98 +0,0 @@
/* The GIMP -- an 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 "apptypes.h"
#include "drawable.h"
#include "equalize.h"
#include "gimpimage.h"
#include "gimplut.h"
#include "lut_funcs.h"
#include "gimphistogram.h"
#include "pixel_processor.h"
#include "pixel_region.h"
#include "libgimp/gimpintl.h"
void
image_equalize (GimpImage *gimage)
{
GimpDrawable *drawable;
drawable = gimp_image_active_drawable (gimage);
if (gimp_drawable_is_indexed (drawable))
{
g_message (_("Equalize does not operate on indexed drawables."));
return;
}
equalize (gimage, drawable, TRUE);
}
void
equalize (GimpImage *gimage,
GimpDrawable *drawable,
gboolean mask_only)
{
PixelRegion srcPR, destPR;
guchar *mask;
gint has_alpha;
gint alpha, bytes;
gint x1, y1, x2, y2;
GimpHistogram *hist;
GimpLut *lut;
mask = NULL;
bytes = gimp_drawable_bytes (drawable);
has_alpha = gimp_drawable_has_alpha (drawable);
alpha = has_alpha ? (bytes - 1) : bytes;
hist = gimp_histogram_new ();
gimp_histogram_calculate_drawable (hist, drawable);
/* Build equalization LUT */
lut = eq_histogram_lut_new (hist, bytes);
/* Apply the histogram */
gimp_drawable_mask_bounds (drawable, &x1, &y1, &x2, &y2);
pixel_region_init (&srcPR, gimp_drawable_data (drawable),
x1, y1, (x2 - x1), (y2 - y1), FALSE);
pixel_region_init (&destPR, gimp_drawable_shadow (drawable),
x1, y1, (x2 - x1), (y2 - y1), TRUE);
pixel_regions_process_parallel ((p_func) gimp_lut_process, lut,
2, &srcPR, &destPR);
gimp_lut_free (lut);
gimp_histogram_free (hist);
gimp_drawable_merge_shadow (drawable, TRUE);
drawable_update (drawable,
x1, y1,
(x2 - x1), (y2 - y1));
}

View File

@ -1,29 +0,0 @@
/* The GIMP -- an 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 __EQUALIZE_H__
#define __EQUALIZE_H__
void image_equalize (GimpImage *gimage);
void equalize (GimpImage *gimage,
GimpDrawable *drawable,
gboolean mask_only);
#endif /* __INVERT_H__ */

View File

@ -16,8 +16,8 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
#ifndef __BRUSH_HEADER_H__ #ifndef __GIMP_BRUSH_HEADER_H__
#define __BRUSH_HEADER_H__ #define __GIMP_BRUSH_HEADER_H__
#define GBRUSH_FILE_VERSION 2 #define GBRUSH_FILE_VERSION 2
#define GBRUSH_MAGIC (('G' << 24) + ('I' << 16) + ('M' << 8) + ('P' << 0)) #define GBRUSH_MAGIC (('G' << 24) + ('I' << 16) + ('M' << 8) + ('P' << 0))
@ -41,4 +41,4 @@ struct _BrushHeader
* comes the brush data--width * height * bytes bytes of it... * comes the brush data--width * height * bytes bytes of it...
*/ */
#endif /* ! __BRUSH_HEADER_H__ */ #endif /* __GIMP_BRUSH_HEADER_H__ */

View File

@ -43,9 +43,9 @@
#include "apptypes.h" #include "apptypes.h"
#include "brush_header.h"
#include "brush_scale.h" #include "brush_scale.h"
#include "gimpbrush.h" #include "gimpbrush.h"
#include "gimpbrush-header.h"
#include "gimpbrushgenerated.h" #include "gimpbrushgenerated.h"
#include "gimprc.h" #include "gimprc.h"
#include "temp_buf.h" #include "temp_buf.h"

View File

@ -46,10 +46,10 @@
#include "apptypes.h" #include "apptypes.h"
#include "appenv.h" #include "appenv.h"
#include "brush_header.h"
#include "pattern_header.h"
#include "gimpbrush.h" #include "gimpbrush.h"
#include "gimpbrush-header.h"
#include "gimpbrushpipe.h" #include "gimpbrushpipe.h"
#include "gimppattern-header.h"
#include "gimprc.h" #include "gimprc.h"
/* this needs to go away */ /* this needs to go away */

View File

@ -24,35 +24,14 @@
#include "paint-funcs/paint-funcs.h" #include "paint-funcs/paint-funcs.h"
#include "appenv.h"
#include "drawable.h" #include "drawable.h"
#include "desaturate.h" #include "gimpdrawable-desaturate.h"
#include "gimpimage.h" #include "gimpimage.h"
#include "pixel_region.h" #include "pixel_region.h"
#include "libgimp/gimpintl.h"
void void
image_desaturate (GimpImage *gimage) gimp_drawable_desaturate (GimpDrawable *drawable)
{
GimpDrawable *drawable;
drawable = gimp_image_active_drawable (gimage);
if (! gimp_drawable_is_rgb (drawable))
{
g_message (_("Desaturate operates only on RGB color drawables."));
return;
}
desaturate (drawable);
}
/* Desaturater */
void
desaturate (GimpDrawable *drawable)
{ {
PixelRegion srcPR, destPR; PixelRegion srcPR, destPR;
guchar *src, *s; guchar *src, *s;
@ -63,8 +42,8 @@ desaturate (GimpDrawable *drawable)
gpointer pr; gpointer pr;
gint x1, y1, x2, y2; gint x1, y1, x2, y2;
if (!drawable) g_return_if_fail (drawable != NULL);
return; g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
has_alpha = gimp_drawable_has_alpha (drawable); has_alpha = gimp_drawable_has_alpha (drawable);
gimp_drawable_mask_bounds (drawable, &x1, &y1, &x2, &y2); gimp_drawable_mask_bounds (drawable, &x1, &y1, &x2, &y2);
@ -113,5 +92,6 @@ desaturate (GimpDrawable *drawable)
} }
gimp_drawable_merge_shadow (drawable, TRUE); gimp_drawable_merge_shadow (drawable, TRUE);
drawable_update (drawable, x1, y1, (x2 - x1), (y2 - y1)); drawable_update (drawable, x1, y1, (x2 - x1), (y2 - y1));
} }

View File

@ -16,12 +16,13 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
#ifndef __DESATURATE_H__ #ifndef __GIMP_DRAWABLE_DESATURATE_H__
#define __DESATURATE_H__ #define __GIMP_DRAWABLE_DESATURATE_H__
void image_desaturate (GimpImage *gimage); void image_desaturate (GimpImage *gimage);
void desaturate (GimpDrawable *drawable);
void gimp_drawable_desaturate (GimpDrawable *drawable);
#endif /* __DESATURATE_H__ */ #endif /* __GIMP_DRAWABLE_DESATURATE_H__ */

View File

@ -23,7 +23,7 @@
#include "apptypes.h" #include "apptypes.h"
#include "drawable.h" #include "drawable.h"
#include "equalize.h" #include "gimpdrawable-equalize.h"
#include "gimpimage.h" #include "gimpimage.h"
#include "gimplut.h" #include "gimplut.h"
#include "lut_funcs.h" #include "lut_funcs.h"
@ -31,29 +31,9 @@
#include "pixel_processor.h" #include "pixel_processor.h"
#include "pixel_region.h" #include "pixel_region.h"
#include "libgimp/gimpintl.h"
void void
image_equalize (GimpImage *gimage) gimp_drawable_equalize (GimpDrawable *drawable,
{
GimpDrawable *drawable;
drawable = gimp_image_active_drawable (gimage);
if (gimp_drawable_is_indexed (drawable))
{
g_message (_("Equalize does not operate on indexed drawables."));
return;
}
equalize (gimage, drawable, TRUE);
}
void
equalize (GimpImage *gimage,
GimpDrawable *drawable,
gboolean mask_only) gboolean mask_only)
{ {
PixelRegion srcPR, destPR; PixelRegion srcPR, destPR;
@ -64,6 +44,9 @@ equalize (GimpImage *gimage,
GimpHistogram *hist; GimpHistogram *hist;
GimpLut *lut; GimpLut *lut;
g_return_if_fail (drawable != NULL);
g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
mask = NULL; mask = NULL;
bytes = gimp_drawable_bytes (drawable); bytes = gimp_drawable_bytes (drawable);

View File

@ -16,14 +16,12 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
#ifndef __EQUALIZE_H__ #ifndef __GIMP_DRAWABLE_EQUALIZE_H__
#define __EQUALIZE_H__ #define __GIMP_DRAWABLE_EQUALIZE_H__
void image_equalize (GimpImage *gimage); void gimp_drawable_equalize (GimpDrawable *drawable,
void equalize (GimpImage *gimage,
GimpDrawable *drawable,
gboolean mask_only); gboolean mask_only);
#endif /* __INVERT_H__ */ #endif /* __GIMP_DRAWABLE_EQUALIZE_H__ */

View File

@ -18,55 +18,20 @@
#include "config.h" #include "config.h"
#include <gtk/gtk.h> #include <glib.h>
#include "apptypes.h" #include "apptypes.h"
#include "drawable.h" #include "drawable.h"
#include "gimpimage.h" #include "gimpdrawable-invert.h"
#include "gimplut.h" #include "gimplut.h"
#include "invert.h"
#include "lut_funcs.h" #include "lut_funcs.h"
#include "pixel_processor.h" #include "pixel_processor.h"
#include "pixel_region.h" #include "pixel_region.h"
#include "pdb/procedural_db.h"
#include "libgimp/gimpintl.h"
void void
image_invert (GimpImage *gimage) gimp_drawable_invert (GimpDrawable *drawable)
{
GimpDrawable *drawable;
Argument *return_vals;
gint nreturn_vals;
drawable = gimp_image_active_drawable (gimage);
if (gimp_drawable_is_indexed (drawable))
{
g_message (_("Invert does not operate on indexed drawables."));
return;
}
return_vals =
procedural_db_run_proc ("gimp_invert",
&nreturn_vals,
PDB_DRAWABLE, gimp_drawable_get_ID (drawable),
PDB_END);
if (!return_vals || return_vals[0].value.pdb_int != PDB_SUCCESS)
g_message (_("Invert operation failed."));
procedural_db_destroy_args (return_vals, nreturn_vals);
}
/* Inverter */
void
invert (GimpDrawable *drawable)
{ {
PixelRegion srcPR, destPR; PixelRegion srcPR, destPR;
gint x1, y1, x2, y2; gint x1, y1, x2, y2;

View File

@ -16,12 +16,11 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
#ifndef __INVERT_H__ #ifndef __GIMP_DRAWABLE_INVERT_H__
#define __INVERT_H__ #define __GIMP_DRAWABLE_INVERT_H__
void image_invert (GimpImage *gimage); void gimp_drawable_invert (GimpDrawable *drawable);
void invert (GimpDrawable *drawable);
#endif /* __INVERT_H__ */ #endif /* __GIMP_DRAWABLE_INVERT_H__ */

View File

@ -36,6 +36,7 @@
#include "floating_sel.h" #include "floating_sel.h"
#include "gdisplay.h" #include "gdisplay.h"
#include "gimage_mask.h" #include "gimage_mask.h"
#include "gimpdrawable-invert.h"
#include "gimpimage.h" #include "gimpimage.h"
#include "gimplayer.h" #include "gimplayer.h"
#include "gimplayermask.h" #include "gimplayermask.h"
@ -45,7 +46,6 @@
#include "temp_buf.h" #include "temp_buf.h"
#include "tile_manager.h" #include "tile_manager.h"
#include "tile.h" #include "tile.h"
#include "invert.h"
#include "libgimp/gimpparasite.h" #include "libgimp/gimpparasite.h"
@ -615,7 +615,8 @@ gimp_layer_create_mask (GimpLayer *layer,
GIMP_DRAWABLE (layer)->height, GIMP_DRAWABLE (layer)->height,
FALSE); FALSE);
copy_region (&layerPR, &maskPR); copy_region (&layerPR, &maskPR);
invert(GIMP_DRAWABLE(mask));
gimp_drawable_invert (GIMP_DRAWABLE (mask));
break; break;
} }

View File

@ -16,8 +16,8 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
#ifndef __PATTERN_HEADER_H__ #ifndef __GIMP_PATTERN_HEADER_H__
#define __PATTERN_HEADER_H__ #define __GIMP_PATTERN_HEADER_H__
#define GPATTERN_FILE_VERSION 1 #define GPATTERN_FILE_VERSION 1
#define GPATTERN_MAGIC (('G' << 24) + ('P' << 16) + ('A' << 8) + ('T' << 0)) #define GPATTERN_MAGIC (('G' << 24) + ('P' << 16) + ('A' << 8) + ('T' << 0))
@ -40,4 +40,4 @@ struct _PatternHeader
* comes the pattern data--width * height * bytes bytes of it... * comes the pattern data--width * height * bytes bytes of it...
*/ */
#endif /* __PATTERN_HEADER_H__ */ #endif /* __GIMP_PATTERN_HEADER_H__ */

View File

@ -44,8 +44,8 @@
#include "gimpimage.h" #include "gimpimage.h"
#include "gimppattern.h" #include "gimppattern.h"
#include "gimppattern-header.h"
#include "gimprc.h" #include "gimprc.h"
#include "pattern_header.h"
#include "temp_buf.h" #include "temp_buf.h"
#include "libgimp/gimpintl.h" #include "libgimp/gimpintl.h"

View File

@ -43,8 +43,6 @@
#include "app_procs.h" #include "app_procs.h"
#include "context_manager.h" #include "context_manager.h"
#include "desaturate.h"
#include "equalize.h"
#include "file-open.h" #include "file-open.h"
#include "file-save.h" #include "file-save.h"
#include "floating_sel.h" #include "floating_sel.h"
@ -53,6 +51,9 @@
#include "gimpcontainer.h" #include "gimpcontainer.h"
#include "gimpcontext.h" #include "gimpcontext.h"
#include "gimpdrawable.h" #include "gimpdrawable.h"
#include "gimpdrawable-desaturate.h"
#include "gimpdrawable-equalize.h"
#include "gimpdrawable-invert.h"
#include "gimphelp.h" #include "gimphelp.h"
#include "gimpimage.h" #include "gimpimage.h"
#include "gimpimage-duplicate.h" #include "gimpimage-duplicate.h"
@ -62,7 +63,6 @@
#include "global_edit.h" #include "global_edit.h"
#include "image_render.h" #include "image_render.h"
#include "nav_window.h" #include "nav_window.h"
#include "invert.h"
#include "lc_dialog.h" #include "lc_dialog.h"
#include "layers_dialogP.h" #include "layers_dialogP.h"
#include "plug_in.h" #include "plug_in.h"
@ -779,9 +779,19 @@ image_desaturate_cmd_callback (GtkWidget *widget,
gpointer client_data) gpointer client_data)
{ {
GDisplay *gdisp; GDisplay *gdisp;
GimpDrawable *drawable;
return_if_no_display (gdisp); return_if_no_display (gdisp);
image_desaturate (gdisp->gimage); drawable = gimp_image_active_drawable (gdisp->gimage);
if (! gimp_drawable_is_rgb (drawable))
{
g_message (_("Desaturate operates only on RGB color drawables."));
return;
}
gimp_drawable_desaturate (drawable);
gdisplays_flush (); gdisplays_flush ();
} }
@ -790,9 +800,30 @@ image_invert_cmd_callback (GtkWidget *widget,
gpointer client_data) gpointer client_data)
{ {
GDisplay *gdisp; GDisplay *gdisp;
GimpDrawable *drawable;
Argument *return_vals;
gint nreturn_vals;
return_if_no_display (gdisp); return_if_no_display (gdisp);
image_invert (gdisp->gimage); drawable = gimp_image_active_drawable (gdisp->gimage);
if (gimp_drawable_is_indexed (drawable))
{
g_message (_("Invert does not operate on indexed drawables."));
return;
}
return_vals =
procedural_db_run_proc ("gimp_invert",
&nreturn_vals,
PDB_DRAWABLE, gimp_drawable_get_ID (drawable),
PDB_END);
if (!return_vals || return_vals[0].value.pdb_int != PDB_SUCCESS)
g_message (_("Invert operation failed."));
procedural_db_destroy_args (return_vals, nreturn_vals);
gdisplays_flush (); gdisplays_flush ();
} }
@ -801,9 +832,19 @@ image_equalize_cmd_callback (GtkWidget *widget,
gpointer client_data) gpointer client_data)
{ {
GDisplay *gdisp; GDisplay *gdisp;
GimpDrawable *drawable;
return_if_no_display (gdisp); return_if_no_display (gdisp);
image_equalize (gdisp->gimage); drawable = gimp_image_active_drawable (gdisp->gimage);
if (gimp_drawable_is_indexed (drawable))
{
g_message (_("Equalize does not operate on indexed drawables."));
return;
}
gimp_drawable_equalize (drawable, TRUE);
gdisplays_flush (); gdisplays_flush ();
} }

View File

@ -43,8 +43,6 @@
#include "app_procs.h" #include "app_procs.h"
#include "context_manager.h" #include "context_manager.h"
#include "desaturate.h"
#include "equalize.h"
#include "file-open.h" #include "file-open.h"
#include "file-save.h" #include "file-save.h"
#include "floating_sel.h" #include "floating_sel.h"
@ -53,6 +51,9 @@
#include "gimpcontainer.h" #include "gimpcontainer.h"
#include "gimpcontext.h" #include "gimpcontext.h"
#include "gimpdrawable.h" #include "gimpdrawable.h"
#include "gimpdrawable-desaturate.h"
#include "gimpdrawable-equalize.h"
#include "gimpdrawable-invert.h"
#include "gimphelp.h" #include "gimphelp.h"
#include "gimpimage.h" #include "gimpimage.h"
#include "gimpimage-duplicate.h" #include "gimpimage-duplicate.h"
@ -62,7 +63,6 @@
#include "global_edit.h" #include "global_edit.h"
#include "image_render.h" #include "image_render.h"
#include "nav_window.h" #include "nav_window.h"
#include "invert.h"
#include "lc_dialog.h" #include "lc_dialog.h"
#include "layers_dialogP.h" #include "layers_dialogP.h"
#include "plug_in.h" #include "plug_in.h"
@ -779,9 +779,19 @@ image_desaturate_cmd_callback (GtkWidget *widget,
gpointer client_data) gpointer client_data)
{ {
GDisplay *gdisp; GDisplay *gdisp;
GimpDrawable *drawable;
return_if_no_display (gdisp); return_if_no_display (gdisp);
image_desaturate (gdisp->gimage); drawable = gimp_image_active_drawable (gdisp->gimage);
if (! gimp_drawable_is_rgb (drawable))
{
g_message (_("Desaturate operates only on RGB color drawables."));
return;
}
gimp_drawable_desaturate (drawable);
gdisplays_flush (); gdisplays_flush ();
} }
@ -790,9 +800,30 @@ image_invert_cmd_callback (GtkWidget *widget,
gpointer client_data) gpointer client_data)
{ {
GDisplay *gdisp; GDisplay *gdisp;
GimpDrawable *drawable;
Argument *return_vals;
gint nreturn_vals;
return_if_no_display (gdisp); return_if_no_display (gdisp);
image_invert (gdisp->gimage); drawable = gimp_image_active_drawable (gdisp->gimage);
if (gimp_drawable_is_indexed (drawable))
{
g_message (_("Invert does not operate on indexed drawables."));
return;
}
return_vals =
procedural_db_run_proc ("gimp_invert",
&nreturn_vals,
PDB_DRAWABLE, gimp_drawable_get_ID (drawable),
PDB_END);
if (!return_vals || return_vals[0].value.pdb_int != PDB_SUCCESS)
g_message (_("Invert operation failed."));
procedural_db_destroy_args (return_vals, nreturn_vals);
gdisplays_flush (); gdisplays_flush ();
} }
@ -801,9 +832,19 @@ image_equalize_cmd_callback (GtkWidget *widget,
gpointer client_data) gpointer client_data)
{ {
GDisplay *gdisp; GDisplay *gdisp;
GimpDrawable *drawable;
return_if_no_display (gdisp); return_if_no_display (gdisp);
image_equalize (gdisp->gimage); drawable = gimp_image_active_drawable (gdisp->gimage);
if (gimp_drawable_is_indexed (drawable))
{
g_message (_("Equalize does not operate on indexed drawables."));
return;
}
gimp_drawable_equalize (drawable, TRUE);
gdisplays_flush (); gdisplays_flush ();
} }

View File

@ -1,93 +0,0 @@
/* The GIMP -- an 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 "apptypes.h"
#include "drawable.h"
#include "gimpimage.h"
#include "gimplut.h"
#include "invert.h"
#include "lut_funcs.h"
#include "pixel_processor.h"
#include "pixel_region.h"
#include "pdb/procedural_db.h"
#include "libgimp/gimpintl.h"
void
image_invert (GimpImage *gimage)
{
GimpDrawable *drawable;
Argument *return_vals;
gint nreturn_vals;
drawable = gimp_image_active_drawable (gimage);
if (gimp_drawable_is_indexed (drawable))
{
g_message (_("Invert does not operate on indexed drawables."));
return;
}
return_vals =
procedural_db_run_proc ("gimp_invert",
&nreturn_vals,
PDB_DRAWABLE, gimp_drawable_get_ID (drawable),
PDB_END);
if (!return_vals || return_vals[0].value.pdb_int != PDB_SUCCESS)
g_message (_("Invert operation failed."));
procedural_db_destroy_args (return_vals, nreturn_vals);
}
/* Inverter */
void
invert (GimpDrawable *drawable)
{
PixelRegion srcPR, destPR;
gint x1, y1, x2, y2;
GimpLut *lut;
lut = invert_lut_new (gimp_drawable_bytes (drawable));
gimp_drawable_mask_bounds (drawable, &x1, &y1, &x2, &y2);
pixel_region_init (&srcPR, gimp_drawable_data (drawable),
x1, y1, (x2 - x1), (y2 - y1), FALSE);
pixel_region_init (&destPR, gimp_drawable_shadow (drawable),
x1, y1, (x2 - x1), (y2 - y1), TRUE);
pixel_regions_process_parallel ((p_func)gimp_lut_process, lut,
2, &srcPR, &destPR);
gimp_lut_free (lut);
gimp_drawable_merge_shadow (drawable, TRUE);
drawable_update (drawable,
x1, y1,
(x2 - x1), (y2 - y1));
}

View File

@ -1,27 +0,0 @@
/* The GIMP -- an 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 __INVERT_H__
#define __INVERT_H__
void image_invert (GimpImage *gimage);
void invert (GimpDrawable *drawable);
#endif /* __INVERT_H__ */

View File

@ -1,43 +0,0 @@
/* The GIMP -- an 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 __PATTERN_HEADER_H__
#define __PATTERN_HEADER_H__
#define GPATTERN_FILE_VERSION 1
#define GPATTERN_MAGIC (('G' << 24) + ('P' << 16) + ('A' << 8) + ('T' << 0))
/* All field entries are MSB */
typedef struct _PatternHeader PatternHeader;
struct _PatternHeader
{
guint header_size; /* header_size = sizeof(PatternHeader) + pattern name */
guint version; /* pattern file version # */
guint width; /* width of pattern */
guint height; /* height of pattern */
guint bytes; /* depth of pattern in bytes */
guint magic_number; /* GIMP pattern magic number */
};
/* In a pattern file, next comes the pattern name, null-terminated. After that
* comes the pattern data--width * height * bytes bytes of it...
*/
#endif /* __PATTERN_HEADER_H__ */

View File

@ -26,14 +26,14 @@
#include "apptypes.h" #include "apptypes.h"
#include "procedural_db.h" #include "procedural_db.h"
#include "desaturate.h"
#include "drawable.h" #include "drawable.h"
#include "equalize.h" #include "gimpdrawable-desaturate.h"
#include "gimpdrawable-equalize.h"
#include "gimpdrawable-invert.h"
#include "gimpdrawable.h" #include "gimpdrawable.h"
#include "gimphistogram.h" #include "gimphistogram.h"
#include "gimpimage.h" #include "gimpimage.h"
#include "gimplut.h" #include "gimplut.h"
#include "invert.h"
#include "lut_funcs.h" #include "lut_funcs.h"
#include "pixel_processor.h" #include "pixel_processor.h"
#include "pixel_region.h" #include "pixel_region.h"
@ -410,7 +410,7 @@ desaturate_invoker (Argument *args)
if (success) if (success)
{ {
if (gimp_drawable_is_rgb (drawable)) if (gimp_drawable_is_rgb (drawable))
desaturate (drawable); gimp_drawable_desaturate (drawable);
else else
success = FALSE; success = FALSE;
} }
@ -459,7 +459,7 @@ equalize_invoker (Argument *args)
if (success) if (success)
{ {
if (! gimp_drawable_is_indexed (drawable)) if (! gimp_drawable_is_indexed (drawable))
equalize (gimp_drawable_gimage (drawable), drawable, mask_only); gimp_drawable_equalize (drawable, mask_only);
else else
success = FALSE; success = FALSE;
} }
@ -510,7 +510,7 @@ invert_invoker (Argument *args)
if (success) if (success)
{ {
if (! gimp_drawable_is_indexed (drawable)) if (! gimp_drawable_is_indexed (drawable))
invert (drawable); gimp_drawable_invert (drawable);
else else
success = FALSE; success = FALSE;
} }

View File

@ -44,8 +44,8 @@
#include <libgimp/gimp.h> #include <libgimp/gimp.h>
#include <libgimp/gimpui.h> #include <libgimp/gimpui.h>
#include "app/brush_header.h" #include "app/gimpbrush-header.h"
#include "app/pattern_header.h" #include "app/gimppattern-header.h"
#include "libgimp/stdplugins-intl.h" #include "libgimp/stdplugins-intl.h"

View File

@ -68,8 +68,8 @@
#include <libgimp/gimpui.h> #include <libgimp/gimpui.h>
#include <libgimp/gimpparasiteio.h> #include <libgimp/gimpparasiteio.h>
#include "app/brush_header.h" #include "app/gimpbrush-header.h"
#include "app/pattern_header.h" #include "app/gimppattern-header.h"
#include "libgimp/stdplugins-intl.h" #include "libgimp/stdplugins-intl.h"

View File

@ -34,7 +34,7 @@
#define _O_BINARY 0 #define _O_BINARY 0
#endif #endif
#include "app/pattern_header.h" #include "app/gimppattern-header.h"
/* local function prototypes */ /* local function prototypes */

View File

@ -2,11 +2,9 @@
# marked to allow runtime translation of messages # marked to allow runtime translation of messages
app/app_procs.c app/app_procs.c
app/desaturate.c
app/devices.c app/devices.c
app/disp_callbacks.c app/disp_callbacks.c
app/docindex.c app/docindex.c
app/equalize.c
app/errorconsole.c app/errorconsole.c
app/file-open.c app/file-open.c
app/file-save.c app/file-save.c
@ -28,7 +26,6 @@ app/gimpunit.c
app/global_edit.c app/global_edit.c
app/image_new.c app/image_new.c
app/interface.c app/interface.c
app/invert.c
app/lc_dialog.c app/lc_dialog.c
app/main.c app/main.c
app/module_db.c app/module_db.c

View File

@ -238,11 +238,11 @@ HELP
@inargs = ( &drawable_arg ); @inargs = ( &drawable_arg );
%invoke = ( %invoke = (
headers => [ qw("desaturate.h") ], headers => [ qw("gimpdrawable-desaturate.h") ],
code => <<'CODE' code => <<'CODE'
{ {
if (gimp_drawable_is_rgb (drawable)) if (gimp_drawable_is_rgb (drawable))
desaturate (drawable); gimp_drawable_desaturate (drawable);
else else
success = FALSE; success = FALSE;
} }
@ -272,11 +272,11 @@ HELP
); );
%invoke = ( %invoke = (
headers => [ qw("equalize.h") ], headers => [ qw("gimpdrawable-equalize.h") ],
code => <<'CODE' code => <<'CODE'
{ {
if (! gimp_drawable_is_indexed (drawable)) if (! gimp_drawable_is_indexed (drawable))
equalize (gimp_drawable_gimage (drawable), drawable, mask_only); gimp_drawable_equalize (drawable, mask_only);
else else
success = FALSE; success = FALSE;
} }
@ -298,11 +298,11 @@ HELP
@inargs = ( &drawable_arg ); @inargs = ( &drawable_arg );
%invoke = ( %invoke = (
headers => [ qw("invert.h") ], headers => [ qw("gimpdrawable-invert.h") ],
code => <<'CODE' code => <<'CODE'
{ {
if (! gimp_drawable_is_indexed (drawable)) if (! gimp_drawable_is_indexed (drawable))
invert (drawable); gimp_drawable_invert (drawable);
else else
success = FALSE; success = FALSE;
} }