configure.in added new directory app/core/ for the core object system.

2001-05-09  Michael Natterer  <mitch@gimp.org>

	* configure.in
	* app/Makefile.am: added new directory app/core/ for the core
	object system.

	* app/gimage_mask.[ch]
	* app/gimpbrush-header.h
	* app/gimpbrush.[ch]
	* app/gimpbrushgenerated.[ch]
	* app/gimpbrushpipe.[ch]
	* app/gimpchannel.[ch]
	* app/gimpcontainer.[ch]
	* app/gimpcontext.[ch]
	* app/gimpdata.[ch]
	* app/gimpdatafactory.[ch]
	* app/gimpdatalist.h
	* app/gimpdrawable-desaturate.[ch]
	* app/gimpdrawable-equalize.[ch]
	* app/gimpdrawable-invert.[ch]
	* app/gimpdrawable-offset.[ch]
	* app/gimpdrawable-preview.[ch]
	* app/gimpdrawable.[ch]
	* app/gimpgradient.[ch]
	* app/gimpimage-convert.[ch]
	* app/gimpimage-duplicate.[ch]
	* app/gimpimage-undo.[ch]
	* app/gimpimage.[ch]
	* app/gimplayer.[ch]
	* app/gimplayermask.[ch]
	* app/gimplist.[ch]
	* app/gimpmarshal.[ch]
	* app/gimpobject.[ch]
	* app/gimppalette-import.[ch]
	* app/gimppalette.[ch]
	* app/gimppattern-header.h
	* app/gimppattern.[ch]
	* app/gimpundo.[ch]
	* app/gimpundostack.[ch]
	* app/gimpviewable.[ch]: removed these files...

	* app/core/*: ...and added them here.

	* app/*.c
	* app/gui/*.c
	* app/pdb/*.c
	* app/tools/*.c
	* app/widgets/*.c
	* plug-ins/common/gbr.c
	* plug-ins/common/gih.c
	* plug-ins/common/pat.c
	* po/POTFILES.in
	* tools/pdbgen/Makefile.am
	* tools/pdbgen/enums.pl
	* tools/pdbgen/pdb.pl
	* tools/pdbgen/pdb/*.pdb: changed accordingly.
This commit is contained in:
Michael Natterer 2001-05-09 02:32:03 +00:00 committed by Michael Natterer
parent 715bf7aa39
commit 8985b107c3
400 changed files with 1425 additions and 27205 deletions

View File

@ -1,3 +1,60 @@
2001-05-09 Michael Natterer <mitch@gimp.org>
* configure.in
* app/Makefile.am: added new directory app/core/ for the core
object system.
* app/gimage_mask.[ch]
* app/gimpbrush-header.h
* app/gimpbrush.[ch]
* app/gimpbrushgenerated.[ch]
* app/gimpbrushpipe.[ch]
* app/gimpchannel.[ch]
* app/gimpcontainer.[ch]
* app/gimpcontext.[ch]
* app/gimpdata.[ch]
* app/gimpdatafactory.[ch]
* app/gimpdatalist.h
* app/gimpdrawable-desaturate.[ch]
* app/gimpdrawable-equalize.[ch]
* app/gimpdrawable-invert.[ch]
* app/gimpdrawable-offset.[ch]
* app/gimpdrawable-preview.[ch]
* app/gimpdrawable.[ch]
* app/gimpgradient.[ch]
* app/gimpimage-convert.[ch]
* app/gimpimage-duplicate.[ch]
* app/gimpimage-undo.[ch]
* app/gimpimage.[ch]
* app/gimplayer.[ch]
* app/gimplayermask.[ch]
* app/gimplist.[ch]
* app/gimpmarshal.[ch]
* app/gimpobject.[ch]
* app/gimppalette-import.[ch]
* app/gimppalette.[ch]
* app/gimppattern-header.h
* app/gimppattern.[ch]
* app/gimpundo.[ch]
* app/gimpundostack.[ch]
* app/gimpviewable.[ch]: removed these files...
* app/core/*: ...and added them here.
* app/*.c
* app/gui/*.c
* app/pdb/*.c
* app/tools/*.c
* app/widgets/*.c
* plug-ins/common/gbr.c
* plug-ins/common/gih.c
* plug-ins/common/pat.c
* po/POTFILES.in
* tools/pdbgen/Makefile.am
* tools/pdbgen/enums.pl
* tools/pdbgen/pdb.pl
* tools/pdbgen/pdb/*.pdb: changed accordingly.
2001-05-08 Michael Natterer <mitch@gimp.org>
* app/appenums.h: removed GimpDropType.

View File

@ -1,6 +1,6 @@
## Process this file with automake to produce Makefile.in
SUBDIRS = paint-funcs pdb tools widgets gui
SUBDIRS = paint-funcs core pdb tools widgets gui
scriptdata =
@ -93,76 +93,6 @@ gimp_SOURCES = \
user_install.c \
user_install.h \
##
## 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 \
##
## 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 \
gimpviewable.c \
gimpviewable.h \
##
## stuff that needs to be sorted into yet undecided subsystems, split up,
## removed or otherwise tortured
##
@ -203,8 +133,6 @@ gimp_SOURCES = \
general.h \
gimage.c \
gimage.h \
gimage_mask.c \
gimage_mask.h \
gimphelp.c \
gimphelp.h \
gimphistogram.c \
@ -296,11 +224,12 @@ INCLUDES = \
-I$(includedir)
gimp_LDADD = \
gui/libappgui.la \
paint-funcs/libapppaint-funcs.la \
pdb/libapppdb.la \
tools/libapptools.la \
gui/libappgui.la \
widgets/libappwidgets.la \
core/libappcore.la \
$(top_builddir)/libgimpcolor/libgimpcolor-$(LT_RELEASE).la \
$(top_builddir)/libgimpmath/libgimpmath-$(LT_RELEASE).la \
$(top_builddir)/libgimpwidgets/libgimpwidgets-$(LT_RELEASE).la \

View File

@ -25,6 +25,11 @@
#include "apptypes.h"
#include "core/gimpchannel.h"
#include "core/gimpimage.h"
#include "core/gimpimage-mask.h"
#include "core/gimplist.h"
#include "widgets/gimpcolorpanel.h"
#include "channels-commands.h"
@ -33,10 +38,6 @@
#include "menus.h"
#include "drawable.h"
#include "gimage_mask.h"
#include "gimpchannel.h"
#include "gimpimage.h"
#include "gimplist.h"
#include "libgimp/gimpintl.h"

View File

@ -29,6 +29,14 @@
#include "apptypes.h"
#include "core/gimpcontext.h"
#include "core/gimpdrawable.h"
#include "core/gimpdrawable-desaturate.h"
#include "core/gimpdrawable-equalize.h"
#include "core/gimpimage.h"
#include "core/gimpimage-duplicate.h"
#include "core/gimpimage-mask.h"
#include "tools/gimptool.h"
#include "tools/gimptoolinfo.h"
#include "tools/tool_manager.h"
@ -47,17 +55,7 @@
#include "context_manager.h"
#include "floating_sel.h"
#include "gdisplay_ops.h"
#include "gimage_mask.h"
#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"
#include "gimplayer.h"
#include "gimprc.h"
#include "gimpui.h"
#include "global_edit.h"

View File

@ -30,6 +30,12 @@
#include "paint-funcs/paint-funcs.h"
#include "core/gimpimage.h"
#include "core/gimpimage-mask.h"
#include "core/gimplayer.h"
#include "core/gimplayermask.h"
#include "core/gimplist.h"
#include "gdisplay.h"
#include "gimpui.h"
#include "layers-commands.h"
@ -38,11 +44,6 @@
#include "drawable.h"
#include "floating_sel.h"
#include "gimage_mask.h"
#include "gimpimage.h"
#include "gimplayer.h"
#include "gimplayermask.h"
#include "gimplist.h"
#include "undo.h"
#include "libgimp/gimpintl.h"

View File

@ -77,12 +77,16 @@
#include <sys/shm.h>
#endif
#include "libgimp/gimpenv.h"
#include "apptypes.h"
#include "libgimp/gimpenv.h"
#include "libgimp/gimpparasite.h"
#include "libgimp/gimpprotocol.h"
#include "libgimp/gimpwire.h"
#include "libgimp/gimpparasite.h"
#include "core/gimpdrawable.h"
#include "core/gimpimage.h"
#include "gui/brush-select.h"
#include "gui/gradient-select.h"
@ -95,8 +99,6 @@
#include "datafiles.h"
#include "errors.h"
#include "general.h"
#include "gimpdrawable.h"
#include "gimpimage.h"
#include "gimpprogress.h"
#include "gimprc.h"
#include "plug_in.h"

View File

@ -29,15 +29,16 @@
#include "apptypes.h"
#include "core/gimpchannel.h"
#include "core/gimpcontext.h"
#include "core/gimpimage.h"
#include "core/gimpimage-mask.h"
#include "widgets/gimpcolorpanel.h"
#include "drawable.h"
#include "floating_sel.h"
#include "gdisplay.h"
#include "gimage_mask.h"
#include "gimpchannel.h"
#include "gimpcontext.h"
#include "gimpimage.h"
#include "global_edit.h"
#include "qmask.h"
#include "undo.h"

View File

@ -29,15 +29,16 @@
#include "apptypes.h"
#include "core/gimpchannel.h"
#include "core/gimpcontext.h"
#include "core/gimpimage.h"
#include "core/gimpimage-mask.h"
#include "widgets/gimpcolorpanel.h"
#include "drawable.h"
#include "floating_sel.h"
#include "gdisplay.h"
#include "gimage_mask.h"
#include "gimpchannel.h"
#include "gimpcontext.h"
#include "gimpimage.h"
#include "global_edit.h"
#include "qmask.h"
#include "undo.h"

View File

@ -48,6 +48,8 @@
#include "paint-funcs/paint-funcs.h"
#include "core/gimpdatafactory.h"
#include "pdb/internal_procs.h"
#include "tools/curves.h"
@ -67,9 +69,6 @@
#include "context_manager.h"
#include "gdisplay.h"
#include "gdisplay_ops.h"
#include "gimpcontext.h"
#include "gimpdatafactory.h"
#include "gimpimage.h"
#include "gimprc.h"
#include "gimpparasite.h"
#include "global_edit.h"

View File

@ -31,9 +31,10 @@
#include "apptypes.h"
#include "gimpdrawable.h"
#include "core/gimpdrawable.h"
#include "core/gimpimage.h"
#include "gimphistogram.h"
#include "gimpimage.h"
#include "gimprc.h"
#include "pixel_processor.h"
#include "pixel_region.h"

View File

@ -22,7 +22,8 @@
#include "apptypes.h"
#include "gimpimage.h"
#include "core/gimpimage.h"
#include "pixel_region.h"
#include "pixel_surround.h"
#include "tile_manager.h"

View File

@ -40,7 +40,8 @@
#include "paint-funcs/paint-funcs.h"
#include "gimpimage.h"
#include "core/gimpimage.h"
#include "gimprc.h"
#include "pixel_region.h"
#include "temp_buf.h"

View File

@ -22,6 +22,17 @@
#include "apptypes.h"
#include "core/gimpbrush.h"
#include "core/gimpbrushgenerated.h"
#include "core/gimpbrushpipe.h"
#include "core/gimpcontext.h"
#include "core/gimpdatafactory.h"
#include "core/gimpgradient.h"
#include "core/gimplist.h"
#include "core/gimpimage.h"
#include "core/gimppalette.h"
#include "core/gimppattern.h"
#include "tools/gimptool.h"
#include "tools/gimptoolinfo.h"
#include "tools/paint_options.h"
@ -33,18 +44,6 @@
#include "cursorutil.h"
#include "context_manager.h"
#include "gdisplay.h"
#include "gimpbrush.h"
#include "gimpbrushgenerated.h"
#include "gimpbrushpipe.h"
#include "gimpcontainer.h"
#include "gimpcontext.h"
#include "gimpdatafactory.h"
#include "gimpdatalist.h"
#include "gimpgradient.h"
#include "gimpimage.h"
#include "gimplist.h"
#include "gimppalette.h"
#include "gimppattern.h"
#include "gimprc.h"

6
app/core/.cvsignore Normal file
View File

@ -0,0 +1,6 @@
Makefile
Makefile.in
.deps
.libs
*.lo
libappcore.la

View File

@ -42,8 +42,8 @@ libappcore_la_SOURCES = \
gimpimage-convert.h \
gimpimage-duplicate.c \
gimpimage-duplicate.h \
gimpimage-mask.c \ (gimage_mask.c)
gimpimage-mask.h \ (gimage_mask.h)
gimpimage-mask.c \
gimpimage-mask.h \
gimpimage-undo.c \
gimpimage-undo.h \
gimplayer.c \
@ -68,8 +68,7 @@ libappcore_la_SOURCES = \
gimpundostack.c \
gimpundostack.h \
gimpviewable.c \
gimpviewable.h \
gimpviewable.h
AM_CPPFLAGS = \
-DG_LOG_DOMAIN=\"Gimp-Core\"

View File

@ -28,6 +28,12 @@
#include "paint-funcs/paint-funcs.h"
#include "core/gimpchannel.h"
#include "core/gimpcontext.h"
#include "core/gimpimage.h"
#include "core/gimpimage-mask.h"
#include "core/gimplayer.h"
#include "tools/gimptool.h"
#include "tools/tool_manager.h"
@ -35,10 +41,6 @@
#include "floating_sel.h"
#include "gdisplay.h"
#include "gimage.h"
#include "gimage_mask.h"
#include "gimpcontext.h"
#include "gimplayer.h"
#include "gimplayermask.h"
#include "global_edit.h"
#include "image_new.h"
#include "pixel_region.h"

View File

@ -29,6 +29,14 @@
#include "paint-funcs/paint-funcs.h"
#include "core/gimpchannel.h"
#include "core/gimpcontext.h"
#include "core/gimpdrawable.h"
#include "core/gimpimage.h"
#include "core/gimpimage-mask.h"
#include "core/gimplayer.h"
#include "core/gimpmarshal.h"
#include "gui/info-dialog.h"
#include "cursorutil.h"
#include "gdisplay.h"
@ -36,12 +44,6 @@
#include "drawable.h"
#include "floating_sel.h"
#include "gimage_mask.h"
#include "gimpchannel.h"
#include "gimpcontext.h"
#include "gimpimage.h"
#include "gimplayer.h"
#include "gimpmarshal.h"
#include "gimprc.h"
#include "path_transform.h"
#include "pixel_region.h"

View File

@ -33,7 +33,7 @@
#include "boundary.h"
#include "drawable.h"
#include "gimpimage.h"
#include "gimage_mask.h"
#include "gimpimage-mask.h"
#include "gimpchannel.h"
#include "gimplayer.h"
#include "gimplut.h"

View File

@ -33,7 +33,7 @@
#include "boundary.h"
#include "drawable.h"
#include "gimpimage.h"
#include "gimage_mask.h"
#include "gimpimage-mask.h"
#include "gimpchannel.h"
#include "gimplayer.h"
#include "gimplut.h"

View File

@ -30,6 +30,12 @@
#include "paint-funcs/paint-funcs.h"
#include "core/gimpcontext.h"
#include "core/gimpdrawable.h"
#include "core/gimpgradient.h"
#include "core/gimpimage.h"
#include "core/gimpimage-mask.h"
#include "widgets/gimpdnd.h"
#include "appenv.h"
@ -38,10 +44,6 @@
#include "drawable.h"
#include "errors.h"
#include "gdisplay.h"
#include "gimpimage.h"
#include "gimage_mask.h"
#include "gimpcontext.h"
#include "gimpgradient.h"
#include "gimpprogress.h"
#include "pixel_region.h"
#include "selection.h"

View File

@ -25,6 +25,7 @@
#include "paint-funcs/paint-funcs.h"
#include "drawable.h"
#include "gimpdrawable.h"
#include "gimpdrawable-desaturate.h"
#include "gimpimage.h"
#include "pixel_region.h"

View File

@ -23,6 +23,7 @@
#include "apptypes.h"
#include "drawable.h"
#include "gimpdrawable.h"
#include "gimpdrawable-equalize.h"
#include "gimpimage.h"
#include "gimplut.h"

View File

@ -23,6 +23,7 @@
#include "apptypes.h"
#include "drawable.h"
#include "gimpdrawable.h"
#include "gimpdrawable-invert.h"
#include "gimplut.h"
#include "lut_funcs.h"

View File

@ -33,6 +33,7 @@
#include "cursorutil.h"
#include "drawable.h"
#include "gimpcontext.h"
#include "gimpdrawable.h"
#include "gimpdrawable-offset.h"
#include "gimpimage.h"
#include "pixel_region.h"

View File

@ -29,6 +29,14 @@
#include "paint-funcs/paint-funcs.h"
#include "core/gimpchannel.h"
#include "core/gimpcontext.h"
#include "core/gimpdrawable.h"
#include "core/gimpimage.h"
#include "core/gimpimage-mask.h"
#include "core/gimplayer.h"
#include "core/gimpmarshal.h"
#include "gui/info-dialog.h"
#include "cursorutil.h"
#include "gdisplay.h"
@ -36,12 +44,6 @@
#include "drawable.h"
#include "floating_sel.h"
#include "gimage_mask.h"
#include "gimpchannel.h"
#include "gimpcontext.h"
#include "gimpimage.h"
#include "gimplayer.h"
#include "gimpmarshal.h"
#include "gimprc.h"
#include "path_transform.h"
#include "pixel_region.h"

View File

@ -31,11 +31,11 @@
#include "paint-funcs/paint-funcs.h"
#include "gimage_mask.h"
#include "gimpchannel.h"
#include "gimpdrawable.h"
#include "gimpdrawable-preview.h"
#include "gimpimage.h"
#include "gimpimage-mask.h"
#include "gimplayer.h"
#include "gimplist.h"
#include "gimppreviewcache.h"

View File

@ -28,6 +28,12 @@
#include "paint-funcs/paint-funcs.h"
#include "core/gimpchannel.h"
#include "core/gimpcontext.h"
#include "core/gimpimage.h"
#include "core/gimpimage-mask.h"
#include "core/gimplayer.h"
#include "tools/gimptool.h"
#include "tools/tool_manager.h"
@ -35,10 +41,6 @@
#include "floating_sel.h"
#include "gdisplay.h"
#include "gimage.h"
#include "gimage_mask.h"
#include "gimpcontext.h"
#include "gimplayer.h"
#include "gimplayermask.h"
#include "global_edit.h"
#include "image_new.h"
#include "pixel_region.h"

View File

@ -38,6 +38,7 @@
#include "gimage.h"
#include "gimpchannel.h"
#include "gimpcontext.h"
#include "gimpimage.h"
#include "gimpimage-duplicate.h"
#include "gimplayer.h"
#include "gimplist.h"

View File

@ -33,9 +33,9 @@
#include "drawable.h"
#include "floating_sel.h"
#include "gdisplay.h"
#include "gimage_mask.h"
#include "gimpcontext.h"
#include "gimpimage.h"
#include "gimpimage-mask.h"
#include "gimpimage-undo.h"
#include "gimplayer.h"
#include "gimplayermask.h"

View File

@ -29,15 +29,16 @@
#include "tools/paint_options.h"
#include "tools/tool_manager.h"
#include "gimpchannel.h"
#include "gimpimage.h"
#include "gimpimage-mask.h"
#include "gimplayer.h"
#include "gimplayermask.h"
#include "boundary.h"
#include "drawable.h"
#include "floating_sel.h"
#include "gdisplay.h"
#include "gimage_mask.h"
#include "gimpchannel.h"
#include "gimpimage.h"
#include "gimplayer.h"
#include "gimplayermask.h"
#include "gimprc.h"
#include "pixel_region.h"
#include "tile_manager.h"

View File

@ -33,9 +33,9 @@
#include "drawable.h"
#include "floating_sel.h"
#include "gdisplay.h"
#include "gimage_mask.h"
#include "gimpcontext.h"
#include "gimpimage.h"
#include "gimpimage-mask.h"
#include "gimpimage-undo.h"
#include "gimplayer.h"
#include "gimplayermask.h"

View File

@ -25,6 +25,9 @@
#include "apptypes.h"
#include "core/gimpdrawable.h"
#include "core/gimpimage.h"
#include "gui/info-dialog.h"
#include "gui/palette-editor.h"
#include "gdisplay.h"
@ -37,8 +40,6 @@
#include "tool_options.h"
#include "appenv.h"
#include "drawable.h"
#include "gimpimage.h"
#include "gimprc.h"
#include "libgimp/gimpintl.h"

View File

@ -33,9 +33,9 @@
#include "drawable.h"
#include "floating_sel.h"
#include "gdisplay.h"
#include "gimage_mask.h"
#include "gimpcontext.h"
#include "gimpimage.h"
#include "gimpimage-mask.h"
#include "gimpimage-undo.h"
#include "gimplayer.h"
#include "gimplayermask.h"

View File

@ -29,15 +29,16 @@
#include "apptypes.h"
#include "core/gimpchannel.h"
#include "core/gimpcontext.h"
#include "core/gimpimage.h"
#include "core/gimpimage-mask.h"
#include "widgets/gimpcolorpanel.h"
#include "drawable.h"
#include "floating_sel.h"
#include "gdisplay.h"
#include "gimage_mask.h"
#include "gimpchannel.h"
#include "gimpcontext.h"
#include "gimpimage.h"
#include "global_edit.h"
#include "qmask.h"
#include "undo.h"

View File

@ -29,15 +29,16 @@
#include "apptypes.h"
#include "core/gimpchannel.h"
#include "core/gimpcontext.h"
#include "core/gimpimage.h"
#include "core/gimpimage-mask.h"
#include "widgets/gimpcolorpanel.h"
#include "drawable.h"
#include "floating_sel.h"
#include "gdisplay.h"
#include "gimage_mask.h"
#include "gimpchannel.h"
#include "gimpcontext.h"
#include "gimpimage.h"
#include "global_edit.h"
#include "qmask.h"
#include "undo.h"

View File

@ -33,9 +33,9 @@
#include "drawable.h"
#include "floating_sel.h"
#include "gdisplay.h"
#include "gimage_mask.h"
#include "gimpcontext.h"
#include "gimpimage.h"
#include "gimpimage-mask.h"
#include "gimpimage-undo.h"
#include "gimplayer.h"
#include "gimplayermask.h"

View File

@ -33,9 +33,9 @@
#include "drawable.h"
#include "floating_sel.h"
#include "gdisplay.h"
#include "gimage_mask.h"
#include "gimpcontext.h"
#include "gimpimage.h"
#include "gimpimage-mask.h"
#include "gimpimage-undo.h"
#include "gimplayer.h"
#include "gimplayermask.h"

View File

@ -27,6 +27,13 @@
#include "paint-funcs/paint-funcs.h"
#include "core/gimpchannel.h"
#include "core/gimpcontainer.h"
#include "core/gimpimage.h"
#include "core/gimpimage-mask.h"
#include "core/gimplayer.h"
#include "core/gimplayermask.h"
#include "tools/gimpbycolorselecttool.h"
#include "tools/gimptool.h"
#include "tools/gimpdrawtool.h"
@ -38,12 +45,6 @@
#include "floating_sel.h"
#include "gdisplay.h"
#include "gdisplay_ops.h"
#include "gimage.h"
#include "gimage_mask.h"
#include "gimpchannel.h"
#include "gimpcontainer.h"
#include "gimplayer.h"
#include "gimplayermask.h"
#include "gimpparasite.h"
#include "gimprc.h"
#include "parasitelist.h"

View File

@ -33,9 +33,9 @@
#include "drawable.h"
#include "floating_sel.h"
#include "gdisplay.h"
#include "gimage_mask.h"
#include "gimpcontext.h"
#include "gimpimage.h"
#include "gimpimage-mask.h"
#include "gimpimage-undo.h"
#include "gimplayer.h"
#include "gimplayermask.h"

View File

@ -24,11 +24,11 @@
#include "paint-funcs/paint-funcs.h"
#include "core/gimpdrawable.h"
#include "core/gimpimage.h"
#include "drawable.h"
#include "gdisplay.h"
#include "gimage_mask.h"
#include "gimpdrawable.h"
#include "gimpimage.h"
#include "image_map.h"
#include "pixel_region.h"
#include "tile.h"

View File

@ -26,15 +26,15 @@
#include "paint-funcs/paint-funcs.h"
#include "core/gimpimage.h"
#include "core/gimpimage-mask.h"
#include "core/gimplayer.h"
#include "core/gimplayermask.h"
#include "boundary.h"
#include "drawable.h"
#include "floating_sel.h"
#include "gdisplay.h"
#include "gimage_mask.h"
#include "gimpcontainer.h"
#include "gimpimage.h"
#include "gimplayer.h"
#include "gimplayermask.h"
#include "pixel_region.h"
#include "tile_manager.h"
#include "undo.h"

View File

@ -35,7 +35,6 @@
#include "drawable.h"
#include "floating_sel.h"
#include "gdisplay.h"
#include "gimage_mask.h"
#include "gimpdrawable-invert.h"
#include "gimpimage.h"
#include "gimplayer.h"

View File

@ -19,7 +19,7 @@
#define __PARASITE_LIST_H__
#include "gimpobject.h"
#include "core/gimpobject.h"
#define GIMP_TYPE_PARASITE_LIST (parasite_list_get_type ())

View File

@ -33,9 +33,9 @@
#include "drawable.h"
#include "floating_sel.h"
#include "gdisplay.h"
#include "gimage_mask.h"
#include "gimpcontext.h"
#include "gimpimage.h"
#include "gimpimage-mask.h"
#include "gimpimage-undo.h"
#include "gimplayer.h"
#include "gimplayermask.h"

View File

@ -27,6 +27,13 @@
#include "apptypes.h"
#include "core/gimpchannel.h"
#include "core/gimpcontainer.h"
#include "core/gimpcontext.h"
#include "core/gimpimage.h"
#include "core/gimpimage-mask.h"
#include "core/gimplayer.h"
#include "tools/gimptool.h"
#include "tools/tool_manager.h"
@ -42,13 +49,6 @@
#include "appenv.h"
#include "colormaps.h"
#include "gimage.h"
#include "gimage_mask.h"
#include "gimpchannel.h"
#include "gimpcontainer.h"
#include "gimpcontext.h"
#include "gimpdrawable.h"
#include "gimplayer.h"
#include "gimprc.h"
#include "gximage.h"
#include "image_render.h"

View File

@ -26,9 +26,9 @@
#include "apptypes.h"
#include "gimpchannel.h"
#include "gimpdrawable.h"
#include "gimpimage.h"
#include "core/gimpchannel.h"
#include "core/gimpimage.h"
#include "pixel_region.h"
#include "scan_convert.h"

View File

@ -22,8 +22,9 @@
#include "apptypes.h"
#include "core/gimpcontext.h"
#include "context_manager.h"
#include "gimpcontext.h"
#include "gimptoolinfo.h"
#include "temp_buf.h"

View File

@ -20,7 +20,7 @@
#define __GIMP_TOOL_INFO_H__
#include "gimpdata.h"
#include "core/gimpdata.h"
#define GIMP_TYPE_TOOL_INFO (gimp_tool_info_get_type ())

View File

@ -20,9 +20,6 @@
#define __TOOL_OPTIONS_H__
#include "gimpobject.h"
/* the tool options structures */
struct _ToolOptions
@ -32,13 +29,6 @@ struct _ToolOptions
ToolOptionsResetFunc reset_func;
};
struct _ToolOptionsClass
{
GimpObjectClass parent_class;
};
typedef struct _ToolOptionsClass ToolOptionsClass;
/* create a dummy tool options structure
* (to be used by tools without options)
*/

