diff --git a/ChangeLog b/ChangeLog index 3c274050cc..ae8c8f3207 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,33 @@ +2001-04-19 Michael Natterer + + * 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 * app/gimpdrawable-offset.[ch]: renamed ChannelOffsetType to diff --git a/app/Makefile.am b/app/Makefile.am index 434dd33b68..ff19c11da1 100644 --- a/app/Makefile.am +++ b/app/Makefile.am @@ -65,6 +65,10 @@ gimp_SOURCES = \ ## disp_callbacks.c \ disp_callbacks.h \ + gdisplay.c \ + gdisplay.h \ + gdisplay_ops.c \ + gdisplay_ops.h \ gximage.c \ gximage.h \ image_render.c \ @@ -81,10 +85,6 @@ gimp_SOURCES = \ ## ## 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.h \ image_map.c \ @@ -94,7 +94,78 @@ gimp_SOURCES = \ user_install.c \ 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.h \ @@ -108,7 +179,6 @@ gimp_SOURCES = \ batch.h \ boundary.c \ boundary.h \ - brush_header.h \ brush_scale.c \ brush_scale.h \ color_transfer.c \ @@ -117,14 +187,10 @@ gimp_SOURCES = \ context_manager.h \ datafiles.c \ datafiles.h \ - desaturate.c \ - desaturate.h \ drawable.c \ drawable.h \ errors.c \ errors.h \ - equalize.c \ - equalize.h \ file-open.c \ file-open.h \ file-save.c \ @@ -140,79 +206,21 @@ gimp_SOURCES = \ gimage.h \ gimage_mask.c \ 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.h \ gimphistogram.c \ 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.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.h \ gimppreviewcache.h \ gimppreviewcache.c \ gimprc.c \ gimprc.h \ - gimpundo.c \ - gimpundo.h \ - gimpundostack.c \ - gimpundostack.h \ gimpunit.c \ - gimpviewable.c \ - gimpviewable.h \ image_new.c \ image_new.h \ - invert.c \ - invert.h \ libgimp_glue.c \ libgimp_glue.h \ lut_funcs.c \ @@ -228,7 +236,6 @@ gimp_SOURCES = \ path_curves.c \ path_bezier.h \ path_bezier.c \ - pattern_header.h \ pixel_processor.c \ pixel_processor.h \ pixel_region.c \ diff --git a/app/actions/help-commands.c b/app/actions/help-commands.c index 1826549164..393ecb8028 100644 --- a/app/actions/help-commands.c +++ b/app/actions/help-commands.c @@ -43,8 +43,6 @@ #include "app_procs.h" #include "context_manager.h" -#include "desaturate.h" -#include "equalize.h" #include "file-open.h" #include "file-save.h" #include "floating_sel.h" @@ -53,6 +51,9 @@ #include "gimpcontainer.h" #include "gimpcontext.h" #include "gimpdrawable.h" +#include "gimpdrawable-desaturate.h" +#include "gimpdrawable-equalize.h" +#include "gimpdrawable-invert.h" #include "gimphelp.h" #include "gimpimage.h" #include "gimpimage-duplicate.h" @@ -62,7 +63,6 @@ #include "global_edit.h" #include "image_render.h" #include "nav_window.h" -#include "invert.h" #include "lc_dialog.h" #include "layers_dialogP.h" #include "plug_in.h" @@ -778,10 +778,20 @@ void image_desaturate_cmd_callback (GtkWidget *widget, gpointer client_data) { - GDisplay *gdisp; + GDisplay *gdisp; + GimpDrawable *drawable; 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 (); } @@ -789,10 +799,31 @@ void image_invert_cmd_callback (GtkWidget *widget, gpointer client_data) { - GDisplay *gdisp; + GDisplay *gdisp; + GimpDrawable *drawable; + Argument *return_vals; + gint nreturn_vals; 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 (); } @@ -800,10 +831,20 @@ void image_equalize_cmd_callback (GtkWidget *widget, gpointer client_data) { - GDisplay *gdisp; + GDisplay *gdisp; + GimpDrawable *drawable; 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 (); } diff --git a/app/brush_header.h b/app/brush_header.h deleted file mode 100644 index 6dc5ee2a46..0000000000 --- a/app/brush_header.h +++ /dev/null @@ -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__ */ diff --git a/app/core/gimpbrush-header.h b/app/core/gimpbrush-header.h index 6dc5ee2a46..08f079adf5 100644 --- a/app/core/gimpbrush-header.h +++ b/app/core/gimpbrush-header.h @@ -16,8 +16,8 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#ifndef __BRUSH_HEADER_H__ -#define __BRUSH_HEADER_H__ +#ifndef __GIMP_BRUSH_HEADER_H__ +#define __GIMP_BRUSH_HEADER_H__ #define GBRUSH_FILE_VERSION 2 #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... */ -#endif /* ! __BRUSH_HEADER_H__ */ +#endif /* __GIMP_BRUSH_HEADER_H__ */ diff --git a/app/core/gimpbrush-load.c b/app/core/gimpbrush-load.c index 6d1b0e0475..66e9e72e46 100644 --- a/app/core/gimpbrush-load.c +++ b/app/core/gimpbrush-load.c @@ -43,9 +43,9 @@ #include "apptypes.h" -#include "brush_header.h" #include "brush_scale.h" #include "gimpbrush.h" +#include "gimpbrush-header.h" #include "gimpbrushgenerated.h" #include "gimprc.h" #include "temp_buf.h" diff --git a/app/core/gimpbrush.c b/app/core/gimpbrush.c index 6d1b0e0475..66e9e72e46 100644 --- a/app/core/gimpbrush.c +++ b/app/core/gimpbrush.c @@ -43,9 +43,9 @@ #include "apptypes.h" -#include "brush_header.h" #include "brush_scale.h" #include "gimpbrush.h" +#include "gimpbrush-header.h" #include "gimpbrushgenerated.h" #include "gimprc.h" #include "temp_buf.h" diff --git a/app/core/gimpbrushpipe-load.c b/app/core/gimpbrushpipe-load.c index e9ff8f2ccb..adcb2f1526 100644 --- a/app/core/gimpbrushpipe-load.c +++ b/app/core/gimpbrushpipe-load.c @@ -46,10 +46,10 @@ #include "apptypes.h" #include "appenv.h" -#include "brush_header.h" -#include "pattern_header.h" #include "gimpbrush.h" +#include "gimpbrush-header.h" #include "gimpbrushpipe.h" +#include "gimppattern-header.h" #include "gimprc.h" /* this needs to go away */ diff --git a/app/core/gimpbrushpipe.c b/app/core/gimpbrushpipe.c index e9ff8f2ccb..adcb2f1526 100644 --- a/app/core/gimpbrushpipe.c +++ b/app/core/gimpbrushpipe.c @@ -46,10 +46,10 @@ #include "apptypes.h" #include "appenv.h" -#include "brush_header.h" -#include "pattern_header.h" #include "gimpbrush.h" +#include "gimpbrush-header.h" #include "gimpbrushpipe.h" +#include "gimppattern-header.h" #include "gimprc.h" /* this needs to go away */ diff --git a/app/core/gimpdrawable-desaturate.c b/app/core/gimpdrawable-desaturate.c index 152f87ccb6..e97b42aa4a 100644 --- a/app/core/gimpdrawable-desaturate.c +++ b/app/core/gimpdrawable-desaturate.c @@ -24,35 +24,14 @@ #include "paint-funcs/paint-funcs.h" -#include "appenv.h" #include "drawable.h" -#include "desaturate.h" +#include "gimpdrawable-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) +gimp_drawable_desaturate (GimpDrawable *drawable) { PixelRegion srcPR, destPR; guchar *src, *s; @@ -63,8 +42,8 @@ desaturate (GimpDrawable *drawable) gpointer pr; gint x1, y1, x2, y2; - if (!drawable) - return; + g_return_if_fail (drawable != NULL); + g_return_if_fail (GIMP_IS_DRAWABLE (drawable)); has_alpha = gimp_drawable_has_alpha (drawable); gimp_drawable_mask_bounds (drawable, &x1, &y1, &x2, &y2); @@ -113,5 +92,6 @@ desaturate (GimpDrawable *drawable) } gimp_drawable_merge_shadow (drawable, TRUE); + drawable_update (drawable, x1, y1, (x2 - x1), (y2 - y1)); } diff --git a/app/core/gimpdrawable-desaturate.h b/app/core/gimpdrawable-desaturate.h index 1b0e8017d3..c1b7af591a 100644 --- a/app/core/gimpdrawable-desaturate.h +++ b/app/core/gimpdrawable-desaturate.h @@ -16,12 +16,13 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#ifndef __DESATURATE_H__ -#define __DESATURATE_H__ +#ifndef __GIMP_DRAWABLE_DESATURATE_H__ +#define __GIMP_DRAWABLE_DESATURATE_H__ void image_desaturate (GimpImage *gimage); -void desaturate (GimpDrawable *drawable); + +void gimp_drawable_desaturate (GimpDrawable *drawable); -#endif /* __DESATURATE_H__ */ +#endif /* __GIMP_DRAWABLE_DESATURATE_H__ */ diff --git a/app/core/gimpdrawable-equalize.c b/app/core/gimpdrawable-equalize.c index 6aa18c4780..9ad87cf7b0 100644 --- a/app/core/gimpdrawable-equalize.c +++ b/app/core/gimpdrawable-equalize.c @@ -23,7 +23,7 @@ #include "apptypes.h" #include "drawable.h" -#include "equalize.h" +#include "gimpdrawable-equalize.h" #include "gimpimage.h" #include "gimplut.h" #include "lut_funcs.h" @@ -31,30 +31,10 @@ #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) +gimp_drawable_equalize (GimpDrawable *drawable, + gboolean mask_only) { PixelRegion srcPR, destPR; guchar *mask; @@ -64,6 +44,9 @@ equalize (GimpImage *gimage, GimpHistogram *hist; GimpLut *lut; + g_return_if_fail (drawable != NULL); + g_return_if_fail (GIMP_IS_DRAWABLE (drawable)); + mask = NULL; bytes = gimp_drawable_bytes (drawable); diff --git a/app/core/gimpdrawable-equalize.h b/app/core/gimpdrawable-equalize.h index efbc8646ef..5d4e9172f9 100644 --- a/app/core/gimpdrawable-equalize.h +++ b/app/core/gimpdrawable-equalize.h @@ -16,14 +16,12 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#ifndef __EQUALIZE_H__ -#define __EQUALIZE_H__ +#ifndef __GIMP_DRAWABLE_EQUALIZE_H__ +#define __GIMP_DRAWABLE_EQUALIZE_H__ -void image_equalize (GimpImage *gimage); -void equalize (GimpImage *gimage, - GimpDrawable *drawable, - gboolean mask_only); +void gimp_drawable_equalize (GimpDrawable *drawable, + gboolean mask_only); -#endif /* __INVERT_H__ */ +#endif /* __GIMP_DRAWABLE_EQUALIZE_H__ */ diff --git a/app/core/gimpdrawable-invert.c b/app/core/gimpdrawable-invert.c index 3aec2819b9..e4e2682ee7 100644 --- a/app/core/gimpdrawable-invert.c +++ b/app/core/gimpdrawable-invert.c @@ -18,55 +18,20 @@ #include "config.h" -#include +#include #include "apptypes.h" #include "drawable.h" -#include "gimpimage.h" +#include "gimpdrawable-invert.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) +gimp_drawable_invert (GimpDrawable *drawable) { PixelRegion srcPR, destPR; gint x1, y1, x2, y2; diff --git a/app/core/gimpdrawable-invert.h b/app/core/gimpdrawable-invert.h index 921189b4e2..5f802958c7 100644 --- a/app/core/gimpdrawable-invert.h +++ b/app/core/gimpdrawable-invert.h @@ -16,12 +16,11 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#ifndef __INVERT_H__ -#define __INVERT_H__ +#ifndef __GIMP_DRAWABLE_INVERT_H__ +#define __GIMP_DRAWABLE_INVERT_H__ -void image_invert (GimpImage *gimage); -void invert (GimpDrawable *drawable); +void gimp_drawable_invert (GimpDrawable *drawable); -#endif /* __INVERT_H__ */ +#endif /* __GIMP_DRAWABLE_INVERT_H__ */ diff --git a/app/core/gimplayer.c b/app/core/gimplayer.c index 01d19b17e5..e1466b124f 100644 --- a/app/core/gimplayer.c +++ b/app/core/gimplayer.c @@ -36,6 +36,7 @@ #include "floating_sel.h" #include "gdisplay.h" #include "gimage_mask.h" +#include "gimpdrawable-invert.h" #include "gimpimage.h" #include "gimplayer.h" #include "gimplayermask.h" @@ -45,7 +46,6 @@ #include "temp_buf.h" #include "tile_manager.h" #include "tile.h" -#include "invert.h" #include "libgimp/gimpparasite.h" @@ -615,7 +615,8 @@ gimp_layer_create_mask (GimpLayer *layer, GIMP_DRAWABLE (layer)->height, FALSE); copy_region (&layerPR, &maskPR); - invert(GIMP_DRAWABLE(mask)); + + gimp_drawable_invert (GIMP_DRAWABLE (mask)); break; } diff --git a/app/core/gimppattern-header.h b/app/core/gimppattern-header.h index c1519a304b..65da53a9ff 100644 --- a/app/core/gimppattern-header.h +++ b/app/core/gimppattern-header.h @@ -16,8 +16,8 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#ifndef __PATTERN_HEADER_H__ -#define __PATTERN_HEADER_H__ +#ifndef __GIMP_PATTERN_HEADER_H__ +#define __GIMP_PATTERN_HEADER_H__ #define GPATTERN_FILE_VERSION 1 #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... */ -#endif /* __PATTERN_HEADER_H__ */ +#endif /* __GIMP_PATTERN_HEADER_H__ */ diff --git a/app/core/gimppattern-load.c b/app/core/gimppattern-load.c index 590caf67dc..72ec9aa586 100644 --- a/app/core/gimppattern-load.c +++ b/app/core/gimppattern-load.c @@ -44,8 +44,8 @@ #include "gimpimage.h" #include "gimppattern.h" +#include "gimppattern-header.h" #include "gimprc.h" -#include "pattern_header.h" #include "temp_buf.h" #include "libgimp/gimpintl.h" diff --git a/app/core/gimppattern.c b/app/core/gimppattern.c index 590caf67dc..72ec9aa586 100644 --- a/app/core/gimppattern.c +++ b/app/core/gimppattern.c @@ -44,8 +44,8 @@ #include "gimpimage.h" #include "gimppattern.h" +#include "gimppattern-header.h" #include "gimprc.h" -#include "pattern_header.h" #include "temp_buf.h" #include "libgimp/gimpintl.h" diff --git a/app/desaturate.c b/app/desaturate.c deleted file mode 100644 index 152f87ccb6..0000000000 --- a/app/desaturate.c +++ /dev/null @@ -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 - -#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)); -} diff --git a/app/desaturate.h b/app/desaturate.h deleted file mode 100644 index 1b0e8017d3..0000000000 --- a/app/desaturate.h +++ /dev/null @@ -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__ */ diff --git a/app/equalize.c b/app/equalize.c deleted file mode 100644 index 6aa18c4780..0000000000 --- a/app/equalize.c +++ /dev/null @@ -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 - -#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)); -} diff --git a/app/equalize.h b/app/equalize.h deleted file mode 100644 index efbc8646ef..0000000000 --- a/app/equalize.h +++ /dev/null @@ -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__ */ diff --git a/app/gimpbrush-header.h b/app/gimpbrush-header.h index 6dc5ee2a46..08f079adf5 100644 --- a/app/gimpbrush-header.h +++ b/app/gimpbrush-header.h @@ -16,8 +16,8 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#ifndef __BRUSH_HEADER_H__ -#define __BRUSH_HEADER_H__ +#ifndef __GIMP_BRUSH_HEADER_H__ +#define __GIMP_BRUSH_HEADER_H__ #define GBRUSH_FILE_VERSION 2 #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... */ -#endif /* ! __BRUSH_HEADER_H__ */ +#endif /* __GIMP_BRUSH_HEADER_H__ */ diff --git a/app/gimpbrush.c b/app/gimpbrush.c index 6d1b0e0475..66e9e72e46 100644 --- a/app/gimpbrush.c +++ b/app/gimpbrush.c @@ -43,9 +43,9 @@ #include "apptypes.h" -#include "brush_header.h" #include "brush_scale.h" #include "gimpbrush.h" +#include "gimpbrush-header.h" #include "gimpbrushgenerated.h" #include "gimprc.h" #include "temp_buf.h" diff --git a/app/gimpbrushpipe.c b/app/gimpbrushpipe.c index e9ff8f2ccb..adcb2f1526 100644 --- a/app/gimpbrushpipe.c +++ b/app/gimpbrushpipe.c @@ -46,10 +46,10 @@ #include "apptypes.h" #include "appenv.h" -#include "brush_header.h" -#include "pattern_header.h" #include "gimpbrush.h" +#include "gimpbrush-header.h" #include "gimpbrushpipe.h" +#include "gimppattern-header.h" #include "gimprc.h" /* this needs to go away */ diff --git a/app/gimpdrawable-desaturate.c b/app/gimpdrawable-desaturate.c index 152f87ccb6..e97b42aa4a 100644 --- a/app/gimpdrawable-desaturate.c +++ b/app/gimpdrawable-desaturate.c @@ -24,35 +24,14 @@ #include "paint-funcs/paint-funcs.h" -#include "appenv.h" #include "drawable.h" -#include "desaturate.h" +#include "gimpdrawable-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) +gimp_drawable_desaturate (GimpDrawable *drawable) { PixelRegion srcPR, destPR; guchar *src, *s; @@ -63,8 +42,8 @@ desaturate (GimpDrawable *drawable) gpointer pr; gint x1, y1, x2, y2; - if (!drawable) - return; + g_return_if_fail (drawable != NULL); + g_return_if_fail (GIMP_IS_DRAWABLE (drawable)); has_alpha = gimp_drawable_has_alpha (drawable); gimp_drawable_mask_bounds (drawable, &x1, &y1, &x2, &y2); @@ -113,5 +92,6 @@ desaturate (GimpDrawable *drawable) } gimp_drawable_merge_shadow (drawable, TRUE); + drawable_update (drawable, x1, y1, (x2 - x1), (y2 - y1)); } diff --git a/app/gimpdrawable-desaturate.h b/app/gimpdrawable-desaturate.h index 1b0e8017d3..c1b7af591a 100644 --- a/app/gimpdrawable-desaturate.h +++ b/app/gimpdrawable-desaturate.h @@ -16,12 +16,13 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#ifndef __DESATURATE_H__ -#define __DESATURATE_H__ +#ifndef __GIMP_DRAWABLE_DESATURATE_H__ +#define __GIMP_DRAWABLE_DESATURATE_H__ void image_desaturate (GimpImage *gimage); -void desaturate (GimpDrawable *drawable); + +void gimp_drawable_desaturate (GimpDrawable *drawable); -#endif /* __DESATURATE_H__ */ +#endif /* __GIMP_DRAWABLE_DESATURATE_H__ */ diff --git a/app/gimpdrawable-equalize.c b/app/gimpdrawable-equalize.c index 6aa18c4780..9ad87cf7b0 100644 --- a/app/gimpdrawable-equalize.c +++ b/app/gimpdrawable-equalize.c @@ -23,7 +23,7 @@ #include "apptypes.h" #include "drawable.h" -#include "equalize.h" +#include "gimpdrawable-equalize.h" #include "gimpimage.h" #include "gimplut.h" #include "lut_funcs.h" @@ -31,30 +31,10 @@ #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) +gimp_drawable_equalize (GimpDrawable *drawable, + gboolean mask_only) { PixelRegion srcPR, destPR; guchar *mask; @@ -64,6 +44,9 @@ equalize (GimpImage *gimage, GimpHistogram *hist; GimpLut *lut; + g_return_if_fail (drawable != NULL); + g_return_if_fail (GIMP_IS_DRAWABLE (drawable)); + mask = NULL; bytes = gimp_drawable_bytes (drawable); diff --git a/app/gimpdrawable-equalize.h b/app/gimpdrawable-equalize.h index efbc8646ef..5d4e9172f9 100644 --- a/app/gimpdrawable-equalize.h +++ b/app/gimpdrawable-equalize.h @@ -16,14 +16,12 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#ifndef __EQUALIZE_H__ -#define __EQUALIZE_H__ +#ifndef __GIMP_DRAWABLE_EQUALIZE_H__ +#define __GIMP_DRAWABLE_EQUALIZE_H__ -void image_equalize (GimpImage *gimage); -void equalize (GimpImage *gimage, - GimpDrawable *drawable, - gboolean mask_only); +void gimp_drawable_equalize (GimpDrawable *drawable, + gboolean mask_only); -#endif /* __INVERT_H__ */ +#endif /* __GIMP_DRAWABLE_EQUALIZE_H__ */ diff --git a/app/gimpdrawable-invert.c b/app/gimpdrawable-invert.c index 3aec2819b9..e4e2682ee7 100644 --- a/app/gimpdrawable-invert.c +++ b/app/gimpdrawable-invert.c @@ -18,55 +18,20 @@ #include "config.h" -#include +#include #include "apptypes.h" #include "drawable.h" -#include "gimpimage.h" +#include "gimpdrawable-invert.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) +gimp_drawable_invert (GimpDrawable *drawable) { PixelRegion srcPR, destPR; gint x1, y1, x2, y2; diff --git a/app/gimpdrawable-invert.h b/app/gimpdrawable-invert.h index 921189b4e2..5f802958c7 100644 --- a/app/gimpdrawable-invert.h +++ b/app/gimpdrawable-invert.h @@ -16,12 +16,11 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#ifndef __INVERT_H__ -#define __INVERT_H__ +#ifndef __GIMP_DRAWABLE_INVERT_H__ +#define __GIMP_DRAWABLE_INVERT_H__ -void image_invert (GimpImage *gimage); -void invert (GimpDrawable *drawable); +void gimp_drawable_invert (GimpDrawable *drawable); -#endif /* __INVERT_H__ */ +#endif /* __GIMP_DRAWABLE_INVERT_H__ */ diff --git a/app/gimplayer.c b/app/gimplayer.c index 01d19b17e5..e1466b124f 100644 --- a/app/gimplayer.c +++ b/app/gimplayer.c @@ -36,6 +36,7 @@ #include "floating_sel.h" #include "gdisplay.h" #include "gimage_mask.h" +#include "gimpdrawable-invert.h" #include "gimpimage.h" #include "gimplayer.h" #include "gimplayermask.h" @@ -45,7 +46,6 @@ #include "temp_buf.h" #include "tile_manager.h" #include "tile.h" -#include "invert.h" #include "libgimp/gimpparasite.h" @@ -615,7 +615,8 @@ gimp_layer_create_mask (GimpLayer *layer, GIMP_DRAWABLE (layer)->height, FALSE); copy_region (&layerPR, &maskPR); - invert(GIMP_DRAWABLE(mask)); + + gimp_drawable_invert (GIMP_DRAWABLE (mask)); break; } diff --git a/app/gimppattern-header.h b/app/gimppattern-header.h index c1519a304b..65da53a9ff 100644 --- a/app/gimppattern-header.h +++ b/app/gimppattern-header.h @@ -16,8 +16,8 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#ifndef __PATTERN_HEADER_H__ -#define __PATTERN_HEADER_H__ +#ifndef __GIMP_PATTERN_HEADER_H__ +#define __GIMP_PATTERN_HEADER_H__ #define GPATTERN_FILE_VERSION 1 #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... */ -#endif /* __PATTERN_HEADER_H__ */ +#endif /* __GIMP_PATTERN_HEADER_H__ */ diff --git a/app/gimppattern.c b/app/gimppattern.c index 590caf67dc..72ec9aa586 100644 --- a/app/gimppattern.c +++ b/app/gimppattern.c @@ -44,8 +44,8 @@ #include "gimpimage.h" #include "gimppattern.h" +#include "gimppattern-header.h" #include "gimprc.h" -#include "pattern_header.h" #include "temp_buf.h" #include "libgimp/gimpintl.h" diff --git a/app/gui/commands.c b/app/gui/commands.c index 1826549164..393ecb8028 100644 --- a/app/gui/commands.c +++ b/app/gui/commands.c @@ -43,8 +43,6 @@ #include "app_procs.h" #include "context_manager.h" -#include "desaturate.h" -#include "equalize.h" #include "file-open.h" #include "file-save.h" #include "floating_sel.h" @@ -53,6 +51,9 @@ #include "gimpcontainer.h" #include "gimpcontext.h" #include "gimpdrawable.h" +#include "gimpdrawable-desaturate.h" +#include "gimpdrawable-equalize.h" +#include "gimpdrawable-invert.h" #include "gimphelp.h" #include "gimpimage.h" #include "gimpimage-duplicate.h" @@ -62,7 +63,6 @@ #include "global_edit.h" #include "image_render.h" #include "nav_window.h" -#include "invert.h" #include "lc_dialog.h" #include "layers_dialogP.h" #include "plug_in.h" @@ -778,10 +778,20 @@ void image_desaturate_cmd_callback (GtkWidget *widget, gpointer client_data) { - GDisplay *gdisp; + GDisplay *gdisp; + GimpDrawable *drawable; 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 (); } @@ -789,10 +799,31 @@ void image_invert_cmd_callback (GtkWidget *widget, gpointer client_data) { - GDisplay *gdisp; + GDisplay *gdisp; + GimpDrawable *drawable; + Argument *return_vals; + gint nreturn_vals; 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 (); } @@ -800,10 +831,20 @@ void image_equalize_cmd_callback (GtkWidget *widget, gpointer client_data) { - GDisplay *gdisp; + GDisplay *gdisp; + GimpDrawable *drawable; 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 (); } diff --git a/app/gui/help-commands.c b/app/gui/help-commands.c index 1826549164..393ecb8028 100644 --- a/app/gui/help-commands.c +++ b/app/gui/help-commands.c @@ -43,8 +43,6 @@ #include "app_procs.h" #include "context_manager.h" -#include "desaturate.h" -#include "equalize.h" #include "file-open.h" #include "file-save.h" #include "floating_sel.h" @@ -53,6 +51,9 @@ #include "gimpcontainer.h" #include "gimpcontext.h" #include "gimpdrawable.h" +#include "gimpdrawable-desaturate.h" +#include "gimpdrawable-equalize.h" +#include "gimpdrawable-invert.h" #include "gimphelp.h" #include "gimpimage.h" #include "gimpimage-duplicate.h" @@ -62,7 +63,6 @@ #include "global_edit.h" #include "image_render.h" #include "nav_window.h" -#include "invert.h" #include "lc_dialog.h" #include "layers_dialogP.h" #include "plug_in.h" @@ -778,10 +778,20 @@ void image_desaturate_cmd_callback (GtkWidget *widget, gpointer client_data) { - GDisplay *gdisp; + GDisplay *gdisp; + GimpDrawable *drawable; 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 (); } @@ -789,10 +799,31 @@ void image_invert_cmd_callback (GtkWidget *widget, gpointer client_data) { - GDisplay *gdisp; + GDisplay *gdisp; + GimpDrawable *drawable; + Argument *return_vals; + gint nreturn_vals; 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 (); } @@ -800,10 +831,20 @@ void image_equalize_cmd_callback (GtkWidget *widget, gpointer client_data) { - GDisplay *gdisp; + GDisplay *gdisp; + GimpDrawable *drawable; 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 (); } diff --git a/app/invert.c b/app/invert.c deleted file mode 100644 index 3aec2819b9..0000000000 --- a/app/invert.c +++ /dev/null @@ -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 - -#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)); -} diff --git a/app/invert.h b/app/invert.h deleted file mode 100644 index 921189b4e2..0000000000 --- a/app/invert.h +++ /dev/null @@ -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__ */ diff --git a/app/pattern_header.h b/app/pattern_header.h deleted file mode 100644 index c1519a304b..0000000000 --- a/app/pattern_header.h +++ /dev/null @@ -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__ */ diff --git a/app/pdb/color_cmds.c b/app/pdb/color_cmds.c index f432289b2f..d5341eeaa2 100644 --- a/app/pdb/color_cmds.c +++ b/app/pdb/color_cmds.c @@ -26,14 +26,14 @@ #include "apptypes.h" #include "procedural_db.h" -#include "desaturate.h" #include "drawable.h" -#include "equalize.h" +#include "gimpdrawable-desaturate.h" +#include "gimpdrawable-equalize.h" +#include "gimpdrawable-invert.h" #include "gimpdrawable.h" #include "gimphistogram.h" #include "gimpimage.h" #include "gimplut.h" -#include "invert.h" #include "lut_funcs.h" #include "pixel_processor.h" #include "pixel_region.h" @@ -410,7 +410,7 @@ desaturate_invoker (Argument *args) if (success) { if (gimp_drawable_is_rgb (drawable)) - desaturate (drawable); + gimp_drawable_desaturate (drawable); else success = FALSE; } @@ -459,7 +459,7 @@ equalize_invoker (Argument *args) if (success) { if (! gimp_drawable_is_indexed (drawable)) - equalize (gimp_drawable_gimage (drawable), drawable, mask_only); + gimp_drawable_equalize (drawable, mask_only); else success = FALSE; } @@ -510,7 +510,7 @@ invert_invoker (Argument *args) if (success) { if (! gimp_drawable_is_indexed (drawable)) - invert (drawable); + gimp_drawable_invert (drawable); else success = FALSE; } diff --git a/plug-ins/common/gbr.c b/plug-ins/common/gbr.c index e5bdd2e06f..00e63bb8cf 100644 --- a/plug-ins/common/gbr.c +++ b/plug-ins/common/gbr.c @@ -44,8 +44,8 @@ #include #include -#include "app/brush_header.h" -#include "app/pattern_header.h" +#include "app/gimpbrush-header.h" +#include "app/gimppattern-header.h" #include "libgimp/stdplugins-intl.h" diff --git a/plug-ins/common/gih.c b/plug-ins/common/gih.c index 503f9a48bb..abb0b0b3c0 100644 --- a/plug-ins/common/gih.c +++ b/plug-ins/common/gih.c @@ -68,8 +68,8 @@ #include #include -#include "app/brush_header.h" -#include "app/pattern_header.h" +#include "app/gimpbrush-header.h" +#include "app/gimppattern-header.h" #include "libgimp/stdplugins-intl.h" diff --git a/plug-ins/common/pat.c b/plug-ins/common/pat.c index 9443a4a9dc..70f1aa069b 100644 --- a/plug-ins/common/pat.c +++ b/plug-ins/common/pat.c @@ -34,7 +34,7 @@ #define _O_BINARY 0 #endif -#include "app/pattern_header.h" +#include "app/gimppattern-header.h" /* local function prototypes */ diff --git a/po/POTFILES.in b/po/POTFILES.in index 705994a1dc..571d5b98b1 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -2,11 +2,9 @@ # marked to allow runtime translation of messages app/app_procs.c -app/desaturate.c app/devices.c app/disp_callbacks.c app/docindex.c -app/equalize.c app/errorconsole.c app/file-open.c app/file-save.c @@ -28,7 +26,6 @@ app/gimpunit.c app/global_edit.c app/image_new.c app/interface.c -app/invert.c app/lc_dialog.c app/main.c app/module_db.c diff --git a/tools/pdbgen/pdb/color.pdb b/tools/pdbgen/pdb/color.pdb index fb7f81f880..d990871a41 100644 --- a/tools/pdbgen/pdb/color.pdb +++ b/tools/pdbgen/pdb/color.pdb @@ -238,11 +238,11 @@ HELP @inargs = ( &drawable_arg ); %invoke = ( - headers => [ qw("desaturate.h") ], + headers => [ qw("gimpdrawable-desaturate.h") ], code => <<'CODE' { if (gimp_drawable_is_rgb (drawable)) - desaturate (drawable); + gimp_drawable_desaturate (drawable); else success = FALSE; } @@ -272,11 +272,11 @@ HELP ); %invoke = ( - headers => [ qw("equalize.h") ], + headers => [ qw("gimpdrawable-equalize.h") ], code => <<'CODE' { if (! gimp_drawable_is_indexed (drawable)) - equalize (gimp_drawable_gimage (drawable), drawable, mask_only); + gimp_drawable_equalize (drawable, mask_only); else success = FALSE; } @@ -298,11 +298,11 @@ HELP @inargs = ( &drawable_arg ); %invoke = ( - headers => [ qw("invert.h") ], + headers => [ qw("gimpdrawable-invert.h") ], code => <<'CODE' { if (! gimp_drawable_is_indexed (drawable)) - invert (drawable); + gimp_drawable_invert (drawable); else success = FALSE; }