2016-02-16 02:35:43 +01:00
|
|
|
/* Plug-in to load and export .gih (GIMP Brush Pipe) files.
|
1999-08-22 19:02:52 +00:00
|
|
|
*
|
|
|
|
* Copyright (C) 1999 Tor Lillqvist
|
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 15:14:08 +00:00
|
|
|
* Copyright (C) 2000 Jens Lautenbacher, Sven Neumann
|
1999-08-22 19:02:52 +00:00
|
|
|
*
|
2009-01-17 22:28:01 +00:00
|
|
|
* This program is free software: you can redistribute it and/or modify
|
1999-08-22 19:02:52 +00:00
|
|
|
* it under the terms of the GNU General Public License as published by
|
2009-01-17 22:28:01 +00:00
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
1999-08-22 19:02:52 +00:00
|
|
|
* (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
|
2018-07-11 23:27:07 +02:00
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
1999-08-22 19:02:52 +00:00
|
|
|
*/
|
|
|
|
|
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 15:14:08 +00:00
|
|
|
/* Example of how to call file_gih_save from script-fu:
|
2003-11-06 15:27:05 +00:00
|
|
|
|
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 15:14:08 +00:00
|
|
|
(let ((ranks (cons-array 1 'byte)))
|
|
|
|
(aset ranks 0 12)
|
|
|
|
(file-gih-save 1
|
2008-10-20 06:04:39 +00:00
|
|
|
img
|
|
|
|
drawable
|
|
|
|
"foo.gih"
|
|
|
|
"foo.gih"
|
|
|
|
100
|
|
|
|
"test brush"
|
|
|
|
125
|
|
|
|
125
|
|
|
|
3
|
|
|
|
4
|
|
|
|
1
|
|
|
|
ranks
|
|
|
|
1
|
|
|
|
'("random")))
|
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 15:14:08 +00:00
|
|
|
*/
|
1999-08-24 05:30:14 +00:00
|
|
|
|
|
|
|
|
1999-08-22 19:02:52 +00:00
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
#include <libgimp/gimp.h>
|
1999-10-08 20:09:04 +00:00
|
|
|
#include <libgimp/gimpui.h>
|
2001-05-21 20:30:16 +00:00
|
|
|
#include <libgimpbase/gimpparasiteio.h>
|
2000-01-06 22:26:10 +00:00
|
|
|
|
2000-04-30 21:03:44 +00:00
|
|
|
#include "libgimp/stdplugins-intl.h"
|
|
|
|
|
|
|
|
|
2014-11-05 02:34:45 +01:00
|
|
|
#define SAVE_PROC "file-gih-save"
|
|
|
|
#define PLUG_IN_BINARY "file-gih"
|
|
|
|
#define PLUG_IN_ROLE "gimp-file-gih"
|
|
|
|
|
1999-08-22 19:02:52 +00:00
|
|
|
|
1999-09-02 00:01:41 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
2023-07-22 22:25:27 +02:00
|
|
|
GtkWidget *rank_entry[GIMP_PIXPIPE_MAXDIM];
|
|
|
|
GtkWidget *mode_entry[GIMP_PIXPIPE_MAXDIM];
|
1999-09-02 00:01:41 +00:00
|
|
|
} SizeAdjustmentData;
|
|
|
|
|
1999-08-22 19:02:52 +00:00
|
|
|
|
2019-08-13 22:53:04 +02:00
|
|
|
typedef struct _Gih Gih;
|
|
|
|
typedef struct _GihClass GihClass;
|
2014-11-05 02:34:45 +01:00
|
|
|
|
2019-08-13 22:53:04 +02:00
|
|
|
struct _Gih
|
|
|
|
{
|
|
|
|
GimpPlugIn parent_instance;
|
|
|
|
};
|
2019-03-03 19:42:22 +01:00
|
|
|
|
2019-08-13 22:53:04 +02:00
|
|
|
struct _GihClass
|
|
|
|
{
|
|
|
|
GimpPlugInClass parent_class;
|
|
|
|
};
|
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 15:14:08 +00:00
|
|
|
|
1999-08-22 19:02:52 +00:00
|
|
|
|
2019-08-13 22:53:04 +02:00
|
|
|
#define GIH_TYPE (gih_get_type ())
|
|
|
|
#define GIH (obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIH_TYPE, Gih))
|
|
|
|
|
2023-07-22 22:25:27 +02:00
|
|
|
GType gih_get_type (void) G_GNUC_CONST;
|
2019-08-13 22:53:04 +02:00
|
|
|
|
2023-07-22 22:25:27 +02:00
|
|
|
static GList * gih_query_procedures (GimpPlugIn *plug_in);
|
|
|
|
static GimpProcedure * gih_create_procedure (GimpPlugIn *plug_in,
|
|
|
|
const gchar *name);
|
2019-08-13 22:53:04 +02:00
|
|
|
|
2023-07-22 22:25:27 +02:00
|
|
|
static GimpValueArray * gih_save (GimpProcedure *procedure,
|
|
|
|
GimpRunMode run_mode,
|
|
|
|
GimpImage *image,
|
|
|
|
gint n_drawables,
|
|
|
|
GimpDrawable **drawables,
|
|
|
|
GFile *file,
|
|
|
|
GimpMetadata *metadata,
|
|
|
|
GimpProcedureConfig *config,
|
|
|
|
gpointer run_data);
|
2019-08-13 22:53:04 +02:00
|
|
|
|
2023-07-22 22:25:27 +02:00
|
|
|
static void gih_remove_guides (GimpProcedureConfig *config,
|
|
|
|
GimpImage *image);
|
|
|
|
static void gih_cell_width_notify (GimpProcedureConfig *config,
|
|
|
|
const GParamSpec *pspec,
|
|
|
|
GimpProcedureDialog *dialog);
|
|
|
|
|
|
|
|
static gboolean gih_save_dialog (GimpImage *image,
|
|
|
|
GimpProcedure *procedure,
|
|
|
|
GimpProcedureConfig *config);
|
2019-08-13 22:53:04 +02:00
|
|
|
|
|
|
|
|
|
|
|
G_DEFINE_TYPE (Gih, gih, GIMP_TYPE_PLUG_IN)
|
|
|
|
|
|
|
|
GIMP_MAIN (GIH_TYPE)
|
2022-05-26 00:59:36 +02:00
|
|
|
DEFINE_STD_SET_I18N
|
2019-03-03 19:42:22 +01:00
|
|
|
|
1999-08-22 19:02:52 +00:00
|
|
|
|
2014-11-05 02:34:45 +01:00
|
|
|
static const gchar * const selection_modes[] = { "incremental",
|
|
|
|
"angular",
|
|
|
|
"random",
|
|
|
|
"velocity",
|
|
|
|
"pressure",
|
|
|
|
"xtilt",
|
|
|
|
"ytilt" };
|
|
|
|
|
|
|
|
|
1999-08-22 19:02:52 +00:00
|
|
|
static void
|
2019-08-13 22:53:04 +02:00
|
|
|
gih_class_init (GihClass *klass)
|
1999-08-22 19:02:52 +00:00
|
|
|
{
|
2019-08-13 22:53:04 +02:00
|
|
|
GimpPlugInClass *plug_in_class = GIMP_PLUG_IN_CLASS (klass);
|
|
|
|
|
|
|
|
plug_in_class->query_procedures = gih_query_procedures;
|
|
|
|
plug_in_class->create_procedure = gih_create_procedure;
|
2022-05-26 00:59:36 +02:00
|
|
|
plug_in_class->set_i18n = STD_SET_I18N;
|
1999-08-24 05:30:14 +00:00
|
|
|
}
|
|
|
|
|
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 15:14:08 +00:00
|
|
|
static void
|
2019-08-13 22:53:04 +02:00
|
|
|
gih_init (Gih *gih)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
static GList *
|
|
|
|
gih_query_procedures (GimpPlugIn *plug_in)
|
|
|
|
{
|
|
|
|
return g_list_append (NULL, g_strdup (SAVE_PROC));
|
|
|
|
}
|
|
|
|
|
|
|
|
static GimpProcedure *
|
|
|
|
gih_create_procedure (GimpPlugIn *plug_in,
|
|
|
|
const gchar *name)
|
|
|
|
{
|
|
|
|
GimpProcedure *procedure = NULL;
|
|
|
|
|
|
|
|
if (! strcmp (name, SAVE_PROC))
|
|
|
|
{
|
2023-07-22 23:49:47 +02:00
|
|
|
procedure = gimp_save_procedure_new (plug_in, name,
|
|
|
|
GIMP_PDB_PROC_TYPE_PLUGIN,
|
|
|
|
FALSE, gih_save, NULL, NULL);
|
2019-08-13 22:53:04 +02:00
|
|
|
|
|
|
|
gimp_procedure_set_image_types (procedure, "RGB*, GRAY*");
|
|
|
|
|
2022-07-04 22:50:53 +02:00
|
|
|
gimp_procedure_set_menu_label (procedure, _("GIMP brush (animated)"));
|
2019-08-18 13:45:58 +02:00
|
|
|
gimp_procedure_set_icon_name (procedure, GIMP_ICON_BRUSH);
|
2019-08-13 22:53:04 +02:00
|
|
|
|
|
|
|
gimp_procedure_set_documentation (procedure,
|
|
|
|
"exports images in GIMP brush pipe "
|
|
|
|
"format",
|
|
|
|
"This plug-in exports an image in "
|
|
|
|
"the GIMP brush pipe format. For a "
|
|
|
|
"colored brush pipe, RGBA layers are "
|
|
|
|
"used, otherwise the layers should be "
|
|
|
|
"grayscale masks. The image can be "
|
|
|
|
"multi-layered, and additionally the "
|
|
|
|
"layers can be divided into a "
|
|
|
|
"rectangular array of brushes.",
|
|
|
|
SAVE_PROC);
|
|
|
|
gimp_procedure_set_attribution (procedure,
|
|
|
|
"Tor Lillqvist",
|
|
|
|
"Tor Lillqvist",
|
|
|
|
"1999");
|
|
|
|
|
|
|
|
gimp_file_procedure_set_mime_types (GIMP_FILE_PROCEDURE (procedure),
|
|
|
|
"image/x-gimp-gih");
|
2023-07-22 22:25:27 +02:00
|
|
|
gimp_file_procedure_set_format_name (GIMP_FILE_PROCEDURE (procedure),
|
|
|
|
_("Brush Pipe"));
|
2019-08-13 22:53:04 +02:00
|
|
|
gimp_file_procedure_set_extensions (GIMP_FILE_PROCEDURE (procedure),
|
|
|
|
"gih");
|
2019-08-19 12:05:12 +02:00
|
|
|
gimp_file_procedure_set_handles_remote (GIMP_FILE_PROCEDURE (procedure),
|
|
|
|
TRUE);
|
2019-08-13 22:53:04 +02:00
|
|
|
|
2019-08-19 10:02:07 +02:00
|
|
|
GIMP_PROC_ARG_INT (procedure, "spacing",
|
2023-07-22 22:25:27 +02:00
|
|
|
_("Spacing (_percent)"),
|
|
|
|
_("Spacing of the brush"),
|
2023-07-21 20:19:07 +02:00
|
|
|
1, 1000, 20,
|
2019-08-19 10:02:07 +02:00
|
|
|
GIMP_PARAM_READWRITE);
|
|
|
|
|
2019-08-19 12:54:52 +02:00
|
|
|
GIMP_PROC_ARG_STRING (procedure, "description",
|
2023-07-22 22:25:27 +02:00
|
|
|
_("_Description"),
|
|
|
|
_("Short description of the GIH brush pipe"),
|
2023-07-21 20:19:07 +02:00
|
|
|
"GIMP Brush Pipe",
|
2019-08-19 12:54:52 +02:00
|
|
|
GIMP_PARAM_READWRITE);
|
|
|
|
|
2019-08-19 10:02:07 +02:00
|
|
|
GIMP_PROC_ARG_INT (procedure, "cell-width",
|
2023-07-22 22:25:27 +02:00
|
|
|
_("Cell _width"),
|
|
|
|
_("Width of the brush cells in pixels"),
|
|
|
|
1, 1000, 1,
|
2019-08-19 10:02:07 +02:00
|
|
|
GIMP_PARAM_READWRITE);
|
|
|
|
|
|
|
|
GIMP_PROC_ARG_INT (procedure, "cell-height",
|
2023-07-22 22:25:27 +02:00
|
|
|
_("Cell _height"),
|
|
|
|
_("Height of the brush cells in pixels"),
|
2019-08-19 10:02:07 +02:00
|
|
|
1, 1000, 1,
|
|
|
|
GIMP_PARAM_READWRITE);
|
|
|
|
|
2023-07-22 22:25:27 +02:00
|
|
|
GIMP_PROC_ARG_INT (procedure, "num-cells",
|
|
|
|
_("_Number of cells"),
|
|
|
|
_("Number of cells to cut up"),
|
2019-08-19 10:02:07 +02:00
|
|
|
1, 1000, 1,
|
|
|
|
GIMP_PARAM_READWRITE);
|
|
|
|
|
2023-07-22 22:25:27 +02:00
|
|
|
GIMP_PROC_ARG_BYTES (procedure, "ranks",
|
|
|
|
_("_Rank"),
|
|
|
|
_("Ranks of the dimensions"),
|
2023-05-23 23:37:46 +02:00
|
|
|
GIMP_PARAM_READWRITE);
|
2019-08-19 10:02:07 +02:00
|
|
|
|
2023-07-22 22:25:27 +02:00
|
|
|
GIMP_PROC_ARG_STRV (procedure, "selection-modes",
|
|
|
|
"Selection modes",
|
2020-12-23 21:15:43 +01:00
|
|
|
"Selection modes",
|
|
|
|
GIMP_PARAM_READWRITE);
|
2023-07-22 22:25:27 +02:00
|
|
|
|
|
|
|
/* Auxiliary arguments. Only useful for the GUI, to pass info around. */
|
|
|
|
|
|
|
|
GIMP_PROC_AUX_ARG_STRING (procedure, "info-text",
|
|
|
|
_("Display as"),
|
|
|
|
_("Describe how the layers will be split"),
|
|
|
|
"", GIMP_PARAM_READWRITE);
|
|
|
|
|
|
|
|
GIMP_PROC_AUX_ARG_INT (procedure, "dimension",
|
|
|
|
_("D_imension"),
|
|
|
|
_("How many dimensions the animated brush has"),
|
|
|
|
1, 1000, 1,
|
|
|
|
GIMP_PARAM_READWRITE);
|
|
|
|
|
|
|
|
GIMP_PROC_AUX_ARG_INT32_ARRAY (procedure, "guides",
|
|
|
|
"Guides",
|
|
|
|
"Guides to show how the layers will be split in cells",
|
|
|
|
GIMP_PARAM_READWRITE);
|
2019-08-13 22:53:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return procedure;
|
|
|
|
}
|
|
|
|
|
|
|
|
static GimpValueArray *
|
|
|
|
gih_save (GimpProcedure *procedure,
|
|
|
|
GimpRunMode run_mode,
|
2019-08-14 16:13:51 +02:00
|
|
|
GimpImage *image,
|
2020-04-14 11:46:17 +02:00
|
|
|
gint n_drawables,
|
|
|
|
GimpDrawable **drawables,
|
2019-08-13 22:53:04 +02:00
|
|
|
GFile *file,
|
2023-07-21 20:19:07 +02:00
|
|
|
GimpMetadata *metadata,
|
|
|
|
GimpProcedureConfig *config,
|
2019-08-13 22:53:04 +02:00
|
|
|
gpointer run_data)
|
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 15:14:08 +00:00
|
|
|
{
|
2003-11-06 15:27:05 +00:00
|
|
|
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
|
|
|
|
GimpExportReturn export = GIMP_EXPORT_CANCEL;
|
2019-08-13 22:53:04 +02:00
|
|
|
GimpParasite *parasite;
|
2019-08-14 16:13:51 +02:00
|
|
|
GimpImage *orig_image;
|
2008-08-18 19:35:55 +00:00
|
|
|
GError *error = NULL;
|
2023-07-22 22:25:27 +02:00
|
|
|
|
|
|
|
GimpPixPipeParams gihparams = { 0, };
|
2023-07-21 20:19:07 +02:00
|
|
|
gchar *description = NULL;
|
|
|
|
gint spacing;
|
2023-07-22 22:25:27 +02:00
|
|
|
GBytes *rank_bytes;
|
|
|
|
const guint8 *rank;
|
|
|
|
gchar **selection;
|
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 15:14:08 +00:00
|
|
|
|
2019-08-14 16:13:51 +02:00
|
|
|
orig_image = image;
|
2001-12-29 13:26:29 +00:00
|
|
|
|
2023-07-22 22:25:27 +02:00
|
|
|
if (run_mode == GIMP_RUN_INTERACTIVE)
|
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 15:14:08 +00:00
|
|
|
{
|
2023-07-22 22:25:27 +02:00
|
|
|
GParamSpec *spec;
|
|
|
|
gint image_width;
|
|
|
|
gint image_height;
|
|
|
|
gint cell_width;
|
|
|
|
gint cell_height;
|
2019-08-13 22:53:04 +02:00
|
|
|
|
2020-04-14 11:46:17 +02:00
|
|
|
export = gimp_export_image (&image, &n_drawables, &drawables, "GIH",
|
2019-08-13 22:53:04 +02:00
|
|
|
GIMP_EXPORT_CAN_HANDLE_RGB |
|
|
|
|
GIMP_EXPORT_CAN_HANDLE_GRAY |
|
|
|
|
GIMP_EXPORT_CAN_HANDLE_ALPHA |
|
|
|
|
GIMP_EXPORT_CAN_HANDLE_LAYERS);
|
|
|
|
|
|
|
|
if (export == GIMP_EXPORT_CANCEL)
|
|
|
|
return gimp_procedure_new_return_values (procedure,
|
|
|
|
GIMP_PDB_CANCEL,
|
|
|
|
NULL);
|
|
|
|
|
|
|
|
/* Possibly retrieve data */
|
2019-08-14 16:13:51 +02:00
|
|
|
parasite = gimp_image_get_parasite (orig_image,
|
2019-08-13 22:53:04 +02:00
|
|
|
"gimp-brush-pipe-name");
|
|
|
|
if (parasite)
|
2008-10-20 06:04:39 +00:00
|
|
|
{
|
2021-01-30 00:20:34 +01:00
|
|
|
gchar *parasite_data;
|
|
|
|
guint32 parasite_size;
|
|
|
|
|
|
|
|
parasite_data = (gchar *) gimp_parasite_get_data (parasite, ¶site_size);
|
|
|
|
|
2023-07-21 20:19:07 +02:00
|
|
|
g_object_set (config, "description", parasite_data , NULL);
|
2013-11-10 00:18:48 +01:00
|
|
|
|
2019-08-13 22:53:04 +02:00
|
|
|
gimp_parasite_free (parasite);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
gchar *name = g_path_get_basename (gimp_file_get_utf8_name (file));
|
2014-11-05 02:34:45 +01:00
|
|
|
|
2019-08-13 22:53:04 +02:00
|
|
|
if (g_str_has_suffix (name, ".gih"))
|
|
|
|
name[strlen (name) - 4] = '\0';
|
2014-11-05 02:34:45 +01:00
|
|
|
|
2019-08-13 22:53:04 +02:00
|
|
|
if (strlen (name))
|
2023-07-21 20:19:07 +02:00
|
|
|
g_object_set (config, "description", name, NULL);
|
2014-11-05 02:34:45 +01:00
|
|
|
|
2019-08-13 22:53:04 +02:00
|
|
|
g_free (name);
|
|
|
|
}
|
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 15:14:08 +00:00
|
|
|
|
2023-07-22 22:25:27 +02:00
|
|
|
g_object_get (config,
|
|
|
|
"cell-width", &cell_width,
|
|
|
|
"cell-height", &cell_height,
|
|
|
|
NULL);
|
2014-11-05 02:34:45 +01:00
|
|
|
|
2023-07-22 22:25:27 +02:00
|
|
|
image_width = gimp_image_get_width (image);
|
|
|
|
image_height = gimp_image_get_height (image);
|
2003-11-06 15:27:05 +00:00
|
|
|
|
2023-07-22 22:25:27 +02:00
|
|
|
spec = g_object_class_find_property (G_OBJECT_GET_CLASS (config), "cell-width");
|
|
|
|
G_PARAM_SPEC_INT (spec)->default_value = image_width;
|
|
|
|
G_PARAM_SPEC_INT (spec)->maximum = image_width;
|
2023-07-21 20:19:07 +02:00
|
|
|
|
2023-07-22 22:25:27 +02:00
|
|
|
spec = g_object_class_find_property (G_OBJECT_GET_CLASS (config), "cell-height");
|
|
|
|
G_PARAM_SPEC_INT (spec)->default_value = image_height;
|
|
|
|
G_PARAM_SPEC_INT (spec)->maximum = image_height;
|
2013-01-19 20:52:27 +01:00
|
|
|
|
2023-07-22 22:25:27 +02:00
|
|
|
if (cell_width == 1 && cell_height == 1)
|
2019-08-13 22:53:04 +02:00
|
|
|
{
|
2023-07-22 22:25:27 +02:00
|
|
|
g_object_set (config,
|
|
|
|
"cell-width", image_width,
|
|
|
|
"cell-height", image_height,
|
|
|
|
NULL);
|
2021-01-30 00:20:34 +01:00
|
|
|
|
2023-07-22 22:25:27 +02:00
|
|
|
spec = g_object_class_find_property (G_OBJECT_GET_CLASS (config), "num-cells");
|
|
|
|
G_PARAM_SPEC_INT (spec)->maximum = 1;
|
2019-08-13 22:53:04 +02:00
|
|
|
}
|
2013-04-28 22:19:44 +03:00
|
|
|
|
2023-07-22 22:25:27 +02:00
|
|
|
gimp_ui_init (PLUG_IN_BINARY);
|
2008-10-20 06:04:39 +00:00
|
|
|
|
2023-07-22 22:25:27 +02:00
|
|
|
if (! gih_save_dialog (image, procedure, config))
|
2019-08-13 22:53:04 +02:00
|
|
|
{
|
|
|
|
status = GIMP_PDB_CANCEL;
|
|
|
|
goto out;
|
|
|
|
}
|
2023-07-22 22:25:27 +02:00
|
|
|
}
|
2019-08-13 22:53:04 +02:00
|
|
|
|
2023-07-22 22:25:27 +02:00
|
|
|
gimp_pixpipe_params_init (&gihparams);
|
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 15:14:08 +00:00
|
|
|
|
2023-07-22 22:25:27 +02:00
|
|
|
g_object_get (config,
|
|
|
|
"spacing", &spacing,
|
|
|
|
"description", &description,
|
|
|
|
"cell-width", &gihparams.cellwidth,
|
|
|
|
"cell-height", &gihparams.cellheight,
|
|
|
|
"num-cells", &gihparams.ncells,
|
|
|
|
"ranks", &rank_bytes,
|
|
|
|
"selection-modes", &selection,
|
|
|
|
NULL);
|
2021-01-30 00:20:34 +01:00
|
|
|
|
2023-07-22 22:25:27 +02:00
|
|
|
gihparams.cols = gimp_image_get_width (image) / gihparams.cellwidth;
|
|
|
|
gihparams.rows = gimp_image_get_height (image) / gihparams.cellheight;
|
2021-01-30 00:20:34 +01:00
|
|
|
|
2023-07-22 22:25:27 +02:00
|
|
|
rank = g_bytes_get_data (rank_bytes, NULL);
|
|
|
|
gihparams.dim = g_bytes_get_size (rank_bytes);
|
2021-01-30 00:20:34 +01:00
|
|
|
|
2023-07-22 22:25:27 +02:00
|
|
|
for (gint i = 0; i < gihparams.dim; i++)
|
|
|
|
{
|
|
|
|
gihparams.rank[i] = rank[i];
|
|
|
|
gihparams.selection[i] = g_strdup (selection[i]);
|
2019-08-13 22:53:04 +02:00
|
|
|
}
|
2019-03-03 19:42:22 +01:00
|
|
|
|
2023-07-22 22:25:27 +02:00
|
|
|
g_strfreev (selection);
|
|
|
|
g_bytes_unref (rank_bytes);
|
|
|
|
|
2019-08-13 22:53:04 +02:00
|
|
|
if (status == GIMP_PDB_SUCCESS)
|
|
|
|
{
|
libgimp: PDB procedure arguments are not order-based anymore (API-wise).
As far as plug-in API is concerned, at least the calling API, order of arguments
when calling PDB procedures doesn't matter anymore.
Order still matters for creating procedures with standard arguments (for
instance, "run-mode" is first, then image, or file, drawables or whatnot,
depending on the subtype of procedure), but not for calling with libgimp.
Concretely in this commit:
- gimp_pdb_run_procedure_argv() was removed as it's intrinsically order-based.
- gimp_pdb_run_procedure() and gimp_pdb_run_procedure_valist() stay but their
semantic changes. Instead of an ordered list of (type, value) couple, it's now
an unordered list of (name, type, value) triplets. This way, you can also
ignore as many args as you want if you intend to keep them default. For
instance, say you have a procedure with 20 args and you only want to change
the last one and keep the 19 first with default values: while you used to have
to write down all 20 args annoyingly, now you can just list the only arg you
care about.
There are 2 important consequences here:
1. Calling PDB procedures becomes much more semantic, which means scripts with
PDB calls are simpler (smaller list of arguments) and easier to read (when
you had 5 int arguments in a row, you couldn't know what they refer to,
except by always checking the PDB source; now you'll have associated names,
such as "width", "height" and so on) hence maintain.
2. We will have the ability to add arguments and even order the new arguments in
middle of existing arguments without breaking compatibility. The only thing
which will matter will be that default values of new arguments will have to
behave like when the arg didn't exist. This way, existing scripts will not be
broken. This will avoid us having to always create variants of PDB procedure
(like original "file-bla-save", then variant "file-bla-save-2" and so on)
each time we add arguments.
Note: gimp_pdb_run_procedure_array() was not removed yet because it's currently
used by the PDB. To be followed.
2023-10-16 16:44:06 +02:00
|
|
|
GimpValueArray *save_retvals;
|
|
|
|
GimpObjectArray *drawables_array;
|
|
|
|
gchar *paramstring;
|
2019-08-13 22:53:04 +02:00
|
|
|
|
|
|
|
paramstring = gimp_pixpipe_params_build (&gihparams);
|
|
|
|
|
libgimp: PDB procedure arguments are not order-based anymore (API-wise).
As far as plug-in API is concerned, at least the calling API, order of arguments
when calling PDB procedures doesn't matter anymore.
Order still matters for creating procedures with standard arguments (for
instance, "run-mode" is first, then image, or file, drawables or whatnot,
depending on the subtype of procedure), but not for calling with libgimp.
Concretely in this commit:
- gimp_pdb_run_procedure_argv() was removed as it's intrinsically order-based.
- gimp_pdb_run_procedure() and gimp_pdb_run_procedure_valist() stay but their
semantic changes. Instead of an ordered list of (type, value) couple, it's now
an unordered list of (name, type, value) triplets. This way, you can also
ignore as many args as you want if you intend to keep them default. For
instance, say you have a procedure with 20 args and you only want to change
the last one and keep the 19 first with default values: while you used to have
to write down all 20 args annoyingly, now you can just list the only arg you
care about.
There are 2 important consequences here:
1. Calling PDB procedures becomes much more semantic, which means scripts with
PDB calls are simpler (smaller list of arguments) and easier to read (when
you had 5 int arguments in a row, you couldn't know what they refer to,
except by always checking the PDB source; now you'll have associated names,
such as "width", "height" and so on) hence maintain.
2. We will have the ability to add arguments and even order the new arguments in
middle of existing arguments without breaking compatibility. The only thing
which will matter will be that default values of new arguments will have to
behave like when the arg didn't exist. This way, existing scripts will not be
broken. This will avoid us having to always create variants of PDB procedure
(like original "file-bla-save", then variant "file-bla-save-2" and so on)
each time we add arguments.
Note: gimp_pdb_run_procedure_array() was not removed yet because it's currently
used by the PDB. To be followed.
2023-10-16 16:44:06 +02:00
|
|
|
drawables_array = gimp_object_array_new (GIMP_TYPE_DRAWABLE, (GObject **) drawables,
|
|
|
|
n_drawables, FALSE);
|
|
|
|
save_retvals = gimp_pdb_run_procedure (gimp_get_pdb (),
|
|
|
|
"file-gih-save-internal",
|
2023-10-17 15:49:32 +02:00
|
|
|
"image", image,
|
|
|
|
"num-drawables", n_drawables,
|
|
|
|
"drawables", drawables_array,
|
|
|
|
"file", file,
|
|
|
|
"spacing", spacing,
|
|
|
|
"name", description,
|
|
|
|
"params", paramstring,
|
libgimp: PDB procedure arguments are not order-based anymore (API-wise).
As far as plug-in API is concerned, at least the calling API, order of arguments
when calling PDB procedures doesn't matter anymore.
Order still matters for creating procedures with standard arguments (for
instance, "run-mode" is first, then image, or file, drawables or whatnot,
depending on the subtype of procedure), but not for calling with libgimp.
Concretely in this commit:
- gimp_pdb_run_procedure_argv() was removed as it's intrinsically order-based.
- gimp_pdb_run_procedure() and gimp_pdb_run_procedure_valist() stay but their
semantic changes. Instead of an ordered list of (type, value) couple, it's now
an unordered list of (name, type, value) triplets. This way, you can also
ignore as many args as you want if you intend to keep them default. For
instance, say you have a procedure with 20 args and you only want to change
the last one and keep the 19 first with default values: while you used to have
to write down all 20 args annoyingly, now you can just list the only arg you
care about.
There are 2 important consequences here:
1. Calling PDB procedures becomes much more semantic, which means scripts with
PDB calls are simpler (smaller list of arguments) and easier to read (when
you had 5 int arguments in a row, you couldn't know what they refer to,
except by always checking the PDB source; now you'll have associated names,
such as "width", "height" and so on) hence maintain.
2. We will have the ability to add arguments and even order the new arguments in
middle of existing arguments without breaking compatibility. The only thing
which will matter will be that default values of new arguments will have to
behave like when the arg didn't exist. This way, existing scripts will not be
broken. This will avoid us having to always create variants of PDB procedure
(like original "file-bla-save", then variant "file-bla-save-2" and so on)
each time we add arguments.
Note: gimp_pdb_run_procedure_array() was not removed yet because it's currently
used by the PDB. To be followed.
2023-10-16 16:44:06 +02:00
|
|
|
NULL);
|
|
|
|
gimp_object_array_free (drawables_array);
|
2019-08-13 22:53:04 +02:00
|
|
|
|
2019-08-20 01:03:38 +02:00
|
|
|
if (GIMP_VALUES_GET_ENUM (save_retvals, 0) == GIMP_PDB_SUCCESS)
|
2019-08-13 22:53:04 +02:00
|
|
|
{
|
|
|
|
parasite = gimp_parasite_new ("gimp-brush-pipe-name",
|
|
|
|
GIMP_PARASITE_PERSISTENT,
|
2023-07-21 20:19:07 +02:00
|
|
|
strlen (description) + 1,
|
|
|
|
description);
|
2019-08-14 16:13:51 +02:00
|
|
|
gimp_image_attach_parasite (orig_image, parasite);
|
2019-08-13 22:53:04 +02:00
|
|
|
gimp_parasite_free (parasite);
|
2008-10-20 06:04:39 +00:00
|
|
|
}
|
2019-08-13 22:53:04 +02:00
|
|
|
else
|
|
|
|
{
|
|
|
|
g_set_error (&error, 0, 0,
|
|
|
|
"Running procedure 'file-gih-save-internal' "
|
|
|
|
"failed: %s",
|
|
|
|
gimp_pdb_get_last_error (gimp_get_pdb ()));
|
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 15:14:08 +00:00
|
|
|
|
2019-08-13 22:53:04 +02:00
|
|
|
status = GIMP_PDB_EXECUTION_ERROR;
|
|
|
|
}
|
2018-06-27 18:31:38 +02:00
|
|
|
|
2019-08-13 22:53:04 +02:00
|
|
|
g_free (paramstring);
|
2000-12-18 19:38:43 +00:00
|
|
|
}
|
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 15:14:08 +00:00
|
|
|
|
2019-08-13 22:53:04 +02:00
|
|
|
gimp_pixpipe_params_free (&gihparams);
|
2023-07-21 20:19:07 +02:00
|
|
|
g_free (description);
|
2019-08-13 22:53:04 +02:00
|
|
|
|
|
|
|
out:
|
|
|
|
if (export == GIMP_EXPORT_EXPORT)
|
2020-04-14 11:46:17 +02:00
|
|
|
{
|
|
|
|
gimp_image_delete (image);
|
|
|
|
g_free (drawables);
|
|
|
|
}
|
2008-08-18 19:35:55 +00:00
|
|
|
|
2019-08-13 22:53:04 +02:00
|
|
|
return gimp_procedure_new_return_values (procedure, status, error);
|
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 15:14:08 +00:00
|
|
|
}
|
|
|
|
|
2000-12-18 19:38:43 +00:00
|
|
|
|
|
|
|
/* save routines */
|
|
|
|
|
1999-09-02 00:01:41 +00:00
|
|
|
static void
|
2023-07-22 22:25:27 +02:00
|
|
|
gih_remove_guides (GimpProcedureConfig *config,
|
|
|
|
GimpImage *image)
|
1999-09-02 00:01:41 +00:00
|
|
|
{
|
2023-07-22 22:25:27 +02:00
|
|
|
GimpArray *array;
|
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 15:14:08 +00:00
|
|
|
|
2023-07-22 22:25:27 +02:00
|
|
|
g_object_get (config, "guides", &array, NULL);
|
1999-09-02 00:01:41 +00:00
|
|
|
|
2023-07-22 22:25:27 +02:00
|
|
|
if (array != NULL)
|
1999-09-02 00:01:41 +00:00
|
|
|
{
|
2023-07-22 22:25:27 +02:00
|
|
|
gint32 *guides = (gint32 *) array->data;
|
|
|
|
gint n_guides = array->length / 4;
|
|
|
|
|
|
|
|
for (gint i = 0; i < n_guides; i++)
|
|
|
|
gimp_image_delete_guide (image, guides[i]);
|
1999-09-02 00:01:41 +00:00
|
|
|
}
|
2023-07-22 22:25:27 +02:00
|
|
|
g_clear_pointer (&array, gimp_array_free);
|
|
|
|
|
|
|
|
g_object_set (config, "guides", NULL, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gih_cell_width_notify (GimpProcedureConfig *config,
|
|
|
|
const GParamSpec *pspec,
|
|
|
|
GimpProcedureDialog *dialog)
|
|
|
|
{
|
|
|
|
GimpImage *image;
|
|
|
|
GParamSpec *spec;
|
|
|
|
gchar *info_text;
|
|
|
|
gchar *grid_text = NULL;
|
|
|
|
const gchar *width_warning = _("Width Mismatch!");
|
|
|
|
gchar *height_warning = _("Height Mismatch!");
|
|
|
|
GtkWidget *widget;
|
|
|
|
GtkAdjustment *rank0;
|
|
|
|
gint dimension;
|
|
|
|
|
|
|
|
gint cell_width;
|
|
|
|
gint image_width;
|
|
|
|
gint n_horiz_cells;
|
|
|
|
gint n_vert_cells;
|
|
|
|
|
|
|
|
gint cell_height;
|
|
|
|
gint image_height;
|
|
|
|
gint n_vert_guides;
|
|
|
|
gint n_horiz_guides;
|
|
|
|
|
|
|
|
gint old_max_cells;
|
|
|
|
gint max_cells;
|
|
|
|
gint num_cells;
|
|
|
|
|
|
|
|
image = g_object_get_data (G_OBJECT (dialog), "image");
|
|
|
|
rank0 = g_object_get_data (G_OBJECT (dialog), "rank0");
|
|
|
|
|
|
|
|
g_object_get (config,
|
|
|
|
"cell-width", &cell_width,
|
|
|
|
"cell-height", &cell_height,
|
|
|
|
"num-cells", &num_cells,
|
|
|
|
"dimension", &dimension,
|
|
|
|
NULL);
|
|
|
|
|
|
|
|
spec = g_object_class_find_property (G_OBJECT_GET_CLASS (config), "cell-width");
|
|
|
|
image_width = G_PARAM_SPEC_INT (spec)->maximum;
|
|
|
|
n_horiz_cells = image_width / cell_width;
|
|
|
|
n_vert_guides = n_horiz_cells - 1;
|
|
|
|
|
|
|
|
if (cell_width * n_horiz_cells == image_width)
|
|
|
|
width_warning = NULL;
|
|
|
|
|
|
|
|
spec = g_object_class_find_property (G_OBJECT_GET_CLASS (config), "cell-height");
|
|
|
|
image_height = G_PARAM_SPEC_INT (spec)->maximum;
|
|
|
|
n_vert_cells = image_height / cell_height;
|
|
|
|
n_horiz_guides = n_vert_cells - 1;
|
|
|
|
|
|
|
|
if (cell_height * n_vert_cells == image_height)
|
|
|
|
height_warning = NULL;
|
|
|
|
|
|
|
|
/* TRANSLATORS: \xc3\x97 is the UTF-8 encoding for the multiplication sign. */
|
|
|
|
if (n_horiz_guides + n_vert_guides > 0)
|
|
|
|
grid_text = g_strdup_printf (_("Displays as a %d \xc3\x97 %d grid on each layer"),
|
|
|
|
n_horiz_cells, n_vert_cells);
|
|
|
|
info_text = g_strdup_printf ("%s%s%s%s%s",
|
|
|
|
grid_text != NULL ? grid_text : "",
|
|
|
|
grid_text != NULL && width_warning != NULL ? " / " : "",
|
|
|
|
width_warning != NULL ? width_warning : "",
|
|
|
|
(grid_text != NULL || width_warning != NULL) && height_warning != NULL ? " / " : "",
|
|
|
|
height_warning != NULL ? height_warning : "");
|
|
|
|
|
|
|
|
spec = g_object_class_find_property (G_OBJECT_GET_CLASS (config), "num-cells");
|
|
|
|
old_max_cells = G_PARAM_SPEC_INT (spec)->maximum;
|
|
|
|
max_cells = n_horiz_cells * n_vert_cells;
|
|
|
|
|
|
|
|
if (num_cells == old_max_cells)
|
|
|
|
num_cells = max_cells;
|
1999-09-02 00:01:41 +00:00
|
|
|
else
|
2023-07-22 22:25:27 +02:00
|
|
|
num_cells = MIN (max_cells, num_cells);
|
|
|
|
|
|
|
|
G_PARAM_SPEC_INT (spec)->maximum = max_cells;
|
|
|
|
widget = gimp_procedure_dialog_get_widget (dialog, "num-cells", G_TYPE_NONE);
|
|
|
|
g_object_set (widget, "upper", (gdouble) max_cells, NULL);
|
|
|
|
gimp_label_spin_set_increments (GIMP_LABEL_SPIN (widget), 1.0, 1.0);
|
|
|
|
|
|
|
|
gih_remove_guides (config, image);
|
|
|
|
|
|
|
|
widget = gimp_procedure_dialog_get_widget (dialog, "info-text", G_TYPE_NONE);
|
|
|
|
gtk_widget_set_visible (widget, (strlen (info_text) > 0));
|
|
|
|
if (n_horiz_guides + n_vert_guides > 0)
|
1999-09-02 00:01:41 +00:00
|
|
|
{
|
2023-07-22 22:25:27 +02:00
|
|
|
gint32 *guides = NULL;
|
|
|
|
GValue value = G_VALUE_INIT;
|
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 15:14:08 +00:00
|
|
|
|
2023-07-22 22:25:27 +02:00
|
|
|
guides = g_new0 (gint32, n_horiz_guides + n_vert_guides);
|
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 15:14:08 +00:00
|
|
|
|
2023-07-22 22:25:27 +02:00
|
|
|
for (gint i = 0; i < n_vert_guides; i++)
|
|
|
|
guides[i] = gimp_image_add_vguide (image, cell_width * (i + 1));
|
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 15:14:08 +00:00
|
|
|
|
2023-07-22 22:25:27 +02:00
|
|
|
for (gint i = 0; i < n_horiz_guides; i++)
|
|
|
|
guides[n_vert_guides + i] = gimp_image_add_hguide (image, cell_height * (i + 1));
|
1999-09-02 00:01:41 +00:00
|
|
|
|
2023-07-22 22:25:27 +02:00
|
|
|
g_value_init (&value, GIMP_TYPE_INT32_ARRAY);
|
|
|
|
gimp_value_set_int32_array (&value, guides, n_horiz_guides + n_vert_guides);
|
|
|
|
g_object_set_property (G_OBJECT (config), "guides", &value);
|
|
|
|
g_free (guides);
|
|
|
|
}
|
|
|
|
|
|
|
|
g_object_set (config,
|
|
|
|
"info-text", info_text,
|
|
|
|
"num-cells", num_cells,
|
|
|
|
NULL);
|
|
|
|
if (rank0 != NULL && dimension == 1)
|
|
|
|
gtk_adjustment_set_value (rank0, num_cells);
|
|
|
|
|
|
|
|
g_free (info_text);
|
|
|
|
g_free (grid_text);
|
1999-08-22 19:02:52 +00:00
|
|
|
}
|
|
|
|
|
Implement the selection of brush based on cursor direction, pressure,
1999-08-28 Tor Lillqvist <tml@iki.fi>
* app/gimpbrushpipe.c: Implement the selection of brush based on
cursor direction, pressure, tilt, or a random value. (Hmm, forgot
velocity, later.) (In addition to just incrementally stepping.)
Read the brush pipe parameters from the gih file's second line.
There is no way to tune the parameters in the GIMP, they must
currently be set when saving the gih file (in the gpb plug-in).
* app/gimpbrushpipe.h
* app/gimpbrushpipeP.h: Move the PipeSelectModes enum to the
"private" header. Add a stride array to GimpBrushPipe to make
indexing easier.
* plug-ins/common/gpb.c: Add selection mode fields to the dialog.
Attach the pipe parameters entered as a parasite, too.
* docs/parasites.txt
* plug-ins/common/psp.c: Use "placement", not "spacing" (which
means another thing).
1999-08-28 01:14:42 +00:00
|
|
|
static void
|
2023-07-22 22:25:27 +02:00
|
|
|
gih_selection_mode_changed (GtkWidget *widget,
|
|
|
|
gpointer data)
|
Implement the selection of brush based on cursor direction, pressure,
1999-08-28 Tor Lillqvist <tml@iki.fi>
* app/gimpbrushpipe.c: Implement the selection of brush based on
cursor direction, pressure, tilt, or a random value. (Hmm, forgot
velocity, later.) (In addition to just incrementally stepping.)
Read the brush pipe parameters from the gih file's second line.
There is no way to tune the parameters in the GIMP, they must
currently be set when saving the gih file (in the gpb plug-in).
* app/gimpbrushpipe.h
* app/gimpbrushpipeP.h: Move the PipeSelectModes enum to the
"private" header. Add a stride array to GimpBrushPipe to make
indexing easier.
* plug-ins/common/gpb.c: Add selection mode fields to the dialog.
Attach the pipe parameters entered as a parasite, too.
* docs/parasites.txt
* plug-ins/common/psp.c: Use "placement", not "spacing" (which
means another thing).
1999-08-28 01:14:42 +00:00
|
|
|
{
|
2004-08-21 10:38:38 +00:00
|
|
|
gint index;
|
|
|
|
|
|
|
|
index = gtk_combo_box_get_active (GTK_COMBO_BOX (widget));
|
|
|
|
|
2023-07-22 22:25:27 +02:00
|
|
|
g_free (*((gchar **) data));
|
|
|
|
*((gchar **) data) = g_strdup (selection_modes [index]);
|
2004-08-21 10:38:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2023-07-22 22:25:27 +02:00
|
|
|
gih_dimension_notify (GimpProcedureConfig *config,
|
|
|
|
const GParamSpec *pspec,
|
|
|
|
SizeAdjustmentData *data)
|
2004-08-21 10:38:38 +00:00
|
|
|
{
|
2023-07-22 22:25:27 +02:00
|
|
|
gint dimension;
|
2004-08-21 10:38:38 +00:00
|
|
|
gint i;
|
|
|
|
|
2023-07-22 22:25:27 +02:00
|
|
|
g_object_get (config, "dimension", &dimension, NULL);
|
2004-08-21 10:38:38 +00:00
|
|
|
|
|
|
|
for (i = 0; i < GIMP_PIXPIPE_MAXDIM; i++)
|
|
|
|
{
|
2023-07-22 22:25:27 +02:00
|
|
|
gtk_widget_set_sensitive (data->rank_entry[i], i < dimension);
|
|
|
|
gtk_widget_set_sensitive (data->mode_entry[i], i < dimension);
|
2004-08-21 10:38:38 +00:00
|
|
|
}
|
Implement the selection of brush based on cursor direction, pressure,
1999-08-28 Tor Lillqvist <tml@iki.fi>
* app/gimpbrushpipe.c: Implement the selection of brush based on
cursor direction, pressure, tilt, or a random value. (Hmm, forgot
velocity, later.) (In addition to just incrementally stepping.)
Read the brush pipe parameters from the gih file's second line.
There is no way to tune the parameters in the GIMP, they must
currently be set when saving the gih file (in the gpb plug-in).
* app/gimpbrushpipe.h
* app/gimpbrushpipeP.h: Move the PipeSelectModes enum to the
"private" header. Add a stride array to GimpBrushPipe to make
indexing easier.
* plug-ins/common/gpb.c: Add selection mode fields to the dialog.
Attach the pipe parameters entered as a parasite, too.
* docs/parasites.txt
* plug-ins/common/psp.c: Use "placement", not "spacing" (which
means another thing).
1999-08-28 01:14:42 +00:00
|
|
|
}
|
|
|
|
|
2004-05-19 15:28:01 +00:00
|
|
|
static gboolean
|
2023-07-22 22:25:27 +02:00
|
|
|
gih_save_dialog (GimpImage *image,
|
|
|
|
GimpProcedure *procedure,
|
|
|
|
GimpProcedureConfig *config)
|
1999-08-22 19:02:52 +00:00
|
|
|
{
|
2023-07-22 22:25:27 +02:00
|
|
|
GtkWidget *dialog;
|
|
|
|
GtkWidget *dimgrid;
|
|
|
|
GtkWidget *label;
|
|
|
|
GtkAdjustment *adjustment;
|
|
|
|
GtkWidget *spinbutton;
|
|
|
|
GtkWidget *cb;
|
|
|
|
gint i;
|
|
|
|
SizeAdjustmentData cellw_adjust;
|
|
|
|
SizeAdjustmentData cellh_adjust;
|
|
|
|
gchar **selection;
|
|
|
|
GBytes *rank_bytes = NULL;
|
|
|
|
guint8 rank[GIMP_PIXPIPE_MAXDIM];
|
|
|
|
gint num_cells;
|
|
|
|
gint dimension;
|
|
|
|
gboolean run;
|
|
|
|
|
|
|
|
dialog = gimp_save_procedure_dialog_new (GIMP_SAVE_PROCEDURE (procedure),
|
|
|
|
GIMP_PROCEDURE_CONFIG (config),
|
|
|
|
image);
|
|
|
|
|
|
|
|
gtk_widget_set_halign (gimp_procedure_dialog_get_label (GIMP_PROCEDURE_DIALOG (dialog),
|
|
|
|
"info-text", NULL, TRUE, FALSE),
|
|
|
|
GTK_ALIGN_START);
|
|
|
|
gimp_procedure_dialog_fill (GIMP_PROCEDURE_DIALOG (dialog),
|
|
|
|
"description", "spacing",
|
|
|
|
"cell-width", "cell-height", "num-cells",
|
|
|
|
"info-text", "dimension", NULL);
|
|
|
|
|
|
|
|
g_object_set_data (G_OBJECT (dialog), "image", image);
|
|
|
|
g_signal_connect (config, "notify::cell-width",
|
|
|
|
G_CALLBACK (gih_cell_width_notify),
|
|
|
|
dialog);
|
|
|
|
g_signal_connect (config, "notify::cell-height",
|
|
|
|
G_CALLBACK (gih_cell_width_notify),
|
|
|
|
dialog);
|
|
|
|
gih_cell_width_notify (config, NULL, GIMP_PROCEDURE_DIALOG (dialog));
|
|
|
|
|
|
|
|
g_signal_connect (config, "notify::dimension",
|
|
|
|
G_CALLBACK (gih_dimension_notify),
|
|
|
|
&cellw_adjust);
|
2014-11-05 02:34:45 +01:00
|
|
|
|
1999-08-24 05:30:14 +00:00
|
|
|
/*
|
2023-07-22 22:25:27 +02:00
|
|
|
* Ranks / Selection: ______ ______ ______ ______ ______
|
1999-08-24 05:30:14 +00:00
|
|
|
*/
|
2001-12-29 13:26:29 +00:00
|
|
|
|
2023-07-22 22:25:27 +02:00
|
|
|
g_object_get (config,
|
|
|
|
"selection-modes", &selection,
|
|
|
|
"ranks", &rank_bytes,
|
|
|
|
"num-cells", &num_cells,
|
|
|
|
NULL);
|
|
|
|
if (selection == NULL || g_strv_length (selection) != GIMP_PIXPIPE_MAXDIM)
|
|
|
|
{
|
|
|
|
GStrvBuilder *builder = g_strv_builder_new ();
|
|
|
|
gint old_len;
|
1999-08-24 05:30:14 +00:00
|
|
|
|
2023-07-22 22:25:27 +02:00
|
|
|
old_len = (selection == NULL ? 0 : g_strv_length (selection));
|
1999-09-02 00:01:41 +00:00
|
|
|
|
2023-07-22 22:25:27 +02:00
|
|
|
for (i = 0; i < MIN (old_len, GIMP_PIXPIPE_MAXDIM); i++)
|
|
|
|
g_strv_builder_add (builder, selection[i]);
|
2000-01-15 15:32:28 +00:00
|
|
|
|
2023-07-22 22:25:27 +02:00
|
|
|
for (i = old_len; i < GIMP_PIXPIPE_MAXDIM; i++)
|
|
|
|
g_strv_builder_add (builder, "random");
|
2000-01-25 17:46:56 +00:00
|
|
|
|
2023-07-22 22:25:27 +02:00
|
|
|
g_strfreev (selection);
|
|
|
|
selection = g_strv_builder_end (builder);
|
|
|
|
g_strv_builder_unref (builder);
|
|
|
|
}
|
1999-09-02 00:01:41 +00:00
|
|
|
|
2023-07-22 22:25:27 +02:00
|
|
|
if (rank_bytes == NULL)
|
|
|
|
{
|
|
|
|
dimension = 1;
|
1999-09-02 00:01:41 +00:00
|
|
|
|
2023-07-22 22:25:27 +02:00
|
|
|
rank[0] = 1;
|
|
|
|
for (i = 1; i < GIMP_PIXPIPE_MAXDIM; i++)
|
|
|
|
rank[i] = 0;
|
|
|
|
}
|
1999-09-02 00:01:41 +00:00
|
|
|
else
|
2023-07-22 22:25:27 +02:00
|
|
|
{
|
|
|
|
const guint8 *stored;
|
2000-01-25 17:46:56 +00:00
|
|
|
|
2023-07-22 22:25:27 +02:00
|
|
|
stored = g_bytes_get_data (rank_bytes, NULL);
|
|
|
|
dimension = g_bytes_get_size (rank_bytes);
|
2003-11-06 15:27:05 +00:00
|
|
|
|
2023-07-22 22:25:27 +02:00
|
|
|
for (i = 0; i < dimension; i++)
|
|
|
|
rank[i] = stored[i];
|
1999-08-24 05:30:14 +00:00
|
|
|
|
2023-07-22 22:25:27 +02:00
|
|
|
for (i = dimension; i < GIMP_PIXPIPE_MAXDIM; i++)
|
|
|
|
rank[i] = 1;
|
|
|
|
}
|
|
|
|
g_bytes_unref (rank_bytes);
|
|
|
|
dimension = MAX (dimension, 1);
|
2004-08-21 10:38:38 +00:00
|
|
|
|
2018-05-11 12:18:01 +02:00
|
|
|
dimgrid = gtk_grid_new ();
|
|
|
|
gtk_grid_set_column_spacing (GTK_GRID (dimgrid), 4);
|
2023-07-22 22:25:27 +02:00
|
|
|
|
|
|
|
label = gtk_label_new (_("Ranks:"));
|
|
|
|
gtk_grid_attach (GTK_GRID (dimgrid), label, 0, 0, 1, 1);
|
|
|
|
gtk_widget_show (label);
|
|
|
|
|
2000-05-26 22:28:40 +00:00
|
|
|
for (i = 0; i < GIMP_PIXPIPE_MAXDIM; i++)
|
1999-08-24 05:30:14 +00:00
|
|
|
{
|
2021-05-24 20:36:31 +00:00
|
|
|
gsize j;
|
2000-01-15 15:32:28 +00:00
|
|
|
|
2023-07-22 22:25:27 +02:00
|
|
|
adjustment = gtk_adjustment_new (rank[i], 1, 100, 1, 1, 0);
|
|
|
|
if (i == 0)
|
|
|
|
g_object_set_data (G_OBJECT (dialog), "rank0", adjustment);
|
|
|
|
|
2019-03-09 07:25:19 -05:00
|
|
|
spinbutton = gimp_spin_button_new (adjustment, 1.0, 0);
|
2014-06-22 23:01:31 +02:00
|
|
|
gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbutton), TRUE);
|
2023-07-22 22:25:27 +02:00
|
|
|
gtk_grid_attach (GTK_GRID (dimgrid), spinbutton, 1, i, 1, 1);
|
2004-08-21 10:38:38 +00:00
|
|
|
|
1999-08-24 05:30:14 +00:00
|
|
|
gtk_widget_show (spinbutton);
|
2001-12-29 13:26:29 +00:00
|
|
|
|
2023-07-22 22:25:27 +02:00
|
|
|
if (i >= dimension)
|
2004-08-21 10:38:38 +00:00
|
|
|
gtk_widget_set_sensitive (spinbutton, FALSE);
|
|
|
|
|
2005-06-30 16:03:24 +00:00
|
|
|
g_signal_connect (adjustment, "value-changed",
|
2001-12-29 13:26:29 +00:00
|
|
|
G_CALLBACK (gimp_int_adjustment_update),
|
2023-07-22 22:25:27 +02:00
|
|
|
&rank[i]);
|
2001-12-29 13:26:29 +00:00
|
|
|
|
2004-08-21 10:38:38 +00:00
|
|
|
cellw_adjust.rank_entry[i] = cellh_adjust.rank_entry[i] = spinbutton;
|
|
|
|
|
2011-03-17 14:31:39 +01:00
|
|
|
cb = gtk_combo_box_text_new ();
|
Implement the selection of brush based on cursor direction, pressure,
1999-08-28 Tor Lillqvist <tml@iki.fi>
* app/gimpbrushpipe.c: Implement the selection of brush based on
cursor direction, pressure, tilt, or a random value. (Hmm, forgot
velocity, later.) (In addition to just incrementally stepping.)
Read the brush pipe parameters from the gih file's second line.
There is no way to tune the parameters in the GIMP, they must
currently be set when saving the gih file (in the gpb plug-in).
* app/gimpbrushpipe.h
* app/gimpbrushpipeP.h: Move the PipeSelectModes enum to the
"private" header. Add a stride array to GimpBrushPipe to make
indexing easier.
* plug-ins/common/gpb.c: Add selection mode fields to the dialog.
Attach the pipe parameters entered as a parasite, too.
* docs/parasites.txt
* plug-ins/common/psp.c: Use "placement", not "spacing" (which
means another thing).
1999-08-28 01:14:42 +00:00
|
|
|
|
2004-08-21 10:38:38 +00:00
|
|
|
for (j = 0; j < G_N_ELEMENTS (selection_modes); j++)
|
2011-03-17 14:31:39 +01:00
|
|
|
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (cb),
|
|
|
|
selection_modes[j]);
|
2004-08-21 10:38:38 +00:00
|
|
|
gtk_combo_box_set_active (GTK_COMBO_BOX (cb), 2); /* random */
|
2001-12-29 13:26:29 +00:00
|
|
|
|
2023-07-22 22:25:27 +02:00
|
|
|
for (j = 0; j < G_N_ELEMENTS (selection_modes); j++)
|
|
|
|
if (!strcmp (selection[i], selection_modes[j]))
|
|
|
|
{
|
|
|
|
gtk_combo_box_set_active (GTK_COMBO_BOX (cb), j);
|
|
|
|
break;
|
|
|
|
}
|
2004-08-21 10:38:38 +00:00
|
|
|
|
2023-07-22 22:25:27 +02:00
|
|
|
gtk_grid_attach (GTK_GRID (dimgrid), cb, 2, i, 1, 1);
|
Implement the selection of brush based on cursor direction, pressure,
1999-08-28 Tor Lillqvist <tml@iki.fi>
* app/gimpbrushpipe.c: Implement the selection of brush based on
cursor direction, pressure, tilt, or a random value. (Hmm, forgot
velocity, later.) (In addition to just incrementally stepping.)
Read the brush pipe parameters from the gih file's second line.
There is no way to tune the parameters in the GIMP, they must
currently be set when saving the gih file (in the gpb plug-in).
* app/gimpbrushpipe.h
* app/gimpbrushpipeP.h: Move the PipeSelectModes enum to the
"private" header. Add a stride array to GimpBrushPipe to make
indexing easier.
* plug-ins/common/gpb.c: Add selection mode fields to the dialog.
Attach the pipe parameters entered as a parasite, too.
* docs/parasites.txt
* plug-ins/common/psp.c: Use "placement", not "spacing" (which
means another thing).
1999-08-28 01:14:42 +00:00
|
|
|
|
|
|
|
gtk_widget_show (cb);
|
2001-12-29 13:26:29 +00:00
|
|
|
|
2023-07-22 22:25:27 +02:00
|
|
|
if (i >= dimension)
|
2004-08-21 10:38:38 +00:00
|
|
|
gtk_widget_set_sensitive (cb, FALSE);
|
|
|
|
|
|
|
|
g_signal_connect (GTK_COMBO_BOX (cb), "changed",
|
2023-07-22 22:25:27 +02:00
|
|
|
G_CALLBACK (gih_selection_mode_changed),
|
|
|
|
&selection[i]);
|
2004-08-21 10:38:38 +00:00
|
|
|
|
|
|
|
cellw_adjust.mode_entry[i] = cellh_adjust.mode_entry[i] = cb;
|
1999-08-24 05:30:14 +00:00
|
|
|
}
|
2001-12-29 13:26:29 +00:00
|
|
|
|
2023-07-22 22:25:27 +02:00
|
|
|
gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))),
|
|
|
|
dimgrid, TRUE, TRUE, 0);
|
|
|
|
gtk_widget_show (dimgrid);
|
1999-08-24 05:30:14 +00:00
|
|
|
|
2023-07-22 22:25:27 +02:00
|
|
|
run = gimp_procedure_dialog_run (GIMP_PROCEDURE_DIALOG (dialog));
|
1999-09-02 00:01:41 +00:00
|
|
|
|
2023-07-22 22:25:27 +02:00
|
|
|
g_object_get (config, "dimension", &dimension, NULL);
|
|
|
|
rank_bytes = g_bytes_new (rank, sizeof (guint8) * dimension);
|
2003-11-06 15:27:05 +00:00
|
|
|
|
2023-07-22 22:25:27 +02:00
|
|
|
g_object_set (config,
|
|
|
|
"selection-modes", selection,
|
|
|
|
"ranks", rank_bytes,
|
|
|
|
NULL);
|
2000-12-18 19:38:43 +00:00
|
|
|
|
2023-07-22 22:25:27 +02:00
|
|
|
gih_remove_guides (config, image);
|
2005-09-09 18:38:00 +00:00
|
|
|
gtk_widget_destroy (dialog);
|
2003-11-06 15:27:05 +00:00
|
|
|
|
2023-07-22 22:25:27 +02:00
|
|
|
g_strfreev (selection);
|
|
|
|
g_bytes_unref (rank_bytes);
|
2003-11-06 15:27:05 +00:00
|
|
|
|
|
|
|
return run;
|
1999-08-24 05:30:14 +00:00
|
|
|
}
|