View File

@ -29,22 +29,23 @@
#include "apptypes.h"
#include "widgets/widgets-types.h"
#include "tools/gimptoolinfo.h"
#include "tools/tool_manager.h"
#include "core/gimpbrush.h"
#include "core/gimpcontainer.h"
#include "core/gimpcontext.h"
#include "core/gimpdatafactory.h"
#include "core/gimpgradient.h"
#include "core/gimppattern.h"
#include "widgets/gimpdnd.h"
#include "widgets/gimppreview.h"
#include "tools/gimptoolinfo.h"
#include "tools/tool_manager.h"
#include "appenv.h"
#include "context_manager.h"
#include "devices.h"
#include "dialog_handler.h"
#include "gimpbrush.h"
#include "gimpcontext.h"
#include "gimpdatafactory.h"
#include "gimpgradient.h"
#include "gimppattern.h"
#include "gimplist.h"
#include "gimprc.h"
#include "libgimp/gimpenv.h"

View File

@ -24,6 +24,12 @@
#include "apptypes.h"
#include "core/gimpdatafactory.h"
#include "core/gimpimage.h"
#include "core/gimpimage-convert.h"
#include "core/gimplist.h"
#include "core/gimppalette.h"
#include "tools/gimptool.h"
#include "tools/tool_manager.h"
@ -32,13 +38,6 @@
#include "context_manager.h"
#include "floating_sel.h"
#include "gimpdatafactory.h"
#include "gimpdrawable.h"
#include "gimpimage.h"
#include "gimpimage-convert.h"
#include "gimplist.h"
#include "gimplayer.h"
#include "gimppalette.h"
#include "libgimp/gimpintl.h"

