2006-12-10 05:33:38 +08:00
|
|
|
|
/* GIMP - The GNU Image Manipulation Program
|
1998-07-09 13:31:06 +08:00
|
|
|
|
* 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.
|
|
|
|
|
*/
|
2000-12-17 05:37:03 +08:00
|
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
|
2001-08-14 22:53:55 +08:00
|
|
|
|
#include <glib-object.h>
|
Jens Lautenbacher <jtl@gimp.org>
2000-12-18 Sven Neumann <sven@gimp.org>
Jens Lautenbacher <jtl@gimp.org>
* app/Makefile.am
* app/gimpbrushlistP.h
* app/gimpbrushpipeP.h
* app/gimpobjectP.h: removed these three files
* app/parasitelistP.h
* app/channels_dialog.c
* app/docindex.c
* app/gimpdrawable.c
* app/gimpdrawableP.h
* app/gimpimage.c
* app/gimpimageP.h
* app/gimplist.[ch]
* app/gimpobject.c
* app/gimpobject.h
* app/gimpsetP.h: changed according to header removal
* app/airbrush.c
* app/brush_select.[ch]
* app/brushes_cmds.c
* app/gimpbrush.[ch]
* app/gimpbrushgenerated.[ch]
* app/gimpbrushlist.[ch]
* app/gimpbrushpipe.[ch]
* app/gimpcontextpreview.c
* app/paint_core.c
* app/paintbrush.c
* app/pencil.c
* tools/pdbgen/pdb/brushes.pdb: Big Brushes Cleanup.
The GimpBrush* object hierarchy and the file formats were broken by
"design". This made it overly difficult to read and write pixmap
brushes and brush pipes, leading to the situation that The GIMP was
not able to read it's very own file formats. Since the GimpBrush
format did support arbitrary color depths, the introduction of a
file format for pixmap brushes was unnecessary.
The GimpBrushPixmap object is dead. GimpBrush has an additional
pixmap temp_buf and handles pixmap brushes transparently. The file
format of pixmap brushes is not any longer a grayscale brush plus
a pattern, but a simple brush with RGBA data. The old brushes can
still be loaded, but the .gpb format is deprecated.
GimpBrushPipe derives from GimpBrush. The fileformat is still a text
header, followed by a number of brushes, but those brushes are stored
in the new GimpBrush format (no pattern anymore). The pipe does not
care about the depth of the contained GimpBrushes, so we get
grayscale BrushPipes for free. Since the brush loader still loads the
old format, old .gih files can also still be loaded.
Since the brushes in the GimpBrushPipe do not any longer contain a
pointer to the pipe object, we do only temporarily switch brushes
in the paint_core routines. This is not very elegant, but the best
we can do without a major redesign.
* app/patterns.[ch]: changed the loader to work with a filedescriptor
instead of a filehandle to make it work with the new brush loading
code.
* plug-ins/common/.cvsignore
* plug-ins/common/Makefile.am
* plug-ins/common/plugin-defs.pl
* plug-ins/common/gih.c: new plug-in that saves GIH files in the
new format (loader will follow soon)
* plug-ins/common/gpb.c: removed since Pixmap Brushes are no longer
supported as a special file format.
* plug-ins/common/gbr.c: load and save brushes in the new brush format
which allows RGBA brushes too.
* plug-ins/common/pat.c: load and save grayscale patterns too
2000-12-18 23:14:08 +08:00
|
|
|
|
|
2003-10-16 20:24:58 +08:00
|
|
|
|
#include "libgimpbase/gimpbase.h"
|
|
|
|
|
|
2001-05-10 06:34:59 +08:00
|
|
|
|
#include "core-types.h"
|
Jens Lautenbacher <jtl@gimp.org>
2000-12-18 Sven Neumann <sven@gimp.org>
Jens Lautenbacher <jtl@gimp.org>
* app/Makefile.am
* app/gimpbrushlistP.h
* app/gimpbrushpipeP.h
* app/gimpobjectP.h: removed these three files
* app/parasitelistP.h
* app/channels_dialog.c
* app/docindex.c
* app/gimpdrawable.c
* app/gimpdrawableP.h
* app/gimpimage.c
* app/gimpimageP.h
* app/gimplist.[ch]
* app/gimpobject.c
* app/gimpobject.h
* app/gimpsetP.h: changed according to header removal
* app/airbrush.c
* app/brush_select.[ch]
* app/brushes_cmds.c
* app/gimpbrush.[ch]
* app/gimpbrushgenerated.[ch]
* app/gimpbrushlist.[ch]
* app/gimpbrushpipe.[ch]
* app/gimpcontextpreview.c
* app/paint_core.c
* app/paintbrush.c
* app/pencil.c
* tools/pdbgen/pdb/brushes.pdb: Big Brushes Cleanup.
The GimpBrush* object hierarchy and the file formats were broken by
"design". This made it overly difficult to read and write pixmap
brushes and brush pipes, leading to the situation that The GIMP was
not able to read it's very own file formats. Since the GimpBrush
format did support arbitrary color depths, the introduction of a
file format for pixmap brushes was unnecessary.
The GimpBrushPixmap object is dead. GimpBrush has an additional
pixmap temp_buf and handles pixmap brushes transparently. The file
format of pixmap brushes is not any longer a grayscale brush plus
a pattern, but a simple brush with RGBA data. The old brushes can
still be loaded, but the .gpb format is deprecated.
GimpBrushPipe derives from GimpBrush. The fileformat is still a text
header, followed by a number of brushes, but those brushes are stored
in the new GimpBrush format (no pattern anymore). The pipe does not
care about the depth of the contained GimpBrushes, so we get
grayscale BrushPipes for free. Since the brush loader still loads the
old format, old .gih files can also still be loaded.
Since the brushes in the GimpBrushPipe do not any longer contain a
pointer to the pipe object, we do only temporarily switch brushes
in the paint_core routines. This is not very elegant, but the best
we can do without a major redesign.
* app/patterns.[ch]: changed the loader to work with a filedescriptor
instead of a filehandle to make it work with the new brush loading
code.
* plug-ins/common/.cvsignore
* plug-ins/common/Makefile.am
* plug-ins/common/plugin-defs.pl
* plug-ins/common/gih.c: new plug-in that saves GIH files in the
new format (loader will follow soon)
* plug-ins/common/gpb.c: removed since Pixmap Brushes are no longer
supported as a special file format.
* plug-ins/common/gbr.c: load and save brushes in the new brush format
which allows RGBA brushes too.
* plug-ins/common/pat.c: load and save grayscale patterns too
2000-12-18 23:14:08 +08:00
|
|
|
|
|
2001-05-15 19:25:25 +08:00
|
|
|
|
#include "base/brush-scale.h"
|
|
|
|
|
#include "base/temp-buf.h"
|
|
|
|
|
|
1998-07-09 13:31:06 +08:00
|
|
|
|
#include "gimpbrush.h"
|
2005-04-15 23:56:34 +08:00
|
|
|
|
#include "gimpbrush-load.h"
|
2001-02-14 03:53:07 +08:00
|
|
|
|
#include "gimpbrushgenerated.h"
|
2001-11-23 07:46:13 +08:00
|
|
|
|
#include "gimpmarshal.h"
|
Jens Lautenbacher <jtl@gimp.org>
2000-12-18 Sven Neumann <sven@gimp.org>
Jens Lautenbacher <jtl@gimp.org>
* app/Makefile.am
* app/gimpbrushlistP.h
* app/gimpbrushpipeP.h
* app/gimpobjectP.h: removed these three files
* app/parasitelistP.h
* app/channels_dialog.c
* app/docindex.c
* app/gimpdrawable.c
* app/gimpdrawableP.h
* app/gimpimage.c
* app/gimpimageP.h
* app/gimplist.[ch]
* app/gimpobject.c
* app/gimpobject.h
* app/gimpsetP.h: changed according to header removal
* app/airbrush.c
* app/brush_select.[ch]
* app/brushes_cmds.c
* app/gimpbrush.[ch]
* app/gimpbrushgenerated.[ch]
* app/gimpbrushlist.[ch]
* app/gimpbrushpipe.[ch]
* app/gimpcontextpreview.c
* app/paint_core.c
* app/paintbrush.c
* app/pencil.c
* tools/pdbgen/pdb/brushes.pdb: Big Brushes Cleanup.
The GimpBrush* object hierarchy and the file formats were broken by
"design". This made it overly difficult to read and write pixmap
brushes and brush pipes, leading to the situation that The GIMP was
not able to read it's very own file formats. Since the GimpBrush
format did support arbitrary color depths, the introduction of a
file format for pixmap brushes was unnecessary.
The GimpBrushPixmap object is dead. GimpBrush has an additional
pixmap temp_buf and handles pixmap brushes transparently. The file
format of pixmap brushes is not any longer a grayscale brush plus
a pattern, but a simple brush with RGBA data. The old brushes can
still be loaded, but the .gpb format is deprecated.
GimpBrushPipe derives from GimpBrush. The fileformat is still a text
header, followed by a number of brushes, but those brushes are stored
in the new GimpBrush format (no pattern anymore). The pipe does not
care about the depth of the contained GimpBrushes, so we get
grayscale BrushPipes for free. Since the brush loader still loads the
old format, old .gih files can also still be loaded.
Since the brushes in the GimpBrushPipe do not any longer contain a
pointer to the pipe object, we do only temporarily switch brushes
in the paint_core routines. This is not very elegant, but the best
we can do without a major redesign.
* app/patterns.[ch]: changed the loader to work with a filedescriptor
instead of a filehandle to make it work with the new brush loading
code.
* plug-ins/common/.cvsignore
* plug-ins/common/Makefile.am
* plug-ins/common/plugin-defs.pl
* plug-ins/common/gih.c: new plug-in that saves GIH files in the
new format (loader will follow soon)
* plug-ins/common/gpb.c: removed since Pixmap Brushes are no longer
supported as a special file format.
* plug-ins/common/gbr.c: load and save brushes in the new brush format
which allows RGBA brushes too.
* plug-ins/common/pat.c: load and save grayscale patterns too
2000-12-18 23:14:08 +08:00
|
|
|
|
|
2003-03-26 00:38:19 +08:00
|
|
|
|
#include "gimp-intl.h"
|
1998-11-23 22:47:09 +08:00
|
|
|
|
|
2001-01-10 08:36:54 +08:00
|
|
|
|
|
2001-06-30 03:25:03 +08:00
|
|
|
|
enum
|
|
|
|
|
{
|
|
|
|
|
SPACING_CHANGED,
|
|
|
|
|
LAST_SIGNAL
|
|
|
|
|
};
|
|
|
|
|
|
2006-12-06 08:01:27 +08:00
|
|
|
|
enum
|
|
|
|
|
{
|
|
|
|
|
PROP_0,
|
|
|
|
|
PROP_SPACING
|
|
|
|
|
};
|
2001-06-30 03:25:03 +08:00
|
|
|
|
|
2006-12-06 08:01:27 +08:00
|
|
|
|
|
|
|
|
|
static void gimp_brush_set_property (GObject *object,
|
|
|
|
|
guint property_id,
|
|
|
|
|
const GValue *value,
|
|
|
|
|
GParamSpec *pspec);
|
|
|
|
|
static void gimp_brush_get_property (GObject *object,
|
|
|
|
|
guint property_id,
|
|
|
|
|
GValue *value,
|
|
|
|
|
GParamSpec *pspec);
|
2005-12-11 03:24:36 +08:00
|
|
|
|
static void gimp_brush_finalize (GObject *object);
|
2001-08-11 22:39:19 +08:00
|
|
|
|
|
2005-12-11 03:24:36 +08:00
|
|
|
|
static gint64 gimp_brush_get_memsize (GimpObject *object,
|
|
|
|
|
gint64 *gui_size);
|
2001-08-11 22:39:19 +08:00
|
|
|
|
|
2005-12-11 03:24:36 +08:00
|
|
|
|
static gboolean gimp_brush_get_size (GimpViewable *viewable,
|
|
|
|
|
gint *width,
|
|
|
|
|
gint *height);
|
|
|
|
|
static TempBuf * gimp_brush_get_new_preview (GimpViewable *viewable,
|
2006-08-30 05:44:51 +08:00
|
|
|
|
GimpContext *context,
|
2005-12-11 03:24:36 +08:00
|
|
|
|
gint width,
|
|
|
|
|
gint height);
|
|
|
|
|
static gchar * gimp_brush_get_description (GimpViewable *viewable,
|
|
|
|
|
gchar **tooltip);
|
|
|
|
|
static gchar * gimp_brush_get_extension (GimpData *data);
|
2002-01-31 00:14:26 +08:00
|
|
|
|
|
2005-12-11 03:24:36 +08:00
|
|
|
|
static GimpBrush * gimp_brush_real_select_brush (GimpBrush *brush,
|
|
|
|
|
GimpCoords *last_coords,
|
|
|
|
|
GimpCoords *cur_coords);
|
|
|
|
|
static gboolean gimp_brush_real_want_null_motion (GimpBrush *brush,
|
|
|
|
|
GimpCoords *last_coords,
|
|
|
|
|
GimpCoords *cur_coords);
|
2006-11-09 22:54:49 +08:00
|
|
|
|
static TempBuf * gimp_brush_real_scale_mask (GimpBrush *brush,
|
|
|
|
|
gdouble scale);
|
|
|
|
|
static TempBuf * gimp_brush_real_scale_pixmap (GimpBrush *brush,
|
|
|
|
|
gdouble scale);
|
2001-02-05 23:22:20 +08:00
|
|
|
|
|
Overhaul of pixmap brushes and pipes: No separate pixmap pipe
brush tool any longer. The paintbrush, airbrush and pencil
tools, which already knew how to handle the single-pixmap
brushes now also handle the pipes as well.
* app/pixmapbrush.{h,c}
* app/gimpbrushpixmap.{h,c}: Removed these files.
* app/Makefile.am
* app/makefile.{cygwin,msc}: Remove from here, too.
* app/gimpbrushpipe.{h,c}: Total overhaul.
* app/paint_core.h
* app/apptypes.h: Some more types moved to apptypes.h
* app/context_manager.c
* app/tool_options.c
* app/tools.c
* app/toolsF.h: Remove PIXMAPBRUSH tool.
* app/gimpbrush.h: New method: select_brush. Used to change the
brush in paint_core, for pipe brushes.
* app/gimpbrush.c: Add gimp_brush_select_brush, which is dummy for
the normal brushes (returns the same brush).
* app/paint_core.c: Call the brush's select_brush method to get a
potential new brush before calling the paint_func.
* app/gimpbrushlist.c: Various changes related to the pixmap and
pipe overhaul.
* app/airbrush.c
* app/pencil.c: Reorder code a bit in the tool motion function to
avoid executing unnecessary code in the case of a pixmap brush.
Other changes in the same commit:
* app/install.c: Make quote_spaces extern.
* app/appenv.h: Declare it.
* libgimp/gimpui.def: Add missing entry points.
* libgimp/makefile.{cygwin,msc}: Add missing objects to gimpui.
1999-08-26 08:54:30 +08:00
|
|
|
|
|
2006-05-15 17:46:31 +08:00
|
|
|
|
G_DEFINE_TYPE (GimpBrush, gimp_brush, GIMP_TYPE_DATA)
|
2000-02-24 19:39:26 +08:00
|
|
|
|
|
2005-12-11 03:24:36 +08:00
|
|
|
|
#define parent_class gimp_brush_parent_class
|
2001-01-10 08:36:54 +08:00
|
|
|
|
|
2005-12-11 03:24:36 +08:00
|
|
|
|
static guint brush_signals[LAST_SIGNAL] = { 0 };
|
1998-07-09 13:31:06 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
gimp_brush_class_init (GimpBrushClass *klass)
|
|
|
|
|
{
|
2004-06-25 21:41:24 +08:00
|
|
|
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
|
|
|
|
GimpObjectClass *gimp_object_class = GIMP_OBJECT_CLASS (klass);
|
|
|
|
|
GimpViewableClass *viewable_class = GIMP_VIEWABLE_CLASS (klass);
|
|
|
|
|
GimpDataClass *data_class = GIMP_DATA_CLASS (klass);
|
Overhaul of pixmap brushes and pipes: No separate pixmap pipe
brush tool any longer. The paintbrush, airbrush and pencil
tools, which already knew how to handle the single-pixmap
brushes now also handle the pipes as well.
* app/pixmapbrush.{h,c}
* app/gimpbrushpixmap.{h,c}: Removed these files.
* app/Makefile.am
* app/makefile.{cygwin,msc}: Remove from here, too.
* app/gimpbrushpipe.{h,c}: Total overhaul.
* app/paint_core.h
* app/apptypes.h: Some more types moved to apptypes.h
* app/context_manager.c
* app/tool_options.c
* app/tools.c
* app/toolsF.h: Remove PIXMAPBRUSH tool.
* app/gimpbrush.h: New method: select_brush. Used to change the
brush in paint_core, for pipe brushes.
* app/gimpbrush.c: Add gimp_brush_select_brush, which is dummy for
the normal brushes (returns the same brush).
* app/paint_core.c: Call the brush's select_brush method to get a
potential new brush before calling the paint_func.
* app/gimpbrushlist.c: Various changes related to the pixmap and
pipe overhaul.
* app/airbrush.c
* app/pencil.c: Reorder code a bit in the tool motion function to
avoid executing unnecessary code in the case of a pixmap brush.
Other changes in the same commit:
* app/install.c: Make quote_spaces extern.
* app/appenv.h: Declare it.
* libgimp/gimpui.def: Add missing entry points.
* libgimp/makefile.{cygwin,msc}: Add missing objects to gimpui.
1999-08-26 08:54:30 +08:00
|
|
|
|
|
2003-07-10 20:13:21 +08:00
|
|
|
|
brush_signals[SPACING_CHANGED] =
|
2005-05-28 00:51:39 +08:00
|
|
|
|
g_signal_new ("spacing-changed",
|
2004-06-25 21:41:24 +08:00
|
|
|
|
G_TYPE_FROM_CLASS (klass),
|
|
|
|
|
G_SIGNAL_RUN_FIRST,
|
|
|
|
|
G_STRUCT_OFFSET (GimpBrushClass, spacing_changed),
|
|
|
|
|
NULL, NULL,
|
|
|
|
|
gimp_marshal_VOID__VOID,
|
|
|
|
|
G_TYPE_NONE, 0);
|
2001-06-30 03:25:03 +08:00
|
|
|
|
|
2006-12-07 19:53:02 +08:00
|
|
|
|
object_class->get_property = gimp_brush_get_property;
|
|
|
|
|
object_class->set_property = gimp_brush_set_property;
|
2003-11-17 21:34:38 +08:00
|
|
|
|
object_class->finalize = gimp_brush_finalize;
|
2001-01-10 08:36:54 +08:00
|
|
|
|
|
2003-11-17 21:34:38 +08:00
|
|
|
|
gimp_object_class->get_memsize = gimp_brush_get_memsize;
|
2002-01-31 00:14:26 +08:00
|
|
|
|
|
2003-11-17 21:34:38 +08:00
|
|
|
|
viewable_class->default_stock_id = "gimp-tool-paintbrush";
|
2005-05-25 18:05:17 +08:00
|
|
|
|
viewable_class->get_size = gimp_brush_get_size;
|
2003-11-17 21:34:38 +08:00
|
|
|
|
viewable_class->get_new_preview = gimp_brush_get_new_preview;
|
|
|
|
|
viewable_class->get_description = gimp_brush_get_description;
|
2001-02-05 23:22:20 +08:00
|
|
|
|
|
2003-11-17 21:34:38 +08:00
|
|
|
|
data_class->get_extension = gimp_brush_get_extension;
|
2001-02-14 03:53:07 +08:00
|
|
|
|
|
2003-11-17 21:34:38 +08:00
|
|
|
|
klass->select_brush = gimp_brush_real_select_brush;
|
|
|
|
|
klass->want_null_motion = gimp_brush_real_want_null_motion;
|
2006-11-09 22:54:49 +08:00
|
|
|
|
klass->scale_mask = gimp_brush_real_scale_mask;
|
|
|
|
|
klass->scale_pixmap = gimp_brush_real_scale_pixmap;
|
2003-11-17 21:34:38 +08:00
|
|
|
|
klass->spacing_changed = NULL;
|
2006-12-06 08:01:27 +08:00
|
|
|
|
|
|
|
|
|
g_object_class_install_property (object_class, PROP_SPACING,
|
|
|
|
|
g_param_spec_double ("spacing", NULL, NULL,
|
|
|
|
|
1.0, 5000.0, 20.0,
|
|
|
|
|
GIMP_PARAM_READWRITE |
|
|
|
|
|
G_PARAM_CONSTRUCT));
|
1998-07-09 13:31:06 +08:00
|
|
|
|
}
|
|
|
|
|
|
2001-02-05 23:22:20 +08:00
|
|
|
|
static void
|
2000-02-24 09:52:31 +08:00
|
|
|
|
gimp_brush_init (GimpBrush *brush)
|
1998-07-09 13:31:06 +08:00
|
|
|
|
{
|
2001-08-11 22:39:19 +08:00
|
|
|
|
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;
|
1998-07-09 13:31:06 +08:00
|
|
|
|
}
|
|
|
|
|
|
2006-12-06 08:01:27 +08:00
|
|
|
|
static void
|
|
|
|
|
gimp_brush_set_property (GObject *object,
|
|
|
|
|
guint property_id,
|
|
|
|
|
const GValue *value,
|
|
|
|
|
GParamSpec *pspec)
|
|
|
|
|
{
|
|
|
|
|
GimpBrush *brush = GIMP_BRUSH (object);
|
|
|
|
|
|
|
|
|
|
switch (property_id)
|
|
|
|
|
{
|
|
|
|
|
case PROP_SPACING:
|
|
|
|
|
gimp_brush_set_spacing (brush, g_value_get_double (value));
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
gimp_brush_get_property (GObject *object,
|
|
|
|
|
guint property_id,
|
|
|
|
|
GValue *value,
|
|
|
|
|
GParamSpec *pspec)
|
|
|
|
|
{
|
|
|
|
|
GimpBrush *brush = GIMP_BRUSH (object);
|
|
|
|
|
|
|
|
|
|
switch (property_id)
|
|
|
|
|
{
|
|
|
|
|
case PROP_SPACING:
|
|
|
|
|
g_value_set_double (value, brush->spacing);
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2001-02-05 23:22:20 +08:00
|
|
|
|
static void
|
2001-08-11 22:39:19 +08:00
|
|
|
|
gimp_brush_finalize (GObject *object)
|
2001-02-05 23:22:20 +08:00
|
|
|
|
{
|
2004-01-30 00:19:57 +08:00
|
|
|
|
GimpBrush *brush = GIMP_BRUSH (object);
|
1999-08-17 08:59:07 +08:00
|
|
|
|
|
2001-02-05 23:22:20 +08:00
|
|
|
|
if (brush->mask)
|
2001-08-11 22:39:19 +08:00
|
|
|
|
{
|
|
|
|
|
temp_buf_free (brush->mask);
|
|
|
|
|
brush->mask = NULL;
|
|
|
|
|
}
|
2001-02-05 23:22:20 +08:00
|
|
|
|
|
2001-04-25 07:06:51 +08:00
|
|
|
|
if (brush->pixmap)
|
2001-08-11 22:39:19 +08:00
|
|
|
|
{
|
|
|
|
|
temp_buf_free (brush->pixmap);
|
|
|
|
|
brush->pixmap = NULL;
|
|
|
|
|
}
|
2001-04-25 07:06:51 +08:00
|
|
|
|
|
2001-08-11 22:39:19 +08:00
|
|
|
|
G_OBJECT_CLASS (parent_class)->finalize (object);
|
2001-02-05 23:22:20 +08:00
|
|
|
|
}
|
|
|
|
|
|
2003-11-17 01:51:36 +08:00
|
|
|
|
static gint64
|
2003-08-25 18:49:33 +08:00
|
|
|
|
gimp_brush_get_memsize (GimpObject *object,
|
2003-11-17 01:51:36 +08:00
|
|
|
|
gint64 *gui_size)
|
2002-01-31 00:14:26 +08:00
|
|
|
|
{
|
2004-01-30 00:19:57 +08:00
|
|
|
|
GimpBrush *brush = GIMP_BRUSH (object);
|
2003-11-17 01:51:36 +08:00
|
|
|
|
gint64 memsize = 0;
|
2002-01-31 00:14:26 +08:00
|
|
|
|
|
|
|
|
|
if (brush->mask)
|
|
|
|
|
memsize += temp_buf_get_memsize (brush->mask);
|
|
|
|
|
|
|
|
|
|
if (brush->pixmap)
|
|
|
|
|
memsize += temp_buf_get_memsize (brush->pixmap);
|
|
|
|
|
|
2003-08-25 18:49:33 +08:00
|
|
|
|
return memsize + GIMP_OBJECT_CLASS (parent_class)->get_memsize (object,
|
|
|
|
|
gui_size);
|
2002-01-31 00:14:26 +08:00
|
|
|
|
}
|
|
|
|
|
|
2003-02-27 21:59:41 +08:00
|
|
|
|
static gboolean
|
2005-05-25 18:05:17 +08:00
|
|
|
|
gimp_brush_get_size (GimpViewable *viewable,
|
|
|
|
|
gint *width,
|
|
|
|
|
gint *height)
|
2003-02-27 21:59:41 +08:00
|
|
|
|
{
|
2004-01-30 00:19:57 +08:00
|
|
|
|
GimpBrush *brush = GIMP_BRUSH (viewable);
|
2003-02-27 21:59:41 +08:00
|
|
|
|
|
2005-05-25 18:05:17 +08:00
|
|
|
|
*width = brush->mask->width;
|
|
|
|
|
*height = brush->mask->height;
|
2003-02-27 21:59:41 +08:00
|
|
|
|
|
2005-05-25 18:05:17 +08:00
|
|
|
|
return TRUE;
|
2003-02-27 21:59:41 +08:00
|
|
|
|
}
|
|
|
|
|
|
2001-02-05 23:22:20 +08:00
|
|
|
|
static TempBuf *
|
2001-02-07 08:06:58 +08:00
|
|
|
|
gimp_brush_get_new_preview (GimpViewable *viewable,
|
2006-08-30 05:44:51 +08:00
|
|
|
|
GimpContext *context,
|
2004-06-25 21:41:24 +08:00
|
|
|
|
gint width,
|
|
|
|
|
gint height)
|
1998-07-09 13:31:06 +08:00
|
|
|
|
{
|
2004-01-30 00:19:57 +08:00
|
|
|
|
GimpBrush *brush = GIMP_BRUSH (viewable);
|
2002-10-31 02:25:40 +08:00
|
|
|
|
gint brush_width;
|
|
|
|
|
gint brush_height;
|
|
|
|
|
TempBuf *mask_buf = NULL;
|
|
|
|
|
TempBuf *pixmap_buf = NULL;
|
|
|
|
|
TempBuf *return_buf = NULL;
|
2005-12-11 03:24:36 +08:00
|
|
|
|
guchar transp[4] = { 0, 0, 0, 0 };
|
2002-10-31 02:25:40 +08:00
|
|
|
|
guchar *mask;
|
|
|
|
|
guchar *buf;
|
|
|
|
|
gint x, y;
|
2003-02-27 00:15:50 +08:00
|
|
|
|
gboolean scale = FALSE;
|
2000-02-24 09:52:31 +08:00
|
|
|
|
|
2003-02-27 00:15:50 +08:00
|
|
|
|
mask_buf = gimp_brush_get_mask (brush);
|
|
|
|
|
pixmap_buf = gimp_brush_get_pixmap (brush);
|
2001-02-06 23:57:07 +08:00
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
2001-02-27 13:21:12 +08:00
|
|
|
|
brush_width = (gdouble) brush_width / MAX (ratio_x, ratio_y) + 0.5;
|
2001-02-06 23:57:07 +08:00
|
|
|
|
brush_height = (gdouble) brush_height / MAX (ratio_x, ratio_y) + 0.5;
|
|
|
|
|
|
2004-12-27 02:18:17 +08:00
|
|
|
|
if (brush_width <= 0) brush_width = 1;
|
|
|
|
|
if (brush_height <= 0) brush_height = 1;
|
|
|
|
|
|
2007-03-12 17:33:57 +08:00
|
|
|
|
mask_buf = brush_scale_mask (mask_buf, brush_width, brush_height);
|
2001-02-06 23:57:07 +08:00
|
|
|
|
|
|
|
|
|
if (pixmap_buf)
|
|
|
|
|
{
|
|
|
|
|
/* TODO: the scale function should scale the pixmap and the
|
2004-08-01 11:06:58 +08:00
|
|
|
|
* mask in one run
|
|
|
|
|
*/
|
2007-03-12 17:33:57 +08:00
|
|
|
|
pixmap_buf = brush_scale_pixmap (pixmap_buf,
|
|
|
|
|
brush_width, brush_height);
|
2001-02-06 23:57:07 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
scale = TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
2003-02-27 00:15:50 +08:00
|
|
|
|
return_buf = temp_buf_new (brush_width, brush_height, 4, 0, 0, transp);
|
2001-02-06 23:57:07 +08:00
|
|
|
|
|
|
|
|
|
mask = temp_buf_data (mask_buf);
|
|
|
|
|
buf = temp_buf_data (return_buf);
|
|
|
|
|
|
|
|
|
|
if (pixmap_buf)
|
|
|
|
|
{
|
|
|
|
|
guchar *pixmap = temp_buf_data (pixmap_buf);
|
|
|
|
|
|
|
|
|
|
for (y = 0; y < brush_height; y++)
|
|
|
|
|
{
|
|
|
|
|
for (x = 0; x < brush_width ; x++)
|
|
|
|
|
{
|
2003-02-27 00:15:50 +08:00
|
|
|
|
*buf++ = *pixmap++;
|
|
|
|
|
*buf++ = *pixmap++;
|
|
|
|
|
*buf++ = *pixmap++;
|
|
|
|
|
*buf++ = *mask++;
|
2001-02-06 23:57:07 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
for (y = 0; y < brush_height; y++)
|
|
|
|
|
{
|
|
|
|
|
for (x = 0; x < brush_width ; x++)
|
|
|
|
|
{
|
2003-02-27 00:15:50 +08:00
|
|
|
|
*buf++ = 0;
|
|
|
|
|
*buf++ = 0;
|
|
|
|
|
*buf++ = 0;
|
|
|
|
|
*buf++ = *mask++;
|
2001-02-06 23:57:07 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (scale)
|
|
|
|
|
{
|
|
|
|
|
temp_buf_free (mask_buf);
|
|
|
|
|
|
|
|
|
|
if (pixmap_buf)
|
|
|
|
|
temp_buf_free (pixmap_buf);
|
|
|
|
|
}
|
2001-02-05 23:22:20 +08:00
|
|
|
|
|
2001-02-06 23:57:07 +08:00
|
|
|
|
return return_buf;
|
1998-07-09 13:31:06 +08:00
|
|
|
|
}
|
|
|
|
|
|
2003-04-09 00:01:01 +08:00
|
|
|
|
static gchar *
|
|
|
|
|
gimp_brush_get_description (GimpViewable *viewable,
|
|
|
|
|
gchar **tooltip)
|
|
|
|
|
{
|
2004-01-30 00:19:57 +08:00
|
|
|
|
GimpBrush *brush = GIMP_BRUSH (viewable);
|
2003-04-09 00:01:01 +08:00
|
|
|
|
|
2006-02-28 20:15:51 +08:00
|
|
|
|
return g_strdup_printf ("%s (%d × %d)",
|
2003-04-09 00:01:01 +08:00
|
|
|
|
GIMP_OBJECT (brush)->name,
|
|
|
|
|
brush->mask->width,
|
|
|
|
|
brush->mask->height);
|
|
|
|
|
}
|
|
|
|
|
|
2001-02-14 03:53:07 +08:00
|
|
|
|
static gchar *
|
|
|
|
|
gimp_brush_get_extension (GimpData *data)
|
|
|
|
|
{
|
|
|
|
|
return GIMP_BRUSH_FILE_EXTENSION;
|
|
|
|
|
}
|
|
|
|
|
|
2006-11-09 22:54:49 +08:00
|
|
|
|
static GimpBrush *
|
|
|
|
|
gimp_brush_real_select_brush (GimpBrush *brush,
|
|
|
|
|
GimpCoords *last_coords,
|
|
|
|
|
GimpCoords *cur_coords)
|
|
|
|
|
{
|
|
|
|
|
return brush;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
|
gimp_brush_real_want_null_motion (GimpBrush *brush,
|
|
|
|
|
GimpCoords *last_coords,
|
|
|
|
|
GimpCoords *cur_coords)
|
|
|
|
|
{
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static TempBuf *
|
|
|
|
|
gimp_brush_real_scale_mask (GimpBrush *brush,
|
|
|
|
|
gdouble scale)
|
|
|
|
|
{
|
|
|
|
|
gint width;
|
|
|
|
|
gint height;
|
|
|
|
|
|
2007-03-12 17:33:57 +08:00
|
|
|
|
width = (gint) (brush->mask->width * scale + 0.5);
|
|
|
|
|
height = (gint) (brush->mask->height * scale + 0.5);
|
2006-11-09 22:54:49 +08:00
|
|
|
|
|
2007-01-22 03:54:57 +08:00
|
|
|
|
if (width > 0 && height > 0)
|
2007-03-12 17:33:57 +08:00
|
|
|
|
return brush_scale_mask (brush->mask, width, height);
|
2007-01-22 03:54:57 +08:00
|
|
|
|
|
|
|
|
|
return NULL;
|
2006-11-09 22:54:49 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static TempBuf *
|
|
|
|
|
gimp_brush_real_scale_pixmap (GimpBrush *brush,
|
|
|
|
|
gdouble scale)
|
|
|
|
|
{
|
|
|
|
|
gint width;
|
|
|
|
|
gint height;
|
|
|
|
|
|
2007-03-12 17:33:57 +08:00
|
|
|
|
width = (gint) (brush->pixmap->width * scale + 0.5);
|
|
|
|
|
height = (gint) (brush->pixmap->height * scale + 0.5);
|
2006-11-09 22:54:49 +08:00
|
|
|
|
|
2007-01-22 03:54:57 +08:00
|
|
|
|
if (width > 0 && height > 0)
|
2007-03-12 17:33:57 +08:00
|
|
|
|
return brush_scale_pixmap (brush->pixmap, width, height);
|
2007-01-22 03:54:57 +08:00
|
|
|
|
|
|
|
|
|
return NULL;
|
2006-11-09 22:54:49 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* public functions */
|
|
|
|
|
|
2001-02-14 22:57:14 +08:00
|
|
|
|
GimpData *
|
2005-06-08 19:27:31 +08:00
|
|
|
|
gimp_brush_new (const gchar *name)
|
2001-02-14 03:53:07 +08:00
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail (name != NULL, NULL);
|
|
|
|
|
|
2004-08-01 11:06:58 +08:00
|
|
|
|
return gimp_brush_generated_new (name,
|
|
|
|
|
GIMP_BRUSH_GENERATED_CIRCLE,
|
2005-06-08 19:27:31 +08:00
|
|
|
|
5.0, 2, 0.5, 1.0, 0.0);
|
2001-02-14 03:53:07 +08:00
|
|
|
|
}
|
|
|
|
|
|
2001-02-14 22:57:14 +08:00
|
|
|
|
GimpData *
|
2001-02-14 03:53:07 +08:00
|
|
|
|
gimp_brush_get_standard (void)
|
|
|
|
|
{
|
2004-01-30 00:19:57 +08:00
|
|
|
|
static GimpData *standard_brush = NULL;
|
2001-02-14 03:53:07 +08:00
|
|
|
|
|
|
|
|
|
if (! standard_brush)
|
|
|
|
|
{
|
2005-06-08 19:27:31 +08:00
|
|
|
|
standard_brush = gimp_brush_new ("Standard");
|
2001-02-14 03:53:07 +08:00
|
|
|
|
|
2004-02-13 19:53:22 +08:00
|
|
|
|
standard_brush->dirty = FALSE;
|
|
|
|
|
gimp_data_make_internal (standard_brush);
|
2001-02-14 03:53:07 +08:00
|
|
|
|
|
|
|
|
|
/* set ref_count to 2 --> never swap the standard brush */
|
2003-01-06 06:07:10 +08:00
|
|
|
|
g_object_ref (standard_brush);
|
2001-02-14 03:53:07 +08:00
|
|
|
|
}
|
|
|
|
|
|
2004-01-30 00:19:57 +08:00
|
|
|
|
return standard_brush;
|
2001-02-14 03:53:07 +08:00
|
|
|
|
}
|
|
|
|
|
|
2001-12-02 06:59:48 +08:00
|
|
|
|
GimpBrush *
|
|
|
|
|
gimp_brush_select_brush (GimpBrush *brush,
|
|
|
|
|
GimpCoords *last_coords,
|
|
|
|
|
GimpCoords *cur_coords)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail (GIMP_IS_BRUSH (brush), NULL);
|
|
|
|
|
g_return_val_if_fail (last_coords != NULL, NULL);
|
|
|
|
|
g_return_val_if_fail (cur_coords != NULL, NULL);
|
|
|
|
|
|
|
|
|
|
return GIMP_BRUSH_GET_CLASS (brush)->select_brush (brush,
|
|
|
|
|
last_coords,
|
|
|
|
|
cur_coords);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
gboolean
|
|
|
|
|
gimp_brush_want_null_motion (GimpBrush *brush,
|
|
|
|
|
GimpCoords *last_coords,
|
|
|
|
|
GimpCoords *cur_coords)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail (GIMP_IS_BRUSH (brush), FALSE);
|
|
|
|
|
g_return_val_if_fail (last_coords != NULL, FALSE);
|
|
|
|
|
g_return_val_if_fail (cur_coords != NULL, FALSE);
|
|
|
|
|
|
|
|
|
|
return GIMP_BRUSH_GET_CLASS (brush)->want_null_motion (brush,
|
|
|
|
|
last_coords,
|
|
|
|
|
cur_coords);
|
|
|
|
|
}
|
|
|
|
|
|
2006-11-09 22:54:49 +08:00
|
|
|
|
TempBuf *
|
|
|
|
|
gimp_brush_scale_mask (GimpBrush *brush,
|
|
|
|
|
gdouble scale)
|
Overhaul of pixmap brushes and pipes: No separate pixmap pipe
brush tool any longer. The paintbrush, airbrush and pencil
tools, which already knew how to handle the single-pixmap
brushes now also handle the pipes as well.
* app/pixmapbrush.{h,c}
* app/gimpbrushpixmap.{h,c}: Removed these files.
* app/Makefile.am
* app/makefile.{cygwin,msc}: Remove from here, too.
* app/gimpbrushpipe.{h,c}: Total overhaul.
* app/paint_core.h
* app/apptypes.h: Some more types moved to apptypes.h
* app/context_manager.c
* app/tool_options.c
* app/tools.c
* app/toolsF.h: Remove PIXMAPBRUSH tool.
* app/gimpbrush.h: New method: select_brush. Used to change the
brush in paint_core, for pipe brushes.
* app/gimpbrush.c: Add gimp_brush_select_brush, which is dummy for
the normal brushes (returns the same brush).
* app/paint_core.c: Call the brush's select_brush method to get a
potential new brush before calling the paint_func.
* app/gimpbrushlist.c: Various changes related to the pixmap and
pipe overhaul.
* app/airbrush.c
* app/pencil.c: Reorder code a bit in the tool motion function to
avoid executing unnecessary code in the case of a pixmap brush.
Other changes in the same commit:
* app/install.c: Make quote_spaces extern.
* app/appenv.h: Declare it.
* libgimp/gimpui.def: Add missing entry points.
* libgimp/makefile.{cygwin,msc}: Add missing objects to gimpui.
1999-08-26 08:54:30 +08:00
|
|
|
|
{
|
2006-11-09 22:54:49 +08:00
|
|
|
|
g_return_val_if_fail (GIMP_IS_BRUSH (brush), NULL);
|
|
|
|
|
g_return_val_if_fail (scale > 0.0, NULL);
|
|
|
|
|
|
|
|
|
|
return GIMP_BRUSH_GET_CLASS (brush)->scale_mask (brush, scale);
|
Overhaul of pixmap brushes and pipes: No separate pixmap pipe
brush tool any longer. The paintbrush, airbrush and pencil
tools, which already knew how to handle the single-pixmap
brushes now also handle the pipes as well.
* app/pixmapbrush.{h,c}
* app/gimpbrushpixmap.{h,c}: Removed these files.
* app/Makefile.am
* app/makefile.{cygwin,msc}: Remove from here, too.
* app/gimpbrushpipe.{h,c}: Total overhaul.
* app/paint_core.h
* app/apptypes.h: Some more types moved to apptypes.h
* app/context_manager.c
* app/tool_options.c
* app/tools.c
* app/toolsF.h: Remove PIXMAPBRUSH tool.
* app/gimpbrush.h: New method: select_brush. Used to change the
brush in paint_core, for pipe brushes.
* app/gimpbrush.c: Add gimp_brush_select_brush, which is dummy for
the normal brushes (returns the same brush).
* app/paint_core.c: Call the brush's select_brush method to get a
potential new brush before calling the paint_func.
* app/gimpbrushlist.c: Various changes related to the pixmap and
pipe overhaul.
* app/airbrush.c
* app/pencil.c: Reorder code a bit in the tool motion function to
avoid executing unnecessary code in the case of a pixmap brush.
Other changes in the same commit:
* app/install.c: Make quote_spaces extern.
* app/appenv.h: Declare it.
* libgimp/gimpui.def: Add missing entry points.
* libgimp/makefile.{cygwin,msc}: Add missing objects to gimpui.
1999-08-26 08:54:30 +08:00
|
|
|
|
}
|
|
|
|
|
|
2006-11-09 22:54:49 +08:00
|
|
|
|
TempBuf *
|
|
|
|
|
gimp_brush_scale_pixmap (GimpBrush *brush,
|
|
|
|
|
gdouble scale)
|
1999-08-31 05:24:13 +08:00
|
|
|
|
{
|
2006-11-09 22:54:49 +08:00
|
|
|
|
g_return_val_if_fail (GIMP_IS_BRUSH (brush), NULL);
|
|
|
|
|
g_return_val_if_fail (brush->pixmap != NULL, NULL);
|
|
|
|
|
g_return_val_if_fail (scale > 0.0, NULL);
|
|
|
|
|
|
|
|
|
|
return GIMP_BRUSH_GET_CLASS (brush)->scale_pixmap (brush, scale);
|
1999-08-31 05:24:13 +08:00
|
|
|
|
}
|
|
|
|
|
|
1998-07-09 13:31:06 +08:00
|
|
|
|
TempBuf *
|
2001-01-14 11:55:56 +08:00
|
|
|
|
gimp_brush_get_mask (const GimpBrush *brush)
|
1998-07-09 13:31:06 +08:00
|
|
|
|
{
|
2000-09-29 20:00:00 +08:00
|
|
|
|
g_return_val_if_fail (brush != NULL, NULL);
|
2000-02-24 09:52:31 +08:00
|
|
|
|
g_return_val_if_fail (GIMP_IS_BRUSH (brush), NULL);
|
|
|
|
|
|
1998-07-09 13:31:06 +08:00
|
|
|
|
return brush->mask;
|
|
|
|
|
}
|
|
|
|
|
|
Jens Lautenbacher <jtl@gimp.org>
2000-12-18 Sven Neumann <sven@gimp.org>
Jens Lautenbacher <jtl@gimp.org>
* app/Makefile.am
* app/gimpbrushlistP.h
* app/gimpbrushpipeP.h
* app/gimpobjectP.h: removed these three files
* app/parasitelistP.h
* app/channels_dialog.c
* app/docindex.c
* app/gimpdrawable.c
* app/gimpdrawableP.h
* app/gimpimage.c
* app/gimpimageP.h
* app/gimplist.[ch]
* app/gimpobject.c
* app/gimpobject.h
* app/gimpsetP.h: changed according to header removal
* app/airbrush.c
* app/brush_select.[ch]
* app/brushes_cmds.c
* app/gimpbrush.[ch]
* app/gimpbrushgenerated.[ch]
* app/gimpbrushlist.[ch]
* app/gimpbrushpipe.[ch]
* app/gimpcontextpreview.c
* app/paint_core.c
* app/paintbrush.c
* app/pencil.c
* tools/pdbgen/pdb/brushes.pdb: Big Brushes Cleanup.
The GimpBrush* object hierarchy and the file formats were broken by
"design". This made it overly difficult to read and write pixmap
brushes and brush pipes, leading to the situation that The GIMP was
not able to read it's very own file formats. Since the GimpBrush
format did support arbitrary color depths, the introduction of a
file format for pixmap brushes was unnecessary.
The GimpBrushPixmap object is dead. GimpBrush has an additional
pixmap temp_buf and handles pixmap brushes transparently. The file
format of pixmap brushes is not any longer a grayscale brush plus
a pattern, but a simple brush with RGBA data. The old brushes can
still be loaded, but the .gpb format is deprecated.
GimpBrushPipe derives from GimpBrush. The fileformat is still a text
header, followed by a number of brushes, but those brushes are stored
in the new GimpBrush format (no pattern anymore). The pipe does not
care about the depth of the contained GimpBrushes, so we get
grayscale BrushPipes for free. Since the brush loader still loads the
old format, old .gih files can also still be loaded.
Since the brushes in the GimpBrushPipe do not any longer contain a
pointer to the pipe object, we do only temporarily switch brushes
in the paint_core routines. This is not very elegant, but the best
we can do without a major redesign.
* app/patterns.[ch]: changed the loader to work with a filedescriptor
instead of a filehandle to make it work with the new brush loading
code.
* plug-ins/common/.cvsignore
* plug-ins/common/Makefile.am
* plug-ins/common/plugin-defs.pl
* plug-ins/common/gih.c: new plug-in that saves GIH files in the
new format (loader will follow soon)
* plug-ins/common/gpb.c: removed since Pixmap Brushes are no longer
supported as a special file format.
* plug-ins/common/gbr.c: load and save brushes in the new brush format
which allows RGBA brushes too.
* plug-ins/common/pat.c: load and save grayscale patterns too
2000-12-18 23:14:08 +08:00
|
|
|
|
TempBuf *
|
2001-01-14 11:55:56 +08:00
|
|
|
|
gimp_brush_get_pixmap (const GimpBrush *brush)
|
Jens Lautenbacher <jtl@gimp.org>
2000-12-18 Sven Neumann <sven@gimp.org>
Jens Lautenbacher <jtl@gimp.org>
* app/Makefile.am
* app/gimpbrushlistP.h
* app/gimpbrushpipeP.h
* app/gimpobjectP.h: removed these three files
* app/parasitelistP.h
* app/channels_dialog.c
* app/docindex.c
* app/gimpdrawable.c
* app/gimpdrawableP.h
* app/gimpimage.c
* app/gimpimageP.h
* app/gimplist.[ch]
* app/gimpobject.c
* app/gimpobject.h
* app/gimpsetP.h: changed according to header removal
* app/airbrush.c
* app/brush_select.[ch]
* app/brushes_cmds.c
* app/gimpbrush.[ch]
* app/gimpbrushgenerated.[ch]
* app/gimpbrushlist.[ch]
* app/gimpbrushpipe.[ch]
* app/gimpcontextpreview.c
* app/paint_core.c
* app/paintbrush.c
* app/pencil.c
* tools/pdbgen/pdb/brushes.pdb: Big Brushes Cleanup.
The GimpBrush* object hierarchy and the file formats were broken by
"design". This made it overly difficult to read and write pixmap
brushes and brush pipes, leading to the situation that The GIMP was
not able to read it's very own file formats. Since the GimpBrush
format did support arbitrary color depths, the introduction of a
file format for pixmap brushes was unnecessary.
The GimpBrushPixmap object is dead. GimpBrush has an additional
pixmap temp_buf and handles pixmap brushes transparently. The file
format of pixmap brushes is not any longer a grayscale brush plus
a pattern, but a simple brush with RGBA data. The old brushes can
still be loaded, but the .gpb format is deprecated.
GimpBrushPipe derives from GimpBrush. The fileformat is still a text
header, followed by a number of brushes, but those brushes are stored
in the new GimpBrush format (no pattern anymore). The pipe does not
care about the depth of the contained GimpBrushes, so we get
grayscale BrushPipes for free. Since the brush loader still loads the
old format, old .gih files can also still be loaded.
Since the brushes in the GimpBrushPipe do not any longer contain a
pointer to the pipe object, we do only temporarily switch brushes
in the paint_core routines. This is not very elegant, but the best
we can do without a major redesign.
* app/patterns.[ch]: changed the loader to work with a filedescriptor
instead of a filehandle to make it work with the new brush loading
code.
* plug-ins/common/.cvsignore
* plug-ins/common/Makefile.am
* plug-ins/common/plugin-defs.pl
* plug-ins/common/gih.c: new plug-in that saves GIH files in the
new format (loader will follow soon)
* plug-ins/common/gpb.c: removed since Pixmap Brushes are no longer
supported as a special file format.
* plug-ins/common/gbr.c: load and save brushes in the new brush format
which allows RGBA brushes too.
* plug-ins/common/pat.c: load and save grayscale patterns too
2000-12-18 23:14:08 +08:00
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail (brush != NULL, NULL);
|
|
|
|
|
g_return_val_if_fail (GIMP_IS_BRUSH (brush), NULL);
|
|
|
|
|
|
|
|
|
|
return brush->pixmap;
|
|
|
|
|
}
|
|
|
|
|
|
2000-02-24 09:52:31 +08:00
|
|
|
|
gint
|
2001-01-14 11:55:56 +08:00
|
|
|
|
gimp_brush_get_spacing (const GimpBrush *brush)
|
1999-04-22 22:34:00 +08:00
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail (GIMP_IS_BRUSH (brush), 0);
|
|
|
|
|
|
|
|
|
|
return brush->spacing;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
gimp_brush_set_spacing (GimpBrush *brush,
|
2004-08-01 11:06:58 +08:00
|
|
|
|
gint spacing)
|
1999-04-22 22:34:00 +08:00
|
|
|
|
{
|
|
|
|
|
g_return_if_fail (GIMP_IS_BRUSH (brush));
|
|
|
|
|
|
2001-06-30 03:25:03 +08:00
|
|
|
|
if (brush->spacing != spacing)
|
|
|
|
|
{
|
|
|
|
|
brush->spacing = spacing;
|
|
|
|
|
|
|
|
|
|
gimp_brush_spacing_changed (brush);
|
2006-12-06 08:01:27 +08:00
|
|
|
|
g_object_notify (G_OBJECT (brush), "spacing");
|
2001-06-30 03:25:03 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
gimp_brush_spacing_changed (GimpBrush *brush)
|
|
|
|
|
{
|
|
|
|
|
g_return_if_fail (GIMP_IS_BRUSH (brush));
|
|
|
|
|
|
2003-01-06 06:07:10 +08:00
|
|
|
|
g_signal_emit (brush, brush_signals[SPACING_CHANGED], 0);
|
1999-04-22 22:34:00 +08:00
|
|
|
|
}
|