Jens Lautenbacher <jtl@gimp.org>

2000-12-18  Sven Neumann  <sven@gimp.org>
	    Jens Lautenbacher <jtl@gimp.org>

	* data/brushes/Makefile.am
	* data/brushes/pepper.gpb: removed
	* data/brushes/pepper.gbr: added (a nicer version of) the Pepper
	brush in the .gbr format that does support pixmap brushes now.

	* plug-ins/common/gbr.c: added support for loading obsoleted
	Gimp Pixmap Brushes format (.gpb).
This commit is contained in:
Sven Neumann 2000-12-18 17:10:45 +00:00 committed by Sven Neumann
parent 1c08fe3d37
commit f4279e0215
5 changed files with 57 additions and 5 deletions

View File

@ -1,6 +1,13 @@
2000-12-18 Michael Natterer <mitch@gimp.org> 2000-12-18 Sven Neumann <sven@gimp.org>
Jens Lautenbacher <jtl@gimp.org>
* po-plug-ins/POTFILES.in: removed gpb.c, added gih.c * data/brushes/Makefile.am
* data/brushes/pepper.gpb: removed
* data/brushes/pepper.gbr: added (a nicer version of) the Pepper
brush in the .gbr format that does support pixmap brushes now.
* plug-ins/common/gbr.c: added support for loading obsoleted
Gimp Pixmap Brushes format (.gpb).
2000-12-18 Sven Neumann <sven@gimp.org> 2000-12-18 Sven Neumann <sven@gimp.org>
Jens Lautenbacher <jtl@gimp.org> Jens Lautenbacher <jtl@gimp.org>

View File

@ -49,7 +49,7 @@ FILES = \
galaxy.gbr \ galaxy.gbr \
galaxy_big.gbr \ galaxy_big.gbr \
galaxy_small.gbr \ galaxy_small.gbr \
pepper.gpb \ pepper.gbr \
pixel.gbr \ pixel.gbr \
thegimp.gbr \ thegimp.gbr \
SketchBrush-16.gih \ SketchBrush-16.gih \

BIN
data/brushes/pepper.gbr Normal file

Binary file not shown.

Binary file not shown.

View File

@ -130,7 +130,7 @@ query (void)
static gint nsave_args = sizeof (save_args) / sizeof (save_args[0]); static gint nsave_args = sizeof (save_args) / sizeof (save_args[0]);
gimp_install_procedure ("file_gbr_load", gimp_install_procedure ("file_gbr_load",
"Loads GIMP brushes (1 or 4 bpp)", "Loads GIMP brushes (1 or 4 bpp and old .gpb format)",
"FIXME: write help", "FIXME: write help",
"Tim Newsome, Jens Lautenbacher, Sven Neumann", "Tim Newsome, Jens Lautenbacher, Sven Neumann",
"Tim Newsome, Jens Lautenbacher, Sven Neumann", "Tim Newsome, Jens Lautenbacher, Sven Neumann",
@ -154,7 +154,7 @@ query (void)
save_args, NULL); save_args, NULL);
gimp_register_magic_load_handler ("file_gbr_load", gimp_register_magic_load_handler ("file_gbr_load",
"gbr", "gbr, gpb",
"", "",
"20, string, GIMP"); "20, string, GIMP");
gimp_register_save_handler ("file_gbr_save", gimp_register_save_handler ("file_gbr_save",
@ -355,6 +355,51 @@ load_image (gchar *filename)
return -1; return -1;
} }
if (bh.bytes == 1)
{
PatternHeader ph;
/* For backwards-compatibility, check if a pattern follows.
The obsolete .gpb format did it this way. */
if (read (fd, &ph, sizeof(ph)) == sizeof(ph))
{
/* rearrange the bytes in each unsigned int */
ph.header_size = g_ntohl (ph.header_size);
ph.version = g_ntohl (ph.version);
ph.width = g_ntohl (ph.width);
ph.height = g_ntohl (ph.height);
ph.bytes = g_ntohl (ph.bytes);
ph.magic_number = g_ntohl (ph.magic_number);
if (ph.magic_number == GPATTERN_MAGIC && ph.version == 1 &&
ph.header_size > sizeof (ph) &&
ph.bytes == 3 && ph.width == bh.width && ph.height == bh.height &&
lseek (fd, ph.header_size - sizeof (ph), SEEK_CUR) > 0)
{
guchar *plain_brush = brush_buf;
gint i;
bh.bytes = 4;
brush_buf = g_malloc (4 * bh.width * bh.height);
for (i = 0; i < ph.width * ph.height; i++)
{
if (read (fd, brush_buf + i * 4, 3) != 3)
{
close (fd);
g_free (plain_brush);
g_free (brush_buf);
return -1;
}
brush_buf[i * 4 + 3] = plain_brush[i];
}
g_free (plain_brush);
}
}
}
/* /*
* Create a new image of the proper size and * Create a new image of the proper size and
* associate the filename with it. * associate the filename with it.