View File

@ -26,9 +26,12 @@
#include "apptypes.h"
#include "widgets/widgets-types.h"
#include "tools/gimptoolinfo.h"
#include "tools/tool_manager.h"
#include "tools/tool_options_dialog.h"
#include "core/gimpbrushgenerated.h"
#include "core/gimpchannel.h"
#include "core/gimpcontext.h"
#include "core/gimpgradient.h"
#include "core/gimpimage.h"
#include "core/gimplayer.h"
#include "widgets/gimpcontainerlistview.h"
#include "widgets/gimpcontainergridview.h"
@ -41,6 +44,10 @@
#include "widgets/gimplistitem.h"
#include "widgets/gimppreview.h"
#include "tools/gimptoolinfo.h"
#include "tools/tool_manager.h"
#include "tools/tool_options_dialog.h"
#include "about-dialog.h"
#include "brush-editor.h"
#include "brush-select.h"
@ -64,15 +71,6 @@
#include "context_manager.h"
#include "gdisplay.h"
#include "gimpbrush.h"
#include "gimpbrushgenerated.h"
#include "gimpchannel.h"
#include "gimpcontainer.h"
#include "gimpcontext.h"
#include "gimpdatafactory.h"
#include "gimpgradient.h"
#include "gimpimage.h"
#include "gimplayer.h"
#include "gimprc.h"
#include "module_db.h"
#include "undo_history.h"

View File

@ -23,14 +23,14 @@
#include "apptypes.h"
#include "widgets/widgets-types.h"
#include "core/gimpcontext.h"
#include "widgets/gimpdialogfactory.h"
#include "dialogs.h"
#include "dialogs-constructors.h"
#include "menus.h"
#include "gimpcontext.h"
GimpDialogFactory *global_dialog_factory = NULL;
GimpDialogFactory *global_dock_factory = NULL;

View File

@ -40,6 +40,9 @@
#include "apptypes.h"
#include "core/gimpcontext.h"
#include "core/gimpimage.h"
#include "cursorutil.h"
#include "file-dialog-utils.h"
#include "file-open-dialog.h"
@ -49,10 +52,7 @@
#include "gimpui.h"
#include "gui/menus.h"
#include "gimpdrawable.h"
#include "gimage.h"
#include "gimpcontext.h"
#include "gimpdrawable.h"
#include "gimprc.h"
#include "file-open.h"
#include "file-utils.h"

View File

@ -34,6 +34,9 @@
#include "apptypes.h"
#include "core/gimpdrawable.h"
#include "core/gimpimage.h"
#include "cursorutil.h"
#include "dialog_handler.h"
#include "docindex.h"
@ -43,10 +46,6 @@
#include "gimpui.h"
#include "menus.h"
#include "gimpdrawable.h"
#include "gimage.h"
#include "gimpcontext.h"
#include "gimpdrawable.h"
#include "gimprc.h"
#include "file-save.h"
#include "file-utils.h"

View File

@ -25,21 +25,22 @@
#include "apptypes.h"
#include "widgets/widgets-types.h"
#include "core/gimpcontainer.h"
#include "core/gimpcontext.h"
#include "core/gimpimage.h"
#include "widgets/gimppreview.h"
#include "tools/gimptool.h"
#include "tools/gimpcolorpickertool.h"
#include "tools/tool_manager.h"
#include "widgets/gimppreview.h"
#include "gdisplay.h"
#include "info-dialog.h"
#include "info-window.h"
#include "context_manager.h"
#include "colormaps.h"
#include "gimpcontainer.h"
#include "gimpcontext.h"
#include "gimpimage.h"
#include "libgimp/gimpintl.h"

View File

@ -37,11 +37,12 @@
#include "apptypes.h"
#include "core/gimplist.h"
#include "appenv.h"
#include "module_db.h"
#include "gimprc.h"
#include "datafiles.h"
#include "gimplist.h"
#include "libgimp/gimpenv.h"
#include "libgimp/gimpmodule.h"

View File

@ -25,12 +25,11 @@
#include "apptypes.h"
#include "apptypes.h"
#include "core/gimpdrawable.h"
#include "core/gimpdrawable-offset.h"
#include "core/gimpimage.h"
#include "gdisplay.h"
#include "gimpcontext.h"
#include "gimpdrawable.h"
#include "gimpdrawable-offset.h"
#include "gimpimage.h"
#include "libgimp/gimpintl.h"

View File

@ -27,19 +27,20 @@
#include "apptypes.h"
#include "core/gimpcontainer.h"
#include "core/gimpcontext.h"
#include "core/gimpdatafactory.h"
#include "core/gimpgradient.h"
#include "core/gimpimage.h"
#include "core/gimppalette.h"
#include "core/gimppalette-import.h"
#include "gradient-select.h"
#include "palette-editor.h"
#include "palette-import-dialog.h"
#include "context_manager.h"
#include "gimage.h"
#include "gimpcontainer.h"
#include "gimpcontext.h"
#include "gimpdatafactory.h"
#include "gimpgradient.h"
#include "gimpimage.h"
#include "gimppalette.h"
#include "gimppalette-import.h"
#include "temp_buf.h"
#include "libgimp/gimpintl.h"

View File

@ -28,6 +28,9 @@
#include "apptypes.h"
#include "core/gimpcontainer.h"
#include "core/gimpimage.h"
#include "cursorutil.h"
#include "gdisplay.h"
#include "layer-select.h"
@ -36,9 +39,7 @@
#include "colormaps.h"
#include "context_manager.h"
#include "gdisplay_ops.h"
#include "gimpcontainer.h"
#include "gimphelp.h"
#include "gimpimage.h"
#include "gimprc.h"
#include "image_render.h"
#include "lc_dialog.h"

View File

@ -25,10 +25,11 @@
#include "apptypes.h"
#include "core/gimpimage.h"
#include "core/gimplayer.h"
#include "core/gimplist.h"
#include "gdisplay.h"
#include "gimpimage.h"
#include "gimplayer.h"
#include "gimplist.h"
#include "gimprc.h"
#include "resize.h"
#include "undo.h"

View File

@ -29,6 +29,11 @@
#include "paint-funcs/paint-funcs.h"
#include "core/gimpcontext.h"
#include "core/gimpimage.h"
#include "core/gimplayer.h"
#include "core/gimppattern.h"
#include "tools/gimpbucketfilltool.h"
#include "tools/gimpfuzzyselecttool.h"
#include "tools/gimpmovetool.h"
@ -45,10 +50,6 @@
#include "appenv.h"
#include "drawable.h"
#include "gimpimage.h"
#include "gimpcontext.h"
#include "gimplayer.h"
#include "gimppattern.h"
#include "gimprc.h"
#include "gimpui.h"
#include "pixel_region.h"

View File

@ -29,6 +29,11 @@
#include "paint-funcs/paint-funcs.h"
#include "core/gimpcontext.h"
#include "core/gimpimage.h"
#include "core/gimplayer.h"
#include "core/gimppattern.h"
#include "tools/gimpbucketfilltool.h"
#include "tools/gimpfuzzyselecttool.h"
#include "tools/gimpmovetool.h"
@ -45,10 +50,6 @@
#include "appenv.h"
#include "drawable.h"
#include "gimpimage.h"
#include "gimpcontext.h"
#include "gimplayer.h"
#include "gimppattern.h"
#include "gimprc.h"
#include "gimpui.h"
#include "pixel_region.h"

View File

@ -24,10 +24,11 @@
#include "apptypes.h"
#include "core/gimpimage.h"
#include "colormaps.h"
#include "cursorutil.h"
#include "gdisplay_ops.h"
#include "gimpimage.h"
#include "gimprc.h"
#include "libgimp/gimpintl.h"

View File

@ -25,9 +25,10 @@
#include "apptypes.h"
#include "core/gimpimage.h"
#include "appenv.h"
#include "gdisplay.h"
#include "gimpimage.h"
#include "gimprc.h"
#include "gximage.h"
#include "image_render.h"

View File

@ -24,12 +24,13 @@
#include "apptypes.h"
#include "core/gimpimage.h"
#include "tools/gimptool.h"
#include "tools/tool_manager.h"
#include "gdisplay.h"
#include "gdisplay_ops.h"
#include "gimpimage.h"
#include "gimprc.h"
#include "nav_window.h"
#include "scale.h"

View File

@ -22,12 +22,13 @@
#include "apptypes.h"
#include "core/gimpimage.h"
#include "core/gimpimage-mask.h"
#include "boundary.h"
#include "colormaps.h"
#include "gdisplay.h"
#include "gdisplay_ops.h"
#include "gimage_mask.h"
#include "gimpimage.h"
#include "gimprc.h"
#include "selection.h"
#include "marching_ants.h"

View File

@ -27,6 +27,13 @@
#include "apptypes.h"
#include "core/gimpchannel.h"
#include "core/gimpcontainer.h"
#include "core/gimpcontext.h"
#include "core/gimpimage.h"
#include "core/gimpimage-mask.h"
#include "core/gimplayer.h"
#include "tools/gimptool.h"
#include "tools/tool_manager.h"
@ -42,13 +49,6 @@
#include "appenv.h"
#include "colormaps.h"
#include "gimage.h"
#include "gimage_mask.h"
#include "gimpchannel.h"
#include "gimpcontainer.h"
#include "gimpcontext.h"
#include "gimpdrawable.h"
#include "gimplayer.h"
#include "gimprc.h"
#include "gximage.h"
#include "image_render.h"

View File

@ -29,6 +29,11 @@
#include "paint-funcs/paint-funcs.h"
#include "core/gimpcontext.h"
#include "core/gimpimage.h"
#include "core/gimplayer.h"
#include "core/gimppattern.h"
#include "tools/gimpbucketfilltool.h"
#include "tools/gimpfuzzyselecttool.h"
#include "tools/gimpmovetool.h"
@ -45,10 +50,6 @@
#include "appenv.h"
#include "drawable.h"
#include "gimpimage.h"
#include "gimpcontext.h"
#include "gimplayer.h"
#include "gimppattern.h"
#include "gimprc.h"
#include "gimpui.h"
#include "pixel_region.h"

View File

@ -24,6 +24,9 @@
#include "apptypes.h"
#include "core/gimpimage.h"
#include "core/gimppattern.h"
#include "widgets/gimpdnd.h"
#include "disp_callbacks.h"
@ -34,8 +37,6 @@
#include "nav_window.h"
#include "gimphelp.h"
#include "gimpimage.h"
#include "gimppattern.h"
#include "gimprc.h"
#include "qmask.h"

View File

@ -23,13 +23,13 @@
#include "apptypes.h"
#include "core/gimpimage.h"
#include "core/gimplayer.h"
#include "layer-select.h"
#include "gdisplay.h"
#include "layers-dialog.h"
#include "gimpdrawable.h"
#include "gimpimage.h"
#include "gimplayer.h"
#include "gimprc.h"
#include "temp_buf.h"

View File

@ -29,15 +29,16 @@
#include "apptypes.h"
#include "core/gimpchannel.h"
#include "core/gimpcontext.h"
#include "core/gimpimage.h"
#include "core/gimpimage-mask.h"
#include "widgets/gimpcolorpanel.h"
#include "drawable.h"
#include "floating_sel.h"
#include "gdisplay.h"
#include "gimage_mask.h"
#include "gimpchannel.h"
#include "gimpcontext.h"
#include "gimpimage.h"
#include "global_edit.h"
#include "qmask.h"
#include "undo.h"

View File

@ -25,9 +25,10 @@
#include "apptypes.h"
#include "core/gimpimage.h"
#include "appenv.h"
#include "gdisplay.h"
#include "gimpimage.h"
#include "gimprc.h"
#include "gximage.h"
#include "image_render.h"

View File

@ -24,12 +24,13 @@
#include "apptypes.h"
#include "core/gimpimage.h"
#include "tools/gimptool.h"
#include "tools/tool_manager.h"
#include "gdisplay.h"
#include "gdisplay_ops.h"
#include "gimpimage.h"
#include "gimprc.h"
#include "nav_window.h"
#include "scale.h"

View File

@ -22,12 +22,13 @@
#include "apptypes.h"
#include "core/gimpimage.h"
#include "core/gimpimage-mask.h"
#include "boundary.h"
#include "colormaps.h"
#include "gdisplay.h"
#include "gdisplay_ops.h"
#include "gimage_mask.h"
#include "gimpimage.h"
#include "gimprc.h"
#include "selection.h"
#include "marching_ants.h"

View File

@ -24,6 +24,9 @@
#include "apptypes.h"
#include "core/gimpimage.h"
#include "core/gimppattern.h"
#include "widgets/gimpdnd.h"
#include "disp_callbacks.h"
@ -34,8 +37,6 @@
#include "nav_window.h"
#include "gimphelp.h"
#include "gimpimage.h"
#include "gimppattern.h"
#include "gimprc.h"
#include "qmask.h"

View File

@ -27,6 +27,10 @@
#include "apptypes.h"
#include "core/gimpcontainer.h"
#include "core/gimpcontext.h"
#include "core/gimpimage.h"
#include "cursorutil.h"
#include "dialog_handler.h"
#include "gui/info-dialog.h"
@ -35,9 +39,6 @@
#include "nav_window.h"
#include "context_manager.h"
#include "gimpcontainer.h"
#include "gimpcontext.h"
#include "gimage.h"
#include "gimprc.h"
#include "scroll.h"
#include "scale.h"

View File

@ -27,6 +27,10 @@
#include "apptypes.h"
#include "core/gimpcontainer.h"
#include "core/gimpcontext.h"
#include "core/gimpimage.h"
#include "cursorutil.h"
#include "dialog_handler.h"
#include "gui/info-dialog.h"
@ -35,9 +39,6 @@
#include "nav_window.h"
#include "context_manager.h"
#include "gimpcontainer.h"
#include "gimpcontext.h"
#include "gimage.h"
#include "gimprc.h"
#include "scroll.h"
#include "scale.h"

View File

@ -26,6 +26,8 @@
#include "apptypes.h"
#include "core/gimpobject.h"
#include "widgets/gimpdnd.h"
#include "gui/file-open-dialog.h"
@ -33,7 +35,6 @@
#include "dialog_handler.h"
#include "docindex.h"
#include "gdisplay.h"
#include "gimpimage.h"
#include "ops_buttons.h"
#include "libgimp/gimpenv.h"

View File

@ -24,9 +24,10 @@
#include "apptypes.h"
#include "core/gimpdrawable.h"
#include "core/gimpcontext.h"
#include "drawable.h"
#include "gimpcontext.h"
#include "gimpimage.h"
#include "gdisplay.h"
#include "undo.h"

View File

@ -20,9 +20,6 @@
#define __DRAWABLE_H__
#include "gimpdrawable.h"
void drawable_fill (GimpDrawable *drawable,
GimpFillType fill_type);
void drawable_update (GimpDrawable *drawable,

View File

@ -59,10 +59,9 @@
#include "apptypes.h"
#include "gimpdrawable.h"
#include "core/gimpimage.h"
#include "gimage.h"
#include "gimpcontext.h"
#include "gimpdrawable.h"
#include "gimprc.h"
#include "file-open.h"
#include "file-utils.h"

View File

@ -62,10 +62,9 @@
#include "docindex.h"
#include "gui/menus.h"
#include "gimpdrawable.h"
#include "gimage.h"
#include "gimpcontext.h"
#include "gimpdrawable.h"
#include "core/gimpdrawable.h"
#include "core/gimpimage.h"
#include "gimprc.h"
#include "file-save.h"
#include "file-utils.h"

View File

@ -44,8 +44,9 @@
#include "apptypes.h"
#include "core/gimpimage.h"
#include "file-utils.h"
#include "gimpimage.h"
#include "plug_in.h"
#include "temp_buf.h"

View File

@ -59,10 +59,9 @@
#include "apptypes.h"
#include "gimpdrawable.h"
#include "core/gimpimage.h"
#include "gimage.h"
#include "gimpcontext.h"
#include "gimpdrawable.h"
#include "gimprc.h"
#include "file-open.h"
#include "file-utils.h"

View File

@ -62,10 +62,9 @@
#include "docindex.h"
#include "gui/menus.h"
#include "gimpdrawable.h"
#include "gimage.h"
#include "gimpcontext.h"
#include "gimpdrawable.h"
#include "core/gimpdrawable.h"
#include "core/gimpimage.h"
#include "gimprc.h"
#include "file-save.h"
#include "file-utils.h"

View File

@ -44,8 +44,9 @@
#include "apptypes.h"
#include "core/gimpimage.h"
#include "file-utils.h"
#include "gimpimage.h"
#include "plug_in.h"
#include "temp_buf.h"

View File

@ -26,15 +26,15 @@
#include "paint-funcs/paint-funcs.h"
#include "core/gimpimage.h"
#include "core/gimpimage-mask.h"
#include "core/gimplayer.h"
#include "core/gimplayermask.h"
#include "boundary.h"
#include "drawable.h"
#include "floating_sel.h"
#include "gdisplay.h"
#include "gimage_mask.h"
#include "gimpcontainer.h"
#include "gimpimage.h"
#include "gimplayer.h"
#include "gimplayermask.h"
#include "pixel_region.h"
#include "tile_manager.h"
#include "undo.h"

View File

@ -27,6 +27,13 @@
#include "apptypes.h"
#include "core/gimpchannel.h"
#include "core/gimpcontainer.h"
#include "core/gimpcontext.h"
#include "core/gimpimage.h"
#include "core/gimpimage-mask.h"
#include "core/gimplayer.h"
#include "tools/gimptool.h"
#include "tools/tool_manager.h"
@ -42,13 +49,6 @@
#include "appenv.h"
#include "colormaps.h"
#include "gimage.h"
#include "gimage_mask.h"
#include "gimpchannel.h"
#include "gimpcontainer.h"
#include "gimpcontext.h"
#include "gimpdrawable.h"
#include "gimplayer.h"
#include "gimprc.h"
#include "gximage.h"
#include "image_render.h"

View File

@ -24,10 +24,11 @@
#include "apptypes.h"
#include "core/gimpimage.h"
#include "colormaps.h"
#include "cursorutil.h"
#include "gdisplay_ops.h"
#include "gimpimage.h"
#include "gimprc.h"
#include "libgimp/gimpintl.h"

View File

@ -24,6 +24,9 @@
#include "paint-funcs/paint-funcs.h"
#include "core/gimpcontainer.h"
#include "core/gimpimage.h"
#include "tools/gimptool.h"
#include "tools/tool_manager.h"
@ -34,11 +37,6 @@
#include "context_manager.h"
#include "gimage.h"
#include "gimpcontainer.h"
#include "gimpdrawable.h"
#include "gimpimage.h"
#include "gimplayer.h"
#include "gimplayermask.h"
#include "undo.h"

View File

@ -20,9 +20,6 @@
#define __GIMAGE_H__
#include "gimpimage.h"
GimpImage * gimage_new (gint width,
gint height,
GimpImageBaseType base_type);

View File

@ -1,664 +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 "tools/gimptool.h"
#include "tools/gimppainttool.h"
#include "tools/paint_options.h"
#include "tools/tool_manager.h"
#include "boundary.h"
#include "drawable.h"
#include "floating_sel.h"
#include "gdisplay.h"
#include "gimage_mask.h"
#include "gimpchannel.h"
#include "gimpimage.h"
#include "gimplayer.h"
#include "gimplayermask.h"
#include "gimprc.h"
#include "pixel_region.h"
#include "tile_manager.h"
#include "undo.h"
#include "pdb/procedural_db.h"
#include "libgimp/gimpintl.h"
/* local variables */
static int gimage_mask_stroking = FALSE;
/* functions */
gboolean
gimage_mask_boundary (GimpImage *gimage,
BoundSeg **segs_in,
BoundSeg **segs_out,
gint *num_segs_in,
gint *num_segs_out)
{
GimpDrawable *d;
GimpLayer *layer;
gint x1, y1;
gint x2, y2;
if ((layer = gimp_image_floating_sel (gimage)))
{
/* If there is a floating selection, then
* we need to do some slightly different boundaries.
* Instead of inside and outside boundaries being defined
* by the extents of the layer, the inside boundary (the one
* that actually marches and is black/white) is the boundary of
* the floating selection. The outside boundary (doesn't move,
* is black/gray) is defined as the normal selection mask
*/
/* Find the selection mask boundary */
gimp_channel_boundary (gimp_image_get_mask (gimage),
segs_in, segs_out,
num_segs_in, num_segs_out,
0, 0, 0, 0);
/* Find the floating selection boundary */
*segs_in = floating_sel_boundary (layer, num_segs_in);
return TRUE;
}
/* Otherwise, return the boundary...if a channel is active */
else if ((d = gimp_image_active_drawable (gimage)) &&
GIMP_IS_CHANNEL (d))
{
return gimp_channel_boundary (gimp_image_get_mask (gimage),
segs_in, segs_out,
num_segs_in, num_segs_out,
0, 0, gimage->width, gimage->height);
}
/* if a layer is active, we return multiple boundaries based on the extents */
else if ((layer = gimp_image_get_active_layer (gimage)))
{
gint off_x, off_y;
gimp_drawable_offsets (GIMP_DRAWABLE(layer), &off_x, &off_y);
x1 = CLAMP (off_x, 0, gimage->width);
y1 = CLAMP (off_y, 0, gimage->height);
x2 = CLAMP (off_x + gimp_drawable_width (GIMP_DRAWABLE(layer)), 0,
gimage->width);
y2 = CLAMP (off_y + gimp_drawable_height (GIMP_DRAWABLE(layer)), 0,
gimage->height);
return gimp_channel_boundary (gimp_image_get_mask (gimage),
segs_in, segs_out,
num_segs_in, num_segs_out,
x1, y1, x2, y2);
}
else
{
*segs_in = NULL;
*segs_out = NULL;
*num_segs_in = 0;
*num_segs_out = 0;
return FALSE;
}
}
gboolean
gimage_mask_bounds (GimpImage *gimage,
gint *x1,
gint *y1,
gint *x2,
gint *y2)
{
return gimp_channel_bounds (gimp_image_get_mask (gimage), x1, y1, x2, y2);
}
void
gimage_mask_invalidate (GimpImage *gimage)
{
GimpLayer *layer;
GimpChannel *mask;
/* Turn the current selection off */
gdisplays_selection_visibility (gimage, SelectionOff);
mask = gimp_image_get_mask (gimage);
mask->boundary_known = FALSE;
/* If there is a floating selection, update it's area...
* we need to do this since this selection mask can act as an additional
* mask in the composition of the floating selection
*/
layer = gimp_image_get_active_layer (gimage);
if (layer && gimp_layer_is_floating_sel (layer))
drawable_update (GIMP_DRAWABLE (layer),
0, 0,
GIMP_DRAWABLE (layer)->width,
GIMP_DRAWABLE (layer)->height);
}
gint
gimage_mask_value (GimpImage *gimage,
gint x,
gint y)
{
return gimp_channel_value (gimp_image_get_mask (gimage), x, y);
}
gboolean
gimage_mask_is_empty (GimpImage *gimage)
{
/* in order to allow stroking of selections, we need to pretend here
* that the selection mask is empty so that it doesn't mask the paint
* during the stroke operation.
*/
if (gimage_mask_stroking)
return TRUE;
else
return gimp_channel_is_empty (gimp_image_get_mask (gimage));
}
void
gimage_mask_translate (GimpImage *gimage,
gint off_x,
gint off_y)
{
gimp_channel_translate (gimp_image_get_mask (gimage), off_x, off_y);
}
TileManager *
gimage_mask_extract (GimpImage *gimage,
GimpDrawable *drawable,
gboolean cut_gimage,
gboolean keep_indexed,
gboolean add_alpha)
{
TileManager *tiles;
GimpChannel *sel_mask;
PixelRegion srcPR, destPR, maskPR;
guchar bg[MAX_CHANNELS];
gint bytes, type;
gint x1, y1;
gint x2, y2;
gint off_x, off_y;
gboolean non_empty;
if (!drawable)
return NULL;
/* If there are no bounds, then just extract the entire image
* This may not be the correct behavior, but after getting rid
* of floating selections, it's still tempting to "cut" or "copy"
* a small layer and expect it to work, even though there is no
* actual selection mask
*/
non_empty = gimp_drawable_mask_bounds (drawable, &x1, &y1, &x2, &y2);
if (non_empty && (!(x2 - x1) || !(y2 - y1)))
{
g_message (_("Unable to cut/copy because the selected\n"
"region is empty."));
return NULL;
}
/* How many bytes in the temp buffer? */
switch (gimp_drawable_type (drawable))
{
case RGB_GIMAGE: case RGBA_GIMAGE:
bytes = add_alpha ? 4 : drawable->bytes;
type = RGB;
break;
case GRAY_GIMAGE: case GRAYA_GIMAGE:
bytes = add_alpha ? 2 : drawable->bytes;
type = GRAY;
break;
case INDEXED_GIMAGE: case INDEXEDA_GIMAGE:
if (keep_indexed)
{
bytes = add_alpha ? 2 : drawable->bytes;
type = GRAY;
}
else
{
bytes = add_alpha ? 4 : drawable->bytes;
type = INDEXED;
}
break;
default:
bytes = 3;
type = RGB;
break;
}
/* get the selection mask */
if (non_empty)
sel_mask = gimp_image_get_mask (gimage);
else
sel_mask = NULL;
gimp_image_get_background (gimage, drawable, bg);
/* If a cut was specified, and the selection mask is not empty,
* push an undo
*/
if (cut_gimage && non_empty)
drawable_apply_image (drawable, x1, y1, x2, y2, NULL, FALSE);
gimp_drawable_offsets (drawable, &off_x, &off_y);
/* Allocate the temp buffer */
tiles = tile_manager_new ((x2 - x1), (y2 - y1), bytes);
tile_manager_set_offsets (tiles, x1 + off_x, y1 + off_y);
/* configure the pixel regions */
pixel_region_init (&srcPR, gimp_drawable_data (drawable),
x1, y1, (x2 - x1), (y2 - y1), cut_gimage);
pixel_region_init (&destPR, tiles, 0, 0, (x2 - x1), (y2 - y1), TRUE);
/* If there is a selection, extract from it */
if (non_empty)
{
pixel_region_init (&maskPR, GIMP_DRAWABLE(sel_mask)->tiles,
(x1 + off_x), (y1 + off_y), (x2 - x1), (y2 - y1),
FALSE);
extract_from_region (&srcPR, &destPR, &maskPR,
gimp_drawable_cmap (drawable),
bg, type,
gimp_drawable_has_alpha (drawable), cut_gimage);
if (cut_gimage)
{
/* Clear the region */
gimp_channel_clear (gimp_image_get_mask (gimage));
/* Update the region */
gdisplays_update_area (gimage,
x1 + off_x, y1 + off_y,
(x2 - x1), (y2 - y1));
/* Invalidate the preview */
gimp_viewable_invalidate_preview (GIMP_VIEWABLE (drawable));
}
}
/* Otherwise, get the entire active layer */
else
{
/* If the layer is indexed...we need to extract pixels */
if (type == INDEXED && !keep_indexed)
extract_from_region (&srcPR, &destPR, NULL,
gimp_drawable_cmap (drawable),
bg, type,
gimp_drawable_has_alpha (drawable), FALSE);
/* If the layer doesn't have an alpha channel, add one */
else if (bytes > srcPR.bytes)
add_alpha_region (&srcPR, &destPR);
/* Otherwise, do a straight copy */
else
copy_region (&srcPR, &destPR);
/* If we're cutting, remove either the layer (or floating selection),
* the layer mask, or the channel
*/
if (cut_gimage && GIMP_IS_LAYER (drawable))
{
if (gimp_layer_is_floating_sel (GIMP_LAYER (drawable)))
floating_sel_remove (GIMP_LAYER (drawable));
else
gimp_image_remove_layer (gimage, GIMP_LAYER (drawable));
}
else if (cut_gimage && GIMP_IS_LAYER_MASK (drawable))
{
gimp_layer_apply_mask (gimp_layer_mask_get_layer (GIMP_LAYER_MASK (drawable)),
DISCARD, TRUE);
}
else if (cut_gimage && GIMP_IS_CHANNEL (drawable))
gimp_image_remove_channel (gimage, GIMP_CHANNEL (drawable));
}
return tiles;
}
GimpLayer *
gimage_mask_float (GimpImage *gimage,
GimpDrawable *drawable,
gint off_x, /* optional offset */
gint off_y)
{
GimpLayer *layer;
GimpChannel *mask = gimp_image_get_mask (gimage);
TileManager *tiles;
gboolean non_empty;
gint x1, y1;
gint x2, y2;
/* Make sure there is a region to float... */
non_empty = gimp_drawable_mask_bounds ( (drawable), &x1, &y1, &x2, &y2);
if (! non_empty || (x2 - x1) == 0 || (y2 - y1) == 0)
{
g_message (_("Float Selection: No selection to float."));
return NULL;
}
/* Start an undo group */
undo_push_group_start (gimage, FLOAT_MASK_UNDO);
/* Cut the selected region */
tiles = gimage_mask_extract (gimage, drawable, TRUE, FALSE, TRUE);
/* Create a new layer from the buffer */
layer = gimp_layer_new_from_tiles (gimage,
gimp_drawable_type_with_alpha (drawable),
tiles,
_("Floating Selection"),
OPAQUE_OPACITY, NORMAL_MODE);
/* Set the offsets */
tile_manager_get_offsets (tiles, &x1, &y1);
GIMP_DRAWABLE (layer)->offset_x = x1 + off_x;
GIMP_DRAWABLE (layer)->offset_y = y1 + off_y;
/* Free the temp buffer */
tile_manager_destroy (tiles);
/* Add the floating layer to the gimage */
floating_sel_attach (layer, drawable);
/* End an undo group */
undo_push_group_end (gimage);
/* invalidate the gimage's boundary variables */
mask->boundary_known = FALSE;
return layer;
}
void
gimage_mask_clear (GimpImage *gimage)
{
gimp_channel_clear (gimp_image_get_mask (gimage));
}
void
gimage_mask_undo (GimpImage *gimage)
{
gimp_channel_push_undo (gimp_image_get_mask (gimage));
}
void
gimage_mask_invert (GimpImage *gimage)
{
gimp_channel_invert (gimp_image_get_mask (gimage));
}
void
gimage_mask_sharpen (GimpImage *gimage)
{
/* No need to play with the selection visibility
* because sharpen will not change the outline
*/
gimp_channel_sharpen (gimp_image_get_mask (gimage));
}
void
gimage_mask_all (GimpImage *gimage)
{
gimp_channel_all (gimp_image_get_mask (gimage));
}
void
gimage_mask_none (GimpImage *gimage)
{
gimp_channel_clear (gimp_image_get_mask (gimage));
}
void
gimage_mask_feather (GimpImage *gimage,
gdouble feather_radius_x,
gdouble feather_radius_y)
{
/* push the current mask onto the undo stack--need to do this here because
* gimp_channel_feather doesn't do it
*/
gimp_channel_push_undo (gimp_image_get_mask (gimage));
/* feather the region */
gimp_channel_feather (gimp_image_get_mask (gimage),
gimp_image_get_mask (gimage),
feather_radius_x,
feather_radius_y,
CHANNEL_OP_REPLACE, 0, 0);
}
void
gimage_mask_border (GimpImage *gimage,
gint border_radius_x,
gint border_radius_y)
{
/* feather the region */
gimp_channel_border (gimp_image_get_mask (gimage),
border_radius_x,
border_radius_y);
}
void
gimage_mask_grow (GimpImage *gimage,
int grow_pixels_x,
int grow_pixels_y)
{
/* feather the region */
gimp_channel_grow (gimp_image_get_mask (gimage),
grow_pixels_x,
grow_pixels_y);
}
void
gimage_mask_shrink (GimpImage *gimage,
gint shrink_pixels_x,
gint shrink_pixels_y,
gboolean edge_lock)
{
/* feather the region */
gimp_channel_shrink (gimp_image_get_mask (gimage),
shrink_pixels_x,
shrink_pixels_y,
edge_lock);
}
void
gimage_mask_layer_alpha (GimpImage *gimage,
GimpLayer *layer)
{
/* extract the layer's alpha channel */
if (gimp_drawable_has_alpha (GIMP_DRAWABLE (layer)))
{
/* load the mask with the given layer's alpha channel */
gimp_channel_layer_alpha (gimp_image_get_mask (gimage), layer);
}
else
{
g_message (_("The active layer has no alpha channel\n"
"to convert to a selection."));
return;
}
}
void
gimage_mask_layer_mask (GimpImage *gimage,
GimpLayer *layer)
{
/* extract the layer's alpha channel */
if (gimp_layer_get_mask (layer))
{
/* load the mask with the given layer's alpha channel */
gimp_channel_layer_mask (gimp_image_get_mask (gimage), layer);
}
else
{
g_message (_("The active layer has no mask\n"
"to convert to a selection."));
return;
}
}
void
gimage_mask_load (GimpImage *gimage,
GimpChannel *channel)
{
/* Load the specified channel to the gimage mask */
gimp_channel_load (gimp_image_get_mask (gimage), (channel));
}
GimpChannel *
gimage_mask_save (GimpImage *gimage)
{
GimpChannel *new_channel;
new_channel = gimp_channel_copy (gimp_image_get_mask (gimage), TRUE);
/* saved selections are not visible by default */
gimp_drawable_set_visible (GIMP_DRAWABLE (new_channel), FALSE);
gimp_image_add_channel (gimage, new_channel, -1);
return new_channel;
}
gboolean
gimage_mask_stroke (GimpImage *gimage,
GimpDrawable *drawable)
{
BoundSeg *bs_in;
BoundSeg *bs_out;
gint num_segs_in;
gint num_segs_out;
BoundSeg *stroke_segs;
gint num_strokes;
gint seg;
gint offx, offy;
gint i;
gdouble *stroke_points;
gint cpnt;
Argument *return_vals;
gint nreturn_vals;
if (! gimage_mask_boundary (gimage, &bs_in, &bs_out,
&num_segs_in, &num_segs_out))
{
g_message (_("No selection to stroke!"));
return FALSE;
}
stroke_segs = sort_boundary (bs_in, num_segs_in, &num_strokes);
if (num_strokes == 0)
return TRUE;
/* find the drawable offsets */
gimp_drawable_offsets (drawable, &offx, &offy);
gimage_mask_stroking = TRUE;
/* Start an undo group */
undo_push_group_start (gimage, PAINT_CORE_UNDO);
seg = 0;
cpnt = 0;
/* Largest array required (may be used in segments!) */
stroke_points = g_malloc (sizeof (gdouble) * 2 * (num_segs_in + 4));
/* we offset all coordinates by 0.5 to align the brush with the path */
stroke_points[cpnt++] = (gdouble)(stroke_segs[0].x1 - offx + 0.5);
stroke_points[cpnt++] = (gdouble)(stroke_segs[0].y1 - offy + 0.5);
for (i = 0; i < num_strokes; i++)
{
while ((stroke_segs[seg].x1 != -1 ||
stroke_segs[seg].x2 != -1 ||
stroke_segs[seg].y1 != -1 ||
stroke_segs[seg].y2 != -1))
{
stroke_points[cpnt++] = (gdouble)(stroke_segs[seg].x2 - offx + 0.5);
stroke_points[cpnt++] = (gdouble)(stroke_segs[seg].y2 - offy + 0.5);
seg ++;
}
/* Close the stroke points up */
stroke_points[cpnt++] = stroke_points[0];
stroke_points[cpnt++] = stroke_points[1];
/* Stroke with the correct tool */
return_vals =
procedural_db_run_proc (tool_manager_active_get_PDB_string (),
&nreturn_vals,
PDB_DRAWABLE, gimp_drawable_get_ID (drawable),
PDB_INT32, (gint32) cpnt,
PDB_FLOATARRAY, stroke_points,
PDB_END);
if (return_vals && return_vals[0].value.pdb_int == PDB_SUCCESS)
{
/* Not required */
/*gdisplays_flush ();*/
}
else
g_message (_("Paintbrush operation failed."));
procedural_db_destroy_args (return_vals, nreturn_vals);
cpnt = 0;
seg ++;
stroke_points[cpnt++] = (gdouble)(stroke_segs[seg].x1 - offx + 0.5);
stroke_points[cpnt++] = (gdouble)(stroke_segs[seg].y1 - offy + 0.5);
}
/* cleanup */
gimage_mask_stroking = FALSE;
g_free (stroke_points);
g_free (stroke_segs);
/* End an undo group */
undo_push_group_end (gimage);
return TRUE;
}

View File

@ -1,97 +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 __GIMAGE_MASK_H__
#define __GIMAGE_MASK_H__
gboolean gimage_mask_boundary (GimpImage *gimage,
BoundSeg **segs_in,
BoundSeg **segs_out,
gint *num_segs_in,
gint *num_segs_out);
gboolean gimage_mask_bounds (GimpImage *gimage,
gint *x1,
gint *y1,
gint *x2,
gint *y2);
void gimage_mask_invalidate (GimpImage *gimage);
gint gimage_mask_value (GimpImage *gimage,
gint x,
gint y);
gboolean gimage_mask_is_empty (GimpImage *gimage);
void gimage_mask_translate (GimpImage *gimage,
gint off_x,
gint off_y);
TileManager * gimage_mask_extract (GimpImage *gimage,
GimpDrawable *drawable,
gboolean cut_gimage,
gboolean keep_indexed,
gboolean add_alpha);
GimpLayer * gimage_mask_float (GimpImage *gimage,
GimpDrawable *drawable,
gint off_x,
gint off_y);
void gimage_mask_clear (GimpImage *gimage);
void gimage_mask_undo (GimpImage *gimage);
void gimage_mask_invert (GimpImage *gimage);
void gimage_mask_sharpen (GimpImage *gimage);
void gimage_mask_all (GimpImage *gimage);
void gimage_mask_none (GimpImage *gimage);
void gimage_mask_feather (GimpImage *gimage,
gdouble feather_radius_x,
gdouble feather_radius_y);
void gimage_mask_border (GimpImage *gimage,
gint border_radius_x,
gint border_radius_y);
void gimage_mask_grow (GimpImage *gimage,
gint grow_pixels_x,
gint grow_pixels_y);
void gimage_mask_shrink (GimpImage *gimage,
gint shrink_pixels_x,
gint shrink_pixels_y,
gboolean edge_lock);
void gimage_mask_layer_alpha (GimpImage *gimage,
GimpLayer *layer);
void gimage_mask_layer_mask (GimpImage *gimage,
GimpLayer *layer);
void gimage_mask_load (GimpImage *gimage,
GimpChannel *channel);
GimpChannel * gimage_mask_save (GimpImage *gimage);
gboolean gimage_mask_stroke (GimpImage *gimage,
GimpDrawable *drawable);
#endif /* __GIMAGE_MASK_H__ */

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 __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))
/* 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 /* __GIMP_BRUSH_HEADER_H__ */

View File

@ -1,503 +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 <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <fcntl.h>
#include <gtk/gtk.h>
#ifdef G_OS_WIN32 /* gets defined by glib.h */
#include <io.h>
#endif
#ifndef _O_BINARY
#define _O_BINARY 0
#endif
#include <stdio.h>
#include "apptypes.h"
#include "brush_scale.h"
#include "gimpbrush.h"
#include "gimpbrush-header.h"
#include "gimpbrushgenerated.h"
#include "gimprc.h"
#include "temp_buf.h"
/* this needs to go away */
#include "tools/gimppainttool.h"
#include "brush_scale.h"
#include "libgimp/gimpintl.h"
static void gimp_brush_class_init (GimpBrushClass *klass);
static void gimp_brush_init (GimpBrush *brush);
static void gimp_brush_destroy (GtkObject *object);
static TempBuf * gimp_brush_get_new_preview (GimpViewable *viewable,
gint width,
gint height);
static gchar * gimp_brush_get_extension (GimpData *data);
static GimpBrush * gimp_brush_select_brush (GimpPaintTool *paint_tool);
static gboolean gimp_brush_want_null_motion (GimpPaintTool *paint_tool);
static GimpViewableClass *parent_class = NULL;
GtkType
gimp_brush_get_type (void)
{
static GtkType type = 0;
if (! type)
{
static const GtkTypeInfo info =
{
"GimpBrush",
sizeof (GimpBrush),
sizeof (GimpBrushClass),
(GtkClassInitFunc) gimp_brush_class_init,
(GtkObjectInitFunc) gimp_brush_init,
/* reserved_1 */ NULL,
/* reserved_2 */ NULL,
(GtkClassInitFunc) NULL
};
type = gtk_type_unique (GIMP_TYPE_DATA, &info);
}
return type;
}
static void
gimp_brush_class_init (GimpBrushClass *klass)
{
GtkObjectClass *object_class;
GimpViewableClass *viewable_class;
GimpDataClass *data_class;
object_class = (GtkObjectClass *) klass;
viewable_class = (GimpViewableClass *) klass;
data_class = (GimpDataClass *) klass;
parent_class = gtk_type_class (GIMP_TYPE_DATA);
object_class->destroy = gimp_brush_destroy;
viewable_class->get_new_preview = gimp_brush_get_new_preview;
data_class->get_extension = gimp_brush_get_extension;
klass->select_brush = gimp_brush_select_brush;
klass->want_null_motion = gimp_brush_want_null_motion;
}
static void
gimp_brush_init (GimpBrush *brush)
{
brush->mask = NULL;
brush->pixmap = NULL;
brush->spacing = 20;
brush->x_axis.x = 15.0;
brush->x_axis.y = 0.0;
brush->y_axis.x = 0.0;
brush->y_axis.y = 15.0;
}
static void
gimp_brush_destroy (GtkObject *object)
{
GimpBrush *brush;
brush = GIMP_BRUSH (object);
if (brush->mask)
temp_buf_free (brush->mask);
if (brush->pixmap)
temp_buf_free (brush->pixmap);
if (GTK_OBJECT_CLASS (parent_class)->destroy)
GTK_OBJECT_CLASS (parent_class)->destroy (object);
}
static TempBuf *
gimp_brush_get_new_preview (GimpViewable *viewable,
gint width,
gint height)
{
GimpBrush *brush;
gboolean scale = FALSE;
gint brush_width;
gint brush_height;
gint offset_x;
gint offset_y;
TempBuf *mask_buf = NULL;
TempBuf *pixmap_buf = NULL;
TempBuf *return_buf = NULL;
guchar white[3] = { 255, 255, 255 };
guchar *mask;
guchar *buf;
guchar *b;
guchar bg;
gint x, y;
brush = GIMP_BRUSH (viewable);
mask_buf = gimp_brush_get_mask (brush);
pixmap_buf = gimp_brush_get_pixmap (brush);
brush_width = mask_buf->width;
brush_height = mask_buf->height;
if (brush_width > width || brush_height > height)
{
gdouble ratio_x = (gdouble) brush_width / width;
gdouble ratio_y = (gdouble) brush_height / height;
brush_width = (gdouble) brush_width / MAX (ratio_x, ratio_y) + 0.5;
brush_height = (gdouble) brush_height / MAX (ratio_x, ratio_y) + 0.5;
mask_buf = brush_scale_mask (mask_buf, brush_width, brush_height);
if (pixmap_buf)
{
/* TODO: the scale function should scale the pixmap and the
* mask in one run
*/
pixmap_buf =
brush_scale_pixmap (pixmap_buf, brush_width, brush_height);
}
scale = TRUE;
}
offset_x = (width - brush_width) / 2;
offset_y = (height - brush_height) / 2;
return_buf = temp_buf_new (width, height, 3, 0, 0, white);
mask = temp_buf_data (mask_buf);
buf = temp_buf_data (return_buf);
b = buf + (offset_y * return_buf->width + offset_x) * return_buf->bytes;
if (pixmap_buf)
{
guchar *pixmap = temp_buf_data (pixmap_buf);
for (y = 0; y < brush_height; y++)
{
for (x = 0; x < brush_width ; x++)
{
bg = (255 - *mask);
*b++ = bg + (*mask * *pixmap++) / 255;
*b++ = bg + (*mask * *pixmap++) / 255;
*b++ = bg + (*mask * *pixmap++) / 255;
mask++;
}
b += (return_buf->width - brush_width) * return_buf->bytes;
}
}
else
{
for (y = 0; y < brush_height; y++)
{
for (x = 0; x < brush_width ; x++)
{
bg = 255 - *mask++;
*b++ = bg;
*b++ = bg;
*b++ = bg;
}
b += (return_buf->width - brush_width) * return_buf->bytes;
}
}
if (scale)
{
temp_buf_free (mask_buf);
if (pixmap_buf)
temp_buf_free (pixmap_buf);
}
return return_buf;
}
static gchar *
gimp_brush_get_extension (GimpData *data)
{
return GIMP_BRUSH_FILE_EXTENSION;
}
GimpData *
gimp_brush_new (const gchar *name)
{
GimpBrush *brush;
g_return_val_if_fail (name != NULL, NULL);
brush = GIMP_BRUSH (gimp_brush_generated_new (5.0, 0.5, 0.0, 1.0));
gimp_object_set_name (GIMP_OBJECT (brush), name);
return GIMP_DATA (brush);
}
GimpData *
gimp_brush_get_standard (void)
{
static GimpBrush *standard_brush = NULL;
if (! standard_brush)
{
standard_brush =
GIMP_BRUSH (gimp_brush_generated_new (5.0, 0.5, 0.0, 1.0));
gimp_object_set_name (GIMP_OBJECT (standard_brush), "Standard");
/* set ref_count to 2 --> never swap the standard brush */
gtk_object_ref (GTK_OBJECT (standard_brush));
gtk_object_ref (GTK_OBJECT (standard_brush));
gtk_object_sink (GTK_OBJECT (standard_brush));
}
return GIMP_DATA (standard_brush);
}
GimpData *
gimp_brush_load (const gchar *filename)
{
GimpBrush *brush;
gint fd;
g_return_val_if_fail (filename != NULL, NULL);
fd = open (filename, O_RDONLY | _O_BINARY);
if (fd == -1)
return NULL;
brush = gimp_brush_load_brush (fd, filename);
close (fd);
if (! brush)
return NULL;
gimp_data_set_filename (GIMP_DATA (brush), filename);
/* Swap the brush to disk (if we're being stingy with memory) */
if (stingy_memory_use)
{
temp_buf_swap (brush->mask);
if (brush->pixmap)
temp_buf_swap (brush->pixmap);
}
return GIMP_DATA (brush);
}
static GimpBrush *
gimp_brush_select_brush (GimpPaintTool *paint_core)
{
return paint_core->brush;
}
static gboolean
gimp_brush_want_null_motion (GimpPaintTool *paint_core)
{
return TRUE;
}
TempBuf *
gimp_brush_get_mask (const GimpBrush *brush)
{
g_return_val_if_fail (brush != NULL, NULL);
g_return_val_if_fail (GIMP_IS_BRUSH (brush), NULL);
return brush->mask;
}
TempBuf *
gimp_brush_get_pixmap (const GimpBrush *brush)
{
g_return_val_if_fail (brush != NULL, NULL);
g_return_val_if_fail (GIMP_IS_BRUSH (brush), NULL);
return brush->pixmap;
}
gint
gimp_brush_get_spacing (const GimpBrush *brush)
{
g_return_val_if_fail (brush != NULL, 0);
g_return_val_if_fail (GIMP_IS_BRUSH (brush), 0);
return brush->spacing;
}
void
gimp_brush_set_spacing (GimpBrush *brush,
gint spacing)
{
g_return_if_fail (brush != NULL);
g_return_if_fail (GIMP_IS_BRUSH (brush));
brush->spacing = spacing;
}
GimpBrush *
gimp_brush_load_brush (gint fd,
const gchar *filename)
{
GimpBrush *brush;
gint bn_size;
BrushHeader header;
gchar *name;
gint i;
g_return_val_if_fail (filename != NULL, NULL);
g_return_val_if_fail (fd != -1, NULL);
/* Read in the header size */
if (read (fd, &header, sizeof (header)) != sizeof (header))
return NULL;
/* rearrange the bytes in each unsigned int */
header.header_size = g_ntohl (header.header_size);
header.version = g_ntohl (header.version);
header.width = g_ntohl (header.width);
header.height = g_ntohl (header.height);
header.bytes = g_ntohl (header.bytes);
header.magic_number = g_ntohl (header.magic_number);
header.spacing = g_ntohl (header.spacing);
/* Check for correct file format */
/* It looks as if version 1 did not have the same magic number. (neo) */
if (header.version != 1 &&
(header.magic_number != GBRUSH_MAGIC || header.version != 2))
{
g_message (_("Unknown brush format version #%d in \"%s\"."),
header.version, filename);
return NULL;
}
if (header.version == 1)
{
/* If this is a version 1 brush, set the fp back 8 bytes */
lseek (fd, -8, SEEK_CUR);
header.header_size += 8;
/* spacing is not defined in version 1 */
header.spacing = 25;
}
/* Read in the brush name */
if ((bn_size = (header.header_size - sizeof (header))))
{
name = g_new (gchar, bn_size);
if ((read (fd, name, bn_size)) < bn_size)
{
g_message (_("Error in GIMP brush file \"%s\"."), filename);
g_free (name);
return NULL;
}
}
else
{
name = g_strdup (_("Unnamed"));
}
switch (header.bytes)
{
case 1:
brush = GIMP_BRUSH (gtk_type_new (GIMP_TYPE_BRUSH));
brush->mask = temp_buf_new (header.width, header.height, 1,
0, 0, NULL);
if (read (fd,
temp_buf_data (brush->mask), header.width * header.height) <
header.width * header.height)
{
g_message (_("GIMP brush file appears to be truncated: \"%s\"."),
filename);
g_free (name);
gtk_object_unref (GTK_OBJECT (brush));
return NULL;
}
break;
case 4:
brush = GIMP_BRUSH (gtk_type_new (GIMP_TYPE_BRUSH));
brush->mask = temp_buf_new (header.width, header.height, 1, 0, 0, NULL);
brush->pixmap = temp_buf_new (header.width, header.height, 3, 0, 0, NULL);
for (i = 0; i < header.width * header.height; i++)
{
if (read (fd, temp_buf_data (brush->pixmap)
+ i * 3, 3) != 3 ||
read (fd, temp_buf_data (brush->mask) + i, 1) != 1)
{
g_message (_("GIMP brush file appears to be truncated: \"%s\"."),
filename);
g_free (name);
gtk_object_unref (GTK_OBJECT (brush));
return NULL;
}
}
break;
default:
g_message ("Unsupported brush depth: %d\n"
"in file \"%s\"\n"
"GIMP Brushes must be GRAY or RGBA",
header.bytes, filename);
g_free (name);
return NULL;
}
gimp_object_set_name (GIMP_OBJECT (brush), name);
g_free (name);
brush->spacing = header.spacing;
brush->x_axis.x = header.width / 2.0;
brush->x_axis.y = 0.0;
brush->y_axis.x = 0.0;
brush->y_axis.y = header.height / 2.0;
return brush;
}

View File

@ -1,78 +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 __GIMP_BRUSH_H__
#define __GIMP_BRUSH_H__
#include "gimpdata.h"
#define GIMP_BRUSH_FILE_EXTENSION ".gbr"
#define GIMP_BRUSH_PIXMAP_FILE_EXTENSION ".gpb"
#define GIMP_TYPE_BRUSH (gimp_brush_get_type ())
#define GIMP_BRUSH(obj) (GTK_CHECK_CAST ((obj), GIMP_TYPE_BRUSH, GimpBrush))
#define GIMP_BRUSH_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GIMP_TYPE_BRUSH, GimpBrushClass))
#define GIMP_IS_BRUSH(obj) (GTK_CHECK_TYPE ((obj), GIMP_TYPE_BRUSH))
#define GIMP_IS_BRUSH_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_BRUSH))
typedef struct _GimpBrushClass GimpBrushClass;
struct _GimpBrush
{
GimpData parent_instance;
TempBuf *mask; /* the actual mask */
TempBuf *pixmap; /* optional pixmap data */
gint spacing; /* brush's spacing */
GimpVector2 x_axis; /* for calculating brush spacing */
GimpVector2 y_axis; /* for calculating brush spacing */
};
struct _GimpBrushClass
{
GimpDataClass parent_class;
/* FIXME: these are no virtual function pointers but bad hacks: */
GimpBrush * (* select_brush) (GimpPaintTool *paint_tool);
gboolean (* want_null_motion) (GimpPaintTool *paint_tool);
};
GtkType gimp_brush_get_type (void);
GimpData * gimp_brush_new (const gchar *name);
GimpData * gimp_brush_get_standard (void);
GimpData * gimp_brush_load (const gchar *filename);
GimpBrush * gimp_brush_load_brush (gint fd,
const gchar *filename);
TempBuf * gimp_brush_get_mask (const GimpBrush *brush);
TempBuf * gimp_brush_get_pixmap (const GimpBrush *brush);
gint gimp_brush_get_spacing (const GimpBrush *brush);
void gimp_brush_set_spacing (GimpBrush *brush,
gint spacing);
#endif /* __GIMP_BRUSH_H__ */

View File

@ -1,568 +0,0 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* gimp_brush_generated module Copyright 1998 Jay Cox <jaycox@earthlink.net>
*
* 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 <ctype.h>
#include <stdio.h>
#include <string.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <gtk/gtk.h>
#include "libgimpmath/gimpmath.h"
#include "apptypes.h"
#include "appenv.h"
#include "gimpbrushgenerated.h"
#include "gimprc.h"
#include "gimpbrush.h"
#include "temp_buf.h"
/* this needs to go away */
#include "tools/gimppainttool.h"
#define OVERSAMPLING 5
/* local function prototypes */
static void gimp_brush_generated_class_init (GimpBrushGeneratedClass *klass);
static void gimp_brush_generated_init (GimpBrushGenerated *brush);
static void gimp_brush_generated_destroy (GtkObject *object);
static gboolean gimp_brush_generated_save (GimpData *data);
static void gimp_brush_generated_dirty (GimpData *data);
static gchar * gimp_brush_generated_get_extension (GimpData *data);
static GimpData * gimp_brush_generated_duplicate (GimpData *data);
static GimpBrushClass *parent_class = NULL;
GtkType
gimp_brush_generated_get_type (void)
{
static GtkType type = 0;
if (!type)
{
GtkTypeInfo info =
{
"GimpBrushGenerated",
sizeof (GimpBrushGenerated),
sizeof (GimpBrushGeneratedClass),
(GtkClassInitFunc) gimp_brush_generated_class_init,
(GtkObjectInitFunc) gimp_brush_generated_init,
/* reserved_1 */ NULL,
/* reserved_2 */ NULL,
(GtkClassInitFunc) NULL
};
type = gtk_type_unique (GIMP_TYPE_BRUSH, &info);
}
return type;
}
static void
gimp_brush_generated_class_init (GimpBrushGeneratedClass *klass)
{
GtkObjectClass *object_class;
GimpDataClass *data_class;
object_class = (GtkObjectClass *) klass;
data_class = (GimpDataClass *) klass;
parent_class = gtk_type_class (GIMP_TYPE_BRUSH);
object_class->destroy = gimp_brush_generated_destroy;
data_class->save = gimp_brush_generated_save;
data_class->dirty = gimp_brush_generated_dirty;
data_class->get_extension = gimp_brush_generated_get_extension;
data_class->duplicate = gimp_brush_generated_duplicate;
}
static void
gimp_brush_generated_init (GimpBrushGenerated *brush)
{
brush->radius = 5.0;
brush->hardness = 0.0;
brush->angle = 0.0;
brush->aspect_ratio = 1.0;
brush->freeze = 0;
}
static void
gimp_brush_generated_destroy (GtkObject *object)
{
if (GTK_OBJECT_CLASS (parent_class)->destroy)
GTK_OBJECT_CLASS (parent_class)->destroy (object);
}
static gboolean
gimp_brush_generated_save (GimpData *data)
{
GimpBrushGenerated *brush;
FILE *fp;
g_return_val_if_fail (data != NULL, FALSE);
g_return_val_if_fail (GIMP_IS_BRUSH_GENERATED (data), FALSE);
brush = GIMP_BRUSH_GENERATED (data);
/* we are (finaly) ready to try to save the generated brush file */
if ((fp = fopen (data->filename, "wb")) == NULL)
{
g_warning ("Unable to save file %s", data->filename);
return FALSE;
}
/* write magic header */
fprintf (fp, "GIMP-VBR\n");
/* write version */
fprintf (fp, "1.0\n");
/* write name */
fprintf (fp, "%.255s\n", GIMP_OBJECT (brush)->name);
/* write brush spacing */
fprintf (fp, "%f\n", (gfloat) GIMP_BRUSH (brush)->spacing);
/* write brush radius */
fprintf (fp, "%f\n", brush->radius);
/* write brush hardness */
fprintf (fp, "%f\n", brush->hardness);
/* write brush aspect_ratio */
fprintf (fp, "%f\n", brush->aspect_ratio);
/* write brush angle */
fprintf (fp, "%f\n", brush->angle);
fclose (fp);
return TRUE;
}
static gchar *
gimp_brush_generated_get_extension (GimpData *data)
{
return GIMP_BRUSH_GENERATED_FILE_EXTENSION;
}
static GimpData *
gimp_brush_generated_duplicate (GimpData *data)
{
GimpBrushGenerated *brush;
brush = GIMP_BRUSH_GENERATED (data);
return gimp_brush_generated_new (brush->radius,
brush->hardness,
brush->angle,
brush->aspect_ratio);
}
static double
gauss (gdouble f)
{
/* this aint' a real gauss function */
if (f < -.5)
{
f = -1.0 - f;
return (2.0 * f*f);
}
if (f < .5)
return (1.0 - 2.0 * f*f);
f = 1.0 -f;
return (2.0 * f*f);
}
static void
gimp_brush_generated_dirty (GimpData *data)
{
GimpBrushGenerated *brush;
register GimpBrush *gbrush = NULL;
register gint x, y;
register guchar *centerp;
register gdouble d;
register gdouble exponent;
register guchar a;
register gint length;
register guchar *lookup;
register gdouble sum, c, s, tx, ty;
gdouble buffer[OVERSAMPLING];
gint width, height;
brush = GIMP_BRUSH_GENERATED (data);
if (brush->freeze) /* if we are frozen defer rerendering till later */
return;
gbrush = GIMP_BRUSH (brush);
if (stingy_memory_use && gbrush->mask)
temp_buf_unswap (gbrush->mask);
if (gbrush->mask)
{
temp_buf_free (gbrush->mask);
}
/* compute the range of the brush. should do a better job than this? */
s = sin (gimp_deg_to_rad (brush->angle));
c = cos (gimp_deg_to_rad (brush->angle));
tx = MAX (fabs (c*ceil (brush->radius) - s*ceil (brush->radius)
/ brush->aspect_ratio),
fabs (c*ceil (brush->radius) + s*ceil (brush->radius)
/ brush->aspect_ratio));
ty = MAX (fabs (s*ceil (brush->radius) + c*ceil (brush->radius)
/ brush->aspect_ratio),
fabs (s*ceil (brush->radius) - c*ceil (brush->radius)
/ brush->aspect_ratio));
if (brush->radius > tx)
width = ceil (tx);
else
width = ceil (brush->radius);
if (brush->radius > ty)
height = ceil (ty);
else
height = ceil (brush->radius);
/* compute the axis for spacing */
GIMP_BRUSH (brush)->x_axis.x = c * brush->radius;
GIMP_BRUSH (brush)->x_axis.y = -1.0 * s * brush->radius;
GIMP_BRUSH (brush)->y_axis.x = (s * brush->radius / brush->aspect_ratio);
GIMP_BRUSH (brush)->y_axis.y = (c * brush->radius / brush->aspect_ratio);
gbrush->mask = temp_buf_new (width * 2 + 1,
height * 2 + 1,
1, width, height, 0);
centerp = &gbrush->mask->data[height * gbrush->mask->width + width];
if ((1.0 - brush->hardness) < 0.000001)
exponent = 1000000;
else
exponent = 1/(1.0 - brush->hardness);
/* set up lookup table */
length = ceil (sqrt (2 * ceil (brush->radius+1) * ceil (brush->radius+1))+1) * OVERSAMPLING;
lookup = g_malloc (length);
sum = 0.0;
for (x = 0; x < OVERSAMPLING; x++)
{
d = fabs ((x + 0.5) / OVERSAMPLING - 0.5);
if (d > brush->radius)
buffer[x] = 0.0;
else
/* buffer[x] = (1.0 - pow (d/brush->radius, exponent)); */
buffer[x] = gauss (pow (d/brush->radius, exponent));
sum += buffer[x];
}
for (x = 0; d < brush->radius || sum > 0.00001; d += 1.0 / OVERSAMPLING)
{
sum -= buffer[x % OVERSAMPLING];
if (d > brush->radius)
buffer[x % OVERSAMPLING] = 0.0;
else
/* buffer[x%OVERSAMPLING] = (1.0 - pow (d/brush->radius, exponent)); */
buffer[x % OVERSAMPLING] = gauss (pow (d/brush->radius, exponent));
sum += buffer[x%OVERSAMPLING];
lookup[x++] = RINT (sum * (255.0 / OVERSAMPLING));
}
while (x < length)
{
lookup[x++] = 0;
}
/* compute one half and mirror it */
for (y = 0; y <= height; y++)
{
for (x = -width; x <= width; x++)
{
tx = c*x - s*y;
ty = c*y + s*x;
ty *= brush->aspect_ratio;
d = sqrt (tx*tx + ty*ty);
if (d < brush->radius+1)
a = lookup[(gint) RINT (d * OVERSAMPLING)];
else
a = 0;
centerp[ y*gbrush->mask->width + x] = a;
centerp[-1*y*gbrush->mask->width - x] = a;
}
}
g_free (lookup);
if (GIMP_DATA_CLASS (parent_class)->dirty)
GIMP_DATA_CLASS (parent_class)->dirty (data);
}
GimpData *
gimp_brush_generated_new (gfloat radius,
gfloat hardness,
gfloat angle,
gfloat aspect_ratio)
{
GimpBrushGenerated *brush;
/* set up normal brush data */
brush = GIMP_BRUSH_GENERATED (gtk_type_new (GIMP_TYPE_BRUSH_GENERATED));
gimp_object_set_name (GIMP_OBJECT (brush), "Untitled");
GIMP_BRUSH (brush)->spacing = 20;
/* set up gimp_brush_generated data */
brush->radius = radius;
brush->hardness = hardness;
brush->angle = angle;
brush->aspect_ratio = aspect_ratio;
/* render brush mask */
gimp_data_dirty (GIMP_DATA (brush));
return GIMP_DATA (brush);
}
GimpData *
gimp_brush_generated_load (const gchar *filename)
{
GimpBrushGenerated *brush;
FILE *fp;
gchar string[256];
gfloat fl;
gfloat version;
if ((fp = fopen (filename, "rb")) == NULL)
return NULL;
/* make sure the file we are reading is the right type */
fgets (string, 255, fp);
if (strncmp (string, "GIMP-VBR", 8) != 0)
return NULL;
/* make sure we are reading a compatible version */
fgets (string, 255, fp);
sscanf (string, "%f", &version);
g_return_val_if_fail (version < 2.0, NULL);
/* create new brush */
brush = GIMP_BRUSH_GENERATED (gtk_type_new (GIMP_TYPE_BRUSH_GENERATED));
gimp_data_set_filename (GIMP_DATA (brush), filename);
gimp_brush_generated_freeze (brush);
/* read name */
fgets (string, 255, fp);
if (string[strlen (string) - 1] == '\n')
string[strlen (string) - 1] = 0;
gimp_object_set_name (GIMP_OBJECT (brush), string);
/* read brush spacing */
fscanf (fp, "%f", &fl);
GIMP_BRUSH (brush)->spacing = fl;
/* read brush radius */
fscanf (fp, "%f", &fl);
gimp_brush_generated_set_radius (brush, fl);
/* read brush hardness */
fscanf (fp, "%f", &fl);
gimp_brush_generated_set_hardness (brush, fl);
/* read brush aspect_ratio */
fscanf (fp, "%f", &fl);
gimp_brush_generated_set_aspect_ratio (brush, fl);
/* read brush angle */
fscanf (fp, "%f", &fl);
gimp_brush_generated_set_angle (brush, fl);
fclose (fp);
gimp_brush_generated_thaw (brush);
GIMP_DATA (brush)->dirty = FALSE;
if (stingy_memory_use)
temp_buf_swap (GIMP_BRUSH (brush)->mask);
return GIMP_DATA (brush);
}
void
gimp_brush_generated_freeze (GimpBrushGenerated *brush)
{
g_return_if_fail (brush != NULL);
g_return_if_fail (GIMP_IS_BRUSH_GENERATED (brush));
brush->freeze++;
}
void
gimp_brush_generated_thaw (GimpBrushGenerated *brush)
{
g_return_if_fail (brush != NULL);
g_return_if_fail (GIMP_IS_BRUSH_GENERATED (brush));
if (brush->freeze > 0)
brush->freeze--;
if (brush->freeze == 0)
gimp_data_dirty (GIMP_DATA (brush));
}
gfloat
gimp_brush_generated_set_radius (GimpBrushGenerated *brush,
gfloat radius)
{
g_return_val_if_fail (GIMP_IS_BRUSH_GENERATED (brush), -1.0);
if (radius < 0.0)
radius = 0.0;
else if (radius > 32767.0)
radius = 32767.0;
if (radius == brush->radius)
return radius;
brush->radius = radius;
if (! brush->freeze)
gimp_data_dirty (GIMP_DATA (brush));
return brush->radius;
}
gfloat
gimp_brush_generated_set_hardness (GimpBrushGenerated *brush,
gfloat hardness)
{
g_return_val_if_fail (GIMP_IS_BRUSH_GENERATED (brush), -1.0);
if (hardness < 0.0)
hardness = 0.0;
else if (hardness > 1.0)
hardness = 1.0;
if (brush->hardness == hardness)
return hardness;
brush->hardness = hardness;
if (!brush->freeze)
gimp_data_dirty (GIMP_DATA (brush));
return brush->hardness;
}
gfloat
gimp_brush_generated_set_angle (GimpBrushGenerated *brush,
gfloat angle)
{
g_return_val_if_fail (GIMP_IS_BRUSH_GENERATED (brush), -1.0);
if (angle < 0.0)
angle = -1.0 * fmod (angle, 180.0);
else if (angle > 180.0)
angle = fmod (angle, 180.0);
if (brush->angle == angle)
return angle;
brush->angle = angle;
if (!brush->freeze)
gimp_data_dirty (GIMP_DATA (brush));
return brush->angle;
}
gfloat
gimp_brush_generated_set_aspect_ratio (GimpBrushGenerated *brush,
gfloat ratio)
{
g_return_val_if_fail (GIMP_IS_BRUSH_GENERATED (brush), -1.0);
if (ratio < 1.0)
ratio = 1.0;
else if (ratio > 1000)
ratio = 1000;
if (brush->aspect_ratio == ratio)
return ratio;
brush->aspect_ratio = ratio;
if (!brush->freeze)
gimp_data_dirty (GIMP_DATA (brush));
return brush->aspect_ratio;
}
gfloat
gimp_brush_generated_get_radius (const GimpBrushGenerated *brush)
{
g_return_val_if_fail (GIMP_IS_BRUSH_GENERATED (brush), -1.0);
return brush->radius;
}
gfloat
gimp_brush_generated_get_hardness (const GimpBrushGenerated *brush)
{
g_return_val_if_fail (GIMP_IS_BRUSH_GENERATED (brush), -1.0);
return brush->hardness;
}
gfloat
gimp_brush_generated_get_angle (const GimpBrushGenerated *brush)
{
g_return_val_if_fail (GIMP_IS_BRUSH_GENERATED (brush), -1.0);
return brush->angle;
}
gfloat
gimp_brush_generated_get_aspect_ratio (const GimpBrushGenerated *brush)
{
g_return_val_if_fail (GIMP_IS_BRUSH_GENERATED (brush), -1.0);
return brush->aspect_ratio;
}

View File

@ -1,85 +0,0 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* brush_generated module Copyright 1998 Jay Cox <jaycox@earthlink.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __GIMP_BRUSH_GENERATED_H__
#define __GIMP_BRUSH_GENERATED_H__
#include "gimpbrush.h"
#define GIMP_BRUSH_GENERATED_FILE_EXTENSION ".vbr"
#define GIMP_TYPE_BRUSH_GENERATED (gimp_brush_generated_get_type ())
#define GIMP_BRUSH_GENERATED(obj) (GTK_CHECK_CAST ((obj), GIMP_TYPE_BRUSH_GENERATED, GimpBrushGenerated))
#define GIMP_BRUSH_GENERATED_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GIMP_TYPE_BRUSH_GENERATED, GimpBrushGeneratedClass))
#define GIMP_IS_BRUSH_GENERATED(obj) (GTK_CHECK_TYPE ((obj), GIMP_TYPE_BRUSH_GENERATED))
#define GIMP_IS_BRUSH_GENERATED_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_BRUSH_GENERATED))
typedef struct _GimpBrushGeneratedClass GimpBrushGeneratedClass;
struct _GimpBrushGenerated
{
GimpBrush parent_instance;
gfloat radius;
gfloat hardness; /* 0.0 - 1.0 */
gfloat angle; /* in degrees */
gfloat aspect_ratio; /* y/x */
/* private */
gint freeze;
};
struct _GimpBrushGeneratedClass
{
GimpBrushClass parent_class;
};
GtkType gimp_brush_generated_get_type (void);
GimpData * gimp_brush_generated_new (gfloat radius,
gfloat hardness,
gfloat angle,
gfloat aspect_ratio);
GimpData * gimp_brush_generated_load (const gchar *file_name);
void gimp_brush_generated_freeze (GimpBrushGenerated *brush);
void gimp_brush_generated_thaw (GimpBrushGenerated *brush);
gfloat gimp_brush_generated_set_radius (GimpBrushGenerated *brush,
gfloat radius);
gfloat gimp_brush_generated_set_hardness (GimpBrushGenerated *brush,
gfloat hardness);
gfloat gimp_brush_generated_set_angle (GimpBrushGenerated *brush,
gfloat angle);
gfloat gimp_brush_generated_set_aspect_ratio (GimpBrushGenerated *brush,
gfloat ratio);
gfloat gimp_brush_generated_get_radius (const GimpBrushGenerated *brush);
gfloat gimp_brush_generated_get_hardness (const GimpBrushGenerated *brush);
gfloat gimp_brush_generated_get_angle (const GimpBrushGenerated *brush);
gfloat gimp_brush_generated_get_aspect_ratio (const GimpBrushGenerated *brush);
#endif /* __GIMP_BRUSH_GENERATED_H__ */

View File

@ -1,413 +0,0 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
* Copyright (C) 1999 Adrian Likins and Tor Lillqvist
*
* 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 <errno.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <sys/types.h>
#include <sys/stat.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <fcntl.h>
#ifndef _O_BINARY
#define _O_BINARY 0
#endif
#include <gtk/gtk.h>
#ifdef G_OS_WIN32
#include <io.h>
#endif
#include "libgimpmath/gimpmath.h"
#include "apptypes.h"
#include "appenv.h"
#include "gimpbrush.h"
#include "gimpbrush-header.h"
#include "gimpbrushpipe.h"
#include "gimppattern-header.h"
#include "gimprc.h"
/* this needs to go away */
#include "tools/gimppainttool.h"
#include "libgimp/gimpparasiteio.h"
#include "libgimp/gimpintl.h"
static GimpBrush * gimp_brush_pipe_select_brush (GimpPaintTool *paint_tool);
static gboolean gimp_brush_pipe_want_null_motion (GimpPaintTool *paint_tool);
static void gimp_brush_pipe_destroy (GtkObject *object);
static GimpBrushClass *parent_class = NULL;
static GimpBrush *
gimp_brush_pipe_select_brush (GimpPaintTool *paint_tool)
{
GimpBrushPipe *pipe;
gint i, brushix, ix;
gdouble angle;
g_return_val_if_fail (paint_tool != NULL, NULL);
g_return_val_if_fail (GIMP_IS_BRUSH_PIPE (paint_tool->brush), NULL);
pipe = GIMP_BRUSH_PIPE (paint_tool->brush);
if (pipe->nbrushes == 1)
return GIMP_BRUSH (pipe->current);
brushix = 0;
for (i = 0; i < pipe->dimension; i++)
{
switch (pipe->select[i])
{
case PIPE_SELECT_INCREMENTAL:
ix = (pipe->index[i] + 1) % pipe->rank[i];
break;
case PIPE_SELECT_ANGULAR:
angle = atan2 (paint_tool->cury - paint_tool->lasty,
paint_tool->curx - paint_tool->lastx);
/* Offset angle to be compatible with PSP tubes */
angle += G_PI_2;
/* Map it to the [0..2*G_PI) interval */
if (angle < 0)
angle += 2.0 * G_PI;
else if (angle > 2.0 * G_PI)
angle -= 2.0 * G_PI;
ix = RINT (angle / (2.0 * G_PI) * pipe->rank[i]);
break;
case PIPE_SELECT_RANDOM:
/* This probably isn't the right way */
ix = rand () % pipe->rank[i];
break;
case PIPE_SELECT_PRESSURE:
ix = RINT (paint_tool->curpressure * (pipe->rank[i] - 1));
break;
case PIPE_SELECT_TILT_X:
ix = RINT (paint_tool->curxtilt / 2.0 * pipe->rank[i]) + pipe->rank[i]/2;
break;
case PIPE_SELECT_TILT_Y:
ix = RINT (paint_tool->curytilt / 2.0 * pipe->rank[i]) + pipe->rank[i]/2;
break;
case PIPE_SELECT_CONSTANT:
default:
ix = pipe->index[i];
break;
}
pipe->index[i] = CLAMP (ix, 0, pipe->rank[i]-1);
brushix += pipe->stride[i] * pipe->index[i];
}
/* Make sure is inside bounds */
brushix = CLAMP (brushix, 0, pipe->nbrushes-1);
pipe->current = pipe->brushes[brushix];
return GIMP_BRUSH (pipe->current);
}
static gboolean
gimp_brush_pipe_want_null_motion (GimpPaintTool *paint_tool)
{
GimpBrushPipe *pipe;
gint i;
g_return_val_if_fail (paint_tool != NULL, TRUE);
g_return_val_if_fail (GIMP_IS_BRUSH_PIPE (paint_tool->brush), TRUE);
pipe = GIMP_BRUSH_PIPE (paint_tool->brush);
if (pipe->nbrushes == 1)
return TRUE;
for (i = 0; i < pipe->dimension; i++)
if (pipe->select[i] == PIPE_SELECT_ANGULAR)
return FALSE;
return TRUE;
}
static void
gimp_brush_pipe_destroy (GtkObject *object)
{
GimpBrushPipe *pipe;
gint i;
g_return_if_fail (object != NULL);
g_return_if_fail (GIMP_IS_BRUSH_PIPE (object));
pipe = GIMP_BRUSH_PIPE (object);
g_free (pipe->rank);
g_free (pipe->stride);
for (i = 0; i < pipe->nbrushes; i++)
if (pipe->brushes[i])
gtk_object_unref (GTK_OBJECT (pipe->brushes[i]));
g_free (pipe->brushes);
g_free (pipe->select);
g_free (pipe->index);
GIMP_BRUSH (pipe)->mask = NULL;
GIMP_BRUSH (pipe)->pixmap = NULL;
if (GTK_OBJECT_CLASS (parent_class)->destroy)
GTK_OBJECT_CLASS (parent_class)->destroy (object);
}
static void
gimp_brush_pipe_class_init (GimpBrushPipeClass *klass)
{
GtkObjectClass *object_class;
GimpBrushClass *brush_class;
object_class = (GtkObjectClass *) klass;
brush_class = (GimpBrushClass *) klass;
parent_class = gtk_type_class (GIMP_TYPE_BRUSH);
brush_class->select_brush = gimp_brush_pipe_select_brush;
brush_class->want_null_motion = gimp_brush_pipe_want_null_motion;
object_class->destroy = gimp_brush_pipe_destroy;
}
void
gimp_brush_pipe_init (GimpBrushPipe *pipe)
{
pipe->current = NULL;
pipe->dimension = 0;
pipe->rank = NULL;
pipe->stride = NULL;
pipe->nbrushes = 0;
pipe->brushes = NULL;
pipe->select = NULL;
pipe->index = NULL;
}
GtkType
gimp_brush_pipe_get_type (void)
{
static GtkType type = 0;
if (!type)
{
GtkTypeInfo info =
{
"GimpBrushPipe",
sizeof (GimpBrushPipe),
sizeof (GimpBrushPipeClass),
(GtkClassInitFunc) gimp_brush_pipe_class_init,
(GtkObjectInitFunc) gimp_brush_pipe_init,
/* reserved_1 */ NULL,
/* reserved_2 */ NULL,
(GtkClassInitFunc) NULL
};
type = gtk_type_unique (GIMP_TYPE_BRUSH, &info);
}
return type;
}
GimpData *
gimp_brush_pipe_load (const gchar *filename)
{
GimpBrushPipe *pipe = NULL;
GimpPixPipeParams params;
gint i;
gint num_of_brushes = 0;
gint totalcells;
gchar *paramstring;
GString *buffer;
gchar c;
gint fd;
g_return_val_if_fail (filename != NULL, NULL);
fd = open (filename, O_RDONLY | _O_BINARY);
if (fd == -1)
{
g_message ("Couldn't open file '%s'", filename);
return NULL;
}
/* The file format starts with a painfully simple text header */
/* get the name */
buffer = g_string_new (NULL);
while (read (fd, &c, 1) == 1 && c != '\n' && buffer->len < 1024)
g_string_append_c (buffer, c);
if (buffer->len > 0 && buffer->len < 1024)
{
pipe = GIMP_BRUSH_PIPE (gtk_type_new (GIMP_TYPE_BRUSH_PIPE));
gimp_object_set_name (GIMP_OBJECT (pipe), buffer->str);
}
g_string_free (buffer, TRUE);
if (!pipe)
{
g_message ("Couldn't read name for brush pipe from file '%s'\n",
filename);
close (fd);
return NULL;
}
/* get the number of brushes */
buffer = g_string_new (NULL);
while (read (fd, &c, 1) == 1 && c != '\n' && buffer->len < 1024)
g_string_append_c (buffer, c);
if (buffer->len > 0 && buffer->len < 1024)
{
num_of_brushes = strtol (buffer->str, &paramstring, 10);
}
if (num_of_brushes < 1)
{
g_message (_("Brush pipes should have at least one brush:\n\"%s\""),
filename);
close (fd);
gtk_object_sink (GTK_OBJECT (pipe));
g_string_free (buffer, TRUE);
return NULL;
}
while (*paramstring && isspace (*paramstring))
paramstring++;
if (*paramstring)
{
gimp_pixpipe_params_init (&params);
gimp_pixpipe_params_parse (paramstring, &params);
pipe->dimension = params.dim;
pipe->rank = g_new0 (gint, pipe->dimension);
pipe->select = g_new0 (PipeSelectModes, pipe->dimension);
pipe->index = g_new0 (gint, pipe->dimension);
/* placement is not used at all ?? */
if (params.free_placement_string)
g_free (params.placement);
for (i = 0; i < pipe->dimension; i++)
{
pipe->rank[i] = params.rank[i];
if (strcmp (params.selection[i], "incremental") == 0)
pipe->select[i] = PIPE_SELECT_INCREMENTAL;
else if (strcmp (params.selection[i], "angular") == 0)
pipe->select[i] = PIPE_SELECT_ANGULAR;
else if (strcmp (params.selection[i], "velocity") == 0)
pipe->select[i] = PIPE_SELECT_VELOCITY;
else if (strcmp (params.selection[i], "random") == 0)
pipe->select[i] = PIPE_SELECT_RANDOM;
else if (strcmp (params.selection[i], "pressure") == 0)
pipe->select[i] = PIPE_SELECT_PRESSURE;
else if (strcmp (params.selection[i], "xtilt") == 0)
pipe->select[i] = PIPE_SELECT_TILT_X;
else if (strcmp (params.selection[i], "ytilt") == 0)
pipe->select[i] = PIPE_SELECT_TILT_Y;
else
pipe->select[i] = PIPE_SELECT_CONSTANT;
if (params.free_selection_string)
g_free (params.selection[i]);
pipe->index[i] = 0;
}
}
else
{
pipe->dimension = 1;
pipe->rank = g_new (gint, 1);
pipe->rank[0] = num_of_brushes;
pipe->select = g_new (PipeSelectModes, 1);
pipe->select[0] = PIPE_SELECT_INCREMENTAL;
pipe->index = g_new (gint, 1);
pipe->index[0] = 0;
}
g_string_free (buffer, TRUE);
totalcells = 1; /* Not all necessarily present, maybe */
for (i = 0; i < pipe->dimension; i++)
totalcells *= pipe->rank[i];
pipe->stride = g_new0 (gint, pipe->dimension);
for (i = 0; i < pipe->dimension; i++)
{
if (i == 0)
pipe->stride[i] = totalcells / pipe->rank[i];
else
pipe->stride[i] = pipe->stride[i-1] / pipe->rank[i];
}
g_assert (pipe->stride[pipe->dimension-1] == 1);
pipe->brushes = g_new0 (GimpBrush *, num_of_brushes);
while (pipe->nbrushes < num_of_brushes)
{
pipe->brushes[pipe->nbrushes] = gimp_brush_load_brush (fd, filename);
if (pipe->brushes[pipe->nbrushes])
{
gtk_object_ref (GTK_OBJECT (pipe->brushes[pipe->nbrushes]));
gtk_object_sink (GTK_OBJECT (pipe->brushes[pipe->nbrushes]));
gimp_object_set_name (GIMP_OBJECT (pipe->brushes[pipe->nbrushes]),
NULL);
}
else
{
g_message (_("Failed to load one of the brushes in the brush pipe\n\"%s\""),
filename);
close (fd);
gtk_object_sink (GTK_OBJECT (pipe));
return NULL;
}
pipe->nbrushes++;
}
/* Current brush is the first one. */
pipe->current = pipe->brushes[0];
gimp_data_set_filename (GIMP_DATA (pipe), filename);
/* just to satisfy the code that relies on this crap */
GIMP_BRUSH (pipe)->spacing = pipe->current->spacing;
GIMP_BRUSH (pipe)->x_axis = pipe->current->x_axis;
GIMP_BRUSH (pipe)->y_axis = pipe->current->y_axis;
GIMP_BRUSH (pipe)->mask = pipe->current->mask;
GIMP_BRUSH (pipe)->pixmap = pipe->current->pixmap;
close (fd);
return GIMP_DATA (pipe);
}

Some files were not shown because too many files have changed in this diff Show More