Commit 26dee230 authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer
Browse files

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.
parent 8de3fb64
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>
* app/gimpdrawable-offset.[ch]: renamed ChannelOffsetType to
......
......@@ -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 \
......
......@@ -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 ();
}
......
/* 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__ */
......@@ -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__ */
......@@ -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"
......
......@@ -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"
......
......@@ -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 */
......
......@@ -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 */
......
......@@ -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));
}
......@@ -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__ */
......@@ -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);
......
......@@ -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__ */
......@@ -18,55 +18,20 @@
#include "config.h"
#include <gtk/gtk.h>
#include <glib.h>
#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"