mirror of https://github.com/GNOME/gimp.git
Use g_message, not gimp_message. g_message calls gimp_message eventually.
1999-08-22 Tor Lillqvist <tml@iki.fi> * plug-ins/common/psp.c: Use g_message, not gimp_message. g_message calls gimp_message eventually. * plug-ins/common/gpb.c: New plug-in for saving Adrian's gpb files (pixmap brushes) from an RGBA image. Probably just of temporary value. * plug-ins/makefile.{cygwin,msc}: Add it. * plug-ins/common/gbr.c: Use g_message instead of printf. * app/makefile.{cygwin,msc}: Comment out the gcg stuff here, too. Remove frac.o.
This commit is contained in:
parent
1e08aa1ef7
commit
7a56ef950d
16
ChangeLog
16
ChangeLog
|
@ -1,3 +1,19 @@
|
|||
1999-08-22 Tor Lillqvist <tml@iki.fi>
|
||||
|
||||
* plug-ins/common/psp.c: Use g_message, not gimp_message.
|
||||
g_message calls gimp_message eventually.
|
||||
|
||||
* plug-ins/common/gpb.c: New plug-in for saving Adrian's gpb files
|
||||
(pixmap brushes) from an RGBA image. Probably just of temporary
|
||||
value.
|
||||
|
||||
* plug-ins/makefile.{cygwin,msc}: Add it.
|
||||
|
||||
* plug-ins/common/gbr.c: Use g_message instead of printf.
|
||||
|
||||
* app/makefile.{cygwin,msc}: Comment out the gcg stuff here,
|
||||
too. Remove frac.o.
|
||||
|
||||
1999-08-22 Michael Natterer <mitschel@cs.tu-berlin.de>
|
||||
|
||||
* app/color_area.[ch]
|
||||
|
|
|
@ -28,7 +28,7 @@ INTL = ../../intl
|
|||
|
||||
CFLAGS = $(OPTIMIZE) -DREGEX_MALLOC -DHAVE_CONFIG_H -I. -I.. -I$(GLIB) -I$(GMODULE) -I$(GTK)/gdk/win32 -I$(GTK) -I$(INTL)
|
||||
|
||||
GCG = ../tools/gcg/gcg -I. -I../tools/gcg/gh
|
||||
# GCG = ../tools/gcg/gcg -I. -I../tools/gcg/gh
|
||||
|
||||
all : \
|
||||
../config.h \
|
||||
|
@ -121,7 +121,6 @@ gimp_OBJECTS = \
|
|||
floating_sel.o \
|
||||
floating_sel_cmds.o \
|
||||
file_new_dialog.o \
|
||||
frac.o \
|
||||
free_select.o \
|
||||
fuzzy_select.o \
|
||||
gdisplay.o \
|
||||
|
@ -243,10 +242,10 @@ gimp_OBJECTS = \
|
|||
vector2d.o \
|
||||
xcf.o
|
||||
|
||||
.SUFFIXES: .gc
|
||||
# .SUFFIXES: .gc
|
||||
|
||||
.gc.c:
|
||||
$(GCG) -o $@ $<
|
||||
# .gc.c:
|
||||
# $(GCG) -o $@ $<
|
||||
|
||||
gimpres.o : gimp.rc wilber.ico
|
||||
windres gimp.rc gimpres.o
|
||||
|
|
|
@ -35,7 +35,7 @@ INTL = ..\..\intl
|
|||
|
||||
CFLAGS = -DREGEX_MALLOC -DHAVE_CONFIG_H -I. -I.. -I$(GLIB) -I$(GMODULE) -I$(GTK)\gdk\win32 -I$(GTK) -I$(INTL)
|
||||
|
||||
GCG = ..\tools\gcg\gcg -I. -I ..\tools\gcg\gh
|
||||
# GCG = ..\tools\gcg\gcg -I. -I ..\tools\gcg\gh
|
||||
|
||||
all : \
|
||||
..\config.h \
|
||||
|
@ -128,7 +128,6 @@ gimp_OBJECTS = \
|
|||
floating_sel.obj \
|
||||
floating_sel_cmds.obj \
|
||||
file_new_dialog.obj \
|
||||
frac.obj \
|
||||
free_select.obj \
|
||||
fuzzy_select.obj \
|
||||
gdisplay.obj \
|
||||
|
@ -250,10 +249,10 @@ gimp_OBJECTS = \
|
|||
vector2d.obj \
|
||||
xcf.obj
|
||||
|
||||
.SUFFIXES: .gc
|
||||
# .SUFFIXES: .gc
|
||||
|
||||
.gc.c:
|
||||
$(GCG) -o $@ $<
|
||||
# .gc.c:
|
||||
# $(GCG) -o $@ $<
|
||||
|
||||
gimp.res : gimp.rc wilber.ico
|
||||
rc -r -fo gimp.res gimp.rc
|
||||
|
|
|
@ -322,7 +322,7 @@ static gint save_image (char *filename, gint32 image_ID, gint32 drawable_ID) {
|
|||
fd = open(filename, O_CREAT | O_TRUNC | O_WRONLY | _O_BINARY, 0644);
|
||||
|
||||
if (fd == -1) {
|
||||
printf("Unable to open %s\n", filename);
|
||||
g_message("Unable to open %s", filename);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -346,10 +346,6 @@ static gint save_image (char *filename, gint32 image_ID, gint32 drawable_ID) {
|
|||
}
|
||||
|
||||
buffer = g_malloc(drawable->width * drawable->bpp);
|
||||
if (buffer == NULL) {
|
||||
close(fd);
|
||||
return 0;
|
||||
}
|
||||
for (line = 0; line < drawable->height; line++) {
|
||||
gimp_pixel_rgn_get_row(&pixel_rgn, buffer, 0, line, drawable->width);
|
||||
if (write(fd, buffer, drawable->width * drawable->bpp) !=
|
||||
|
|
|
@ -0,0 +1,368 @@
|
|||
/* Plug-in to save .gpb (GIMP Pixmap Brush) files.
|
||||
* This is probably only of temporary interest, the format for
|
||||
* pixmap brushes is likely to change.
|
||||
*
|
||||
* Copyright (C) 1999 Tor Lillqvist
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include <libgimp/gimp.h>
|
||||
|
||||
#include "app/brush_header.h"
|
||||
#include "app/pattern_header.h"
|
||||
|
||||
/* Declare local data types
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
guint spacing;
|
||||
guchar *description;
|
||||
} t_info;
|
||||
|
||||
t_info info = { /* Initialize to this, change if non-interactive later */
|
||||
10,
|
||||
"GIMP Pixmap Brush"
|
||||
};
|
||||
|
||||
static int run_flag = 0;
|
||||
|
||||
/* Declare some local functions.
|
||||
*/
|
||||
static void query (void);
|
||||
static void run (char *name,
|
||||
int nparams,
|
||||
GParam *param,
|
||||
int *nreturn_vals,
|
||||
GParam **return_vals);
|
||||
|
||||
GPlugInInfo PLUG_IN_INFO =
|
||||
{
|
||||
NULL, /* init_proc */
|
||||
NULL, /* quit_proc */
|
||||
query, /* query_proc */
|
||||
run, /* run_proc */
|
||||
};
|
||||
|
||||
MAIN ()
|
||||
|
||||
static void
|
||||
query ()
|
||||
{
|
||||
static GParamDef save_args[] =
|
||||
{
|
||||
{ PARAM_INT32, "run_mode", "Interactive, non-interactive" },
|
||||
{ PARAM_IMAGE, "image", "Input image" },
|
||||
{ PARAM_DRAWABLE, "drawable", "Drawable to save" },
|
||||
{ PARAM_STRING, "filename", "The name of the file to save the image in" },
|
||||
{ PARAM_STRING, "raw_filename", "The name of the file to save the image in" },
|
||||
{ PARAM_INT32, "spacing", "Spacing of the brush" },
|
||||
{ PARAM_STRING, "description", "Short description of the brush" },
|
||||
};
|
||||
static int nsave_args = sizeof (save_args) / sizeof (save_args[0]);
|
||||
|
||||
gimp_install_procedure ("file_gpb_save",
|
||||
"saves a layer in the GIMP pixmap brush format",
|
||||
"The layer must have an alpha channel",
|
||||
"Tor Lillqvist",
|
||||
"Tor Lillqvist",
|
||||
"1999",
|
||||
"<Save>/GPB",
|
||||
"RGBA",
|
||||
PROC_PLUG_IN,
|
||||
nsave_args, 0,
|
||||
save_args, NULL);
|
||||
|
||||
gimp_register_save_handler ("file_gpb_save", "gpb", "");
|
||||
}
|
||||
|
||||
static void
|
||||
entry_callback(GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
if (data == &info.description)
|
||||
info.description = g_strdup (gtk_entry_get_text (GTK_ENTRY (widget)));
|
||||
else if (data == &info.spacing)
|
||||
info.spacing = atoi (gtk_entry_get_text (GTK_ENTRY (widget)));
|
||||
}
|
||||
|
||||
static void
|
||||
close_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
gtk_main_quit();
|
||||
}
|
||||
|
||||
static void
|
||||
ok_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
run_flag = 1;
|
||||
gtk_widget_destroy (GTK_WIDGET (data));
|
||||
}
|
||||
|
||||
static gint
|
||||
save_dialog ()
|
||||
{
|
||||
GtkWidget *dlg;
|
||||
GtkWidget *button;
|
||||
GtkWidget *label;
|
||||
GtkWidget *entry;
|
||||
GtkWidget *table;
|
||||
gchar **argv;
|
||||
gint argc;
|
||||
gchar buffer[12];
|
||||
|
||||
argc = 1;
|
||||
argv = g_new(gchar *, 1);
|
||||
argv[0] = g_strdup("gpb_save");
|
||||
|
||||
gtk_init (&argc, &argv);
|
||||
gtk_rc_parse (gimp_gtkrc ());
|
||||
|
||||
dlg = gtk_dialog_new ();
|
||||
gtk_window_set_title (GTK_WINDOW(dlg), "Save As Pixmap Brush");
|
||||
gtk_window_position (GTK_WINDOW(dlg), GTK_WIN_POS_MOUSE);
|
||||
gtk_signal_connect (GTK_OBJECT(dlg), "destroy",
|
||||
(GtkSignalFunc) close_callback, NULL);
|
||||
|
||||
/* Action area */
|
||||
button = gtk_button_new_with_label ("OK");
|
||||
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
|
||||
gtk_signal_connect (GTK_OBJECT(button), "clicked",
|
||||
(GtkSignalFunc) ok_callback, dlg);
|
||||
gtk_box_pack_start (GTK_BOX(GTK_DIALOG(dlg)->action_area), button, TRUE, TRUE, 0);
|
||||
gtk_widget_grab_default (button);
|
||||
gtk_widget_show (button);
|
||||
|
||||
button = gtk_button_new_with_label ("Cancel");
|
||||
GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT);
|
||||
gtk_signal_connect_object (GTK_OBJECT(button), "clicked",
|
||||
(GtkSignalFunc) gtk_widget_destroy,
|
||||
GTK_OBJECT (dlg));
|
||||
gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dlg)->action_area), button, TRUE, TRUE, 0);
|
||||
gtk_widget_show(button);
|
||||
|
||||
/* The main table */
|
||||
table = gtk_table_new (2, 2, FALSE);
|
||||
gtk_container_border_width (GTK_CONTAINER (table), 10);
|
||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dlg)->vbox), table, TRUE, TRUE, 0);
|
||||
gtk_widget_show (table);
|
||||
|
||||
gtk_table_set_row_spacings (GTK_TABLE (table), 10);
|
||||
gtk_table_set_col_spacings (GTK_TABLE (table), 10);
|
||||
|
||||
label = gtk_label_new ("Spacing:");
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
|
||||
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1, GTK_FILL, GTK_FILL, 0,
|
||||
0);
|
||||
gtk_widget_show (label);
|
||||
|
||||
entry = gtk_entry_new ();
|
||||
gtk_table_attach (GTK_TABLE (table), entry, 1, 2, 0, 1, GTK_EXPAND | GTK_FILL,
|
||||
GTK_EXPAND | GTK_FILL, 0, 0);
|
||||
gtk_widget_set_usize (entry, 200, 0);
|
||||
sprintf (buffer, "%i", info.spacing);
|
||||
gtk_entry_set_text (GTK_ENTRY (entry), buffer);
|
||||
gtk_signal_connect (GTK_OBJECT (entry), "changed",
|
||||
(GtkSignalFunc) entry_callback, &info.spacing);
|
||||
gtk_widget_show (entry);
|
||||
|
||||
label = gtk_label_new ("Description:");
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
|
||||
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 1, 2, GTK_FILL, GTK_FILL, 0,
|
||||
0);
|
||||
gtk_widget_show (label);
|
||||
|
||||
entry = gtk_entry_new ();
|
||||
gtk_table_attach (GTK_TABLE (table), entry, 1, 2, 1, 2, GTK_EXPAND | GTK_FILL,
|
||||
GTK_EXPAND | GTK_FILL, 0, 0);
|
||||
gtk_widget_set_usize (entry, 200, 0);
|
||||
gtk_entry_set_text (GTK_ENTRY (entry), info.description);
|
||||
gtk_signal_connect (GTK_OBJECT (entry), "changed",
|
||||
(GtkSignalFunc) entry_callback, &info.description);
|
||||
gtk_widget_show (entry);
|
||||
|
||||
gtk_widget_show (dlg);
|
||||
|
||||
gtk_main ();
|
||||
gdk_flush ();
|
||||
|
||||
return run_flag;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
try_fwrite (gpointer buffer,
|
||||
guint size,
|
||||
guint nitems,
|
||||
FILE *file)
|
||||
{
|
||||
if (fwrite (buffer, size, nitems, file) < nitems)
|
||||
{
|
||||
g_message ("GPB: write error");
|
||||
fclose (file);
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
save_image (char *filename,
|
||||
gint32 image_ID,
|
||||
gint32 drawable_ID)
|
||||
{
|
||||
BrushHeader brushheader;
|
||||
PatternHeader patternheader;
|
||||
GPixelRgn pixel_rgn;
|
||||
GDrawable *drawable;
|
||||
FILE *file;
|
||||
gint y, x;
|
||||
guchar *buffer;
|
||||
gchar *temp;
|
||||
|
||||
g_assert (gimp_drawable_has_alpha (drawable_ID));
|
||||
|
||||
drawable = gimp_drawable_get (drawable_ID);
|
||||
gimp_tile_cache_size (gimp_tile_height () * drawable->width * 4);
|
||||
|
||||
gimp_pixel_rgn_init (&pixel_rgn, drawable, 0, 0, drawable->width, drawable->height, FALSE, FALSE);
|
||||
|
||||
temp = g_strdup_printf ("Saving %s:", filename);
|
||||
gimp_progress_init (temp);
|
||||
g_free (temp);
|
||||
|
||||
file = fopen (filename, "wb");
|
||||
|
||||
if (file == NULL)
|
||||
{
|
||||
g_message ("GPB: can't open \"%s\"", filename);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
brushheader.header_size = g_htonl (sizeof (brushheader) + strlen (info.description));
|
||||
brushheader.version = g_htonl (2);
|
||||
brushheader.width = g_htonl (drawable->width);
|
||||
brushheader.height = g_htonl (drawable->height);
|
||||
brushheader.bytes = g_htonl (1);
|
||||
brushheader.magic_number = g_htonl (GBRUSH_MAGIC);
|
||||
brushheader.spacing = g_htonl (info.spacing);
|
||||
|
||||
if (!try_fwrite (&brushheader, sizeof (brushheader), 1, file))
|
||||
return FALSE;
|
||||
if (!try_fwrite (info.description, strlen (info.description), 1, file))
|
||||
return FALSE;
|
||||
|
||||
buffer = g_malloc (drawable->width * drawable->bpp);
|
||||
for (y = 0; y < drawable->height; y++)
|
||||
{
|
||||
gimp_pixel_rgn_get_row (&pixel_rgn, buffer, 0, y, drawable->width);
|
||||
for (x = 0; x < drawable->width; x++)
|
||||
if (!try_fwrite (buffer + x*4 + 3, 1, 1, file))
|
||||
return FALSE;
|
||||
gimp_progress_update (0.5 * y / drawable->height);
|
||||
}
|
||||
g_free (buffer);
|
||||
|
||||
gimp_progress_update (0.5);
|
||||
|
||||
patternheader.header_size = g_htonl (sizeof (patternheader) + strlen ("foo"));
|
||||
patternheader.version = g_htonl (1);
|
||||
patternheader.width = g_htonl (drawable->width);
|
||||
patternheader.height = g_htonl (drawable->height);
|
||||
patternheader.bytes = g_htonl (3);
|
||||
patternheader.magic_number = g_htonl (GPATTERN_MAGIC);
|
||||
|
||||
if (!try_fwrite (&patternheader, sizeof (patternheader), 1, file))
|
||||
return FALSE;
|
||||
if (!try_fwrite ("foo", strlen ("foo"), 1, file))
|
||||
return FALSE;
|
||||
|
||||
buffer = g_malloc (drawable->width * drawable->bpp);
|
||||
|
||||
for (y = 0; y < drawable->height; y++)
|
||||
{
|
||||
gimp_pixel_rgn_get_row (&pixel_rgn, buffer, 0, y, drawable->width);
|
||||
for (x = 0; x < drawable->width; x++)
|
||||
if (!try_fwrite (buffer + x*4, 3, 1, file))
|
||||
return FALSE;
|
||||
gimp_progress_update (0.5 + 0.5 * y / drawable->height);
|
||||
}
|
||||
g_free (buffer);
|
||||
|
||||
gimp_progress_update (1.0);
|
||||
|
||||
fclose (file);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
run (char *name,
|
||||
int nparams,
|
||||
GParam *param,
|
||||
int *nreturn_vals,
|
||||
GParam **return_vals)
|
||||
{
|
||||
static GParam values[1];
|
||||
GRunModeType run_mode;
|
||||
GStatusType status = STATUS_SUCCESS;
|
||||
gint32 image_ID;
|
||||
|
||||
run_mode = param[0].data.d_int32;
|
||||
|
||||
*return_vals = values;
|
||||
*nreturn_vals = 1;
|
||||
values[0].type = PARAM_STATUS;
|
||||
values[0].data.d_status = STATUS_CALLING_ERROR;
|
||||
|
||||
if (strcmp (name, "file_gpb_save") == 0)
|
||||
{
|
||||
switch (run_mode) {
|
||||
case RUN_INTERACTIVE:
|
||||
/* Possibly retrieve data */
|
||||
gimp_get_data ("file_gpb_save", &info);
|
||||
if (!save_dialog ())
|
||||
return;
|
||||
break;
|
||||
|
||||
case RUN_NONINTERACTIVE: /* FIXME - need a real RUN_NONINTERACTIVE */
|
||||
if (nparams != 7)
|
||||
status = STATUS_CALLING_ERROR;
|
||||
if (status == STATUS_SUCCESS)
|
||||
{
|
||||
info.spacing = param[5].data.d_int32;
|
||||
info.description = g_strdup (param[6].data.d_string);
|
||||
}
|
||||
break;
|
||||
|
||||
case RUN_WITH_LAST_VALS:
|
||||
gimp_get_data ("file_gpb_save", &info);
|
||||
break;
|
||||
}
|
||||
|
||||
if (save_image (param[3].data.d_string, param[1].data.d_int32, param[2].data.d_int32))
|
||||
status = STATUS_SUCCESS;
|
||||
else
|
||||
status = STATUS_EXECUTION_ERROR;
|
||||
}
|
||||
values[0].data.d_status = status;
|
||||
}
|
|
@ -51,13 +51,6 @@
|
|||
#include <libgimp/gimp.h>
|
||||
#include <libgimp/stdplugins-intl.h>
|
||||
|
||||
#define gimp_message_printf(x) \
|
||||
G_STMT_START { \
|
||||
gchar *_t = g_strdup_printf x; \
|
||||
gimp_message (_t); \
|
||||
g_free (_t); \
|
||||
} G_STMT_END
|
||||
|
||||
/* Note that the upcoming PSP version 6 writes PSP file format version
|
||||
* 4.0, but the documentation for that apparently isn't publicly
|
||||
* available (yet). The format is luckily designed to be somwehat
|
||||
|
@ -581,19 +574,19 @@ read_block_header (FILE *f,
|
|||
|| fread (&len, 4, 1, f) < 1
|
||||
|| (major < 4 && fread (total_len, 4, 1, f) < 1))
|
||||
{
|
||||
gimp_message ("PSP: Error reading block header");
|
||||
g_message ("PSP: Error reading block header");
|
||||
fclose (f);
|
||||
return -1;
|
||||
}
|
||||
if (memcmp (buf, "~BK\0", 4) != 0)
|
||||
{
|
||||
gimp_message_printf (("PSP: Invalid block header at %d", header_start));
|
||||
g_message ("PSP: Invalid block header at %d", header_start);
|
||||
fclose (f);
|
||||
return -1;
|
||||
}
|
||||
|
||||
IFDBG(3) gimp_message_printf (("PSP: %s at %d", block_name (id),
|
||||
header_start));
|
||||
IFDBG(3) g_message ("PSP: %s at %d", block_name (id),
|
||||
header_start);
|
||||
|
||||
if (major < 4)
|
||||
{
|
||||
|
@ -627,7 +620,7 @@ read_general_image_attribute_block (FILE *f,
|
|||
|
||||
if (init_len < 38 || total_len < 38)
|
||||
{
|
||||
gimp_message ("PSP: Invalid general image attribute chunk size");
|
||||
g_message ("PSP: Invalid general image attribute chunk size");
|
||||
fclose (f);
|
||||
return -1;
|
||||
}
|
||||
|
@ -647,7 +640,7 @@ read_general_image_attribute_block (FILE *f,
|
|||
|| fread (&ia->active_layer, 4, 1, f) < 1
|
||||
|| fread (&ia->layer_count, 2, 1, f) < 1)
|
||||
{
|
||||
gimp_message ("PSP: Error reading general image attribute block");
|
||||
g_message ("PSP: Error reading general image attribute block");
|
||||
fclose (f);
|
||||
return -1;
|
||||
}
|
||||
|
@ -683,8 +676,7 @@ read_general_image_attribute_block (FILE *f,
|
|||
ia->compression = GUINT16_FROM_LE (ia->compression);
|
||||
if (ia->compression > PSP_COMP_LZ77)
|
||||
{
|
||||
gimp_message_printf (("PSP: Unknown compression type %d",
|
||||
ia->compression));
|
||||
g_message ("PSP: Unknown compression type %d", ia->compression);
|
||||
fclose (f);
|
||||
return -1;
|
||||
}
|
||||
|
@ -692,7 +684,7 @@ read_general_image_attribute_block (FILE *f,
|
|||
ia->depth = GUINT16_FROM_LE (ia->depth);
|
||||
if (ia->depth != 24)
|
||||
{
|
||||
gimp_message_printf (("PSP: Unsupported bit depth %d", ia->depth));
|
||||
g_message ("PSP: Unsupported bit depth %d", ia->depth);
|
||||
fclose (f);
|
||||
return -1;
|
||||
}
|
||||
|
@ -708,7 +700,7 @@ try_fseek (FILE *f, long pos, int whence)
|
|||
{
|
||||
if (fseek (f, pos, whence) < 0)
|
||||
{
|
||||
gimp_message ("PSP: Seek error");
|
||||
g_message ("PSP: Seek error");
|
||||
fclose (f);
|
||||
return -1;
|
||||
}
|
||||
|
@ -741,14 +733,14 @@ read_creator_block (FILE *f,
|
|||
|| fread (&keyword, 2, 1, f) < 1
|
||||
|| fread (&length, 4, 1, f) < 1)
|
||||
{
|
||||
gimp_message ("PSP: Error reading creator keyword chunk");
|
||||
g_message ("PSP: Error reading creator keyword chunk");
|
||||
fclose (f);
|
||||
gimp_image_delete (image_ID);
|
||||
return -1;
|
||||
}
|
||||
if (memcmp (buf, "~FL\0", 4) != 0)
|
||||
{
|
||||
gimp_message ("PSP: Invalid keyword chunk header");
|
||||
g_message ("PSP: Invalid keyword chunk header");
|
||||
fclose (f);
|
||||
gimp_image_delete (image_ID);
|
||||
return -1;
|
||||
|
@ -764,7 +756,7 @@ read_creator_block (FILE *f,
|
|||
string = g_malloc (length + 1);
|
||||
if (fread (string, length, 1, f) < 1)
|
||||
{
|
||||
gimp_message ("PSP: Error reading creator keyword data");
|
||||
g_message ("PSP: Error reading creator keyword data");
|
||||
fclose (f);
|
||||
gimp_image_delete (image_ID);
|
||||
return -1;
|
||||
|
@ -789,7 +781,7 @@ read_creator_block (FILE *f,
|
|||
case PSP_CRTR_FLD_APP_VER:
|
||||
if (fread (&dword, 4, 1, f) < 1)
|
||||
{
|
||||
gimp_message ("PSP: Error reading creator keyword data");
|
||||
g_message ("PSP: Error reading creator keyword data");
|
||||
fclose (f);
|
||||
gimp_image_delete (image_ID);
|
||||
return -1;
|
||||
|
@ -1086,7 +1078,7 @@ read_channel_data (FILE *f,
|
|||
zstream.opaque = f;
|
||||
if (inflateInit (&zstream) != Z_OK)
|
||||
{
|
||||
gimp_message ("PSP: zlib error");
|
||||
g_message ("PSP: zlib error");
|
||||
fclose (f);
|
||||
return -1;
|
||||
}
|
||||
|
@ -1100,7 +1092,7 @@ read_channel_data (FILE *f,
|
|||
zstream.avail_out = npixels;
|
||||
if (inflate (&zstream, Z_FINISH) != Z_STREAM_END)
|
||||
{
|
||||
gimp_message ("PSP: zlib error");
|
||||
g_message ("PSP: zlib error");
|
||||
inflateEnd (&zstream);
|
||||
fclose (f);
|
||||
return -1;
|
||||
|
@ -1164,9 +1156,8 @@ read_layer_block (FILE *f,
|
|||
}
|
||||
if (sub_id != PSP_LAYER_BLOCK)
|
||||
{
|
||||
gimp_message_printf (("PSP: Invalid layer sub-block %s, "
|
||||
"should be LAYER",
|
||||
block_name (sub_id)));
|
||||
g_message ("PSP: Invalid layer sub-block %s, should be LAYER",
|
||||
block_name (sub_id));
|
||||
fclose (f);
|
||||
gimp_image_delete (image_ID);
|
||||
return -1;
|
||||
|
@ -1198,7 +1189,7 @@ read_layer_block (FILE *f,
|
|||
|| fread (&bitmap_count, 2, 1, f) < 1
|
||||
|| fread (&channel_count, 2, 1, f) < 1)
|
||||
{
|
||||
gimp_message ("PSP: Error reading layer information chunk");
|
||||
g_message ("PSP: Error reading layer information chunk");
|
||||
fclose (f);
|
||||
gimp_image_delete (image_ID);
|
||||
return -1;
|
||||
|
@ -1227,7 +1218,7 @@ read_layer_block (FILE *f,
|
|||
|| fread (&bitmap_count, 2, 1, f) < 1
|
||||
|| fread (&channel_count, 2, 1, f) < 1)
|
||||
{
|
||||
gimp_message ("PSP: Error reading layer information chunk");
|
||||
g_message ("PSP: Error reading layer information chunk");
|
||||
g_free (name);
|
||||
fclose (f);
|
||||
gimp_image_delete (image_ID);
|
||||
|
@ -1236,7 +1227,7 @@ read_layer_block (FILE *f,
|
|||
}
|
||||
|
||||
if (type == PSP_LAYER_FLOATING_SELECTION)
|
||||
gimp_message ("PSP: Floating selection restored as normal layer");
|
||||
g_message ("PSP: Floating selection restored as normal layer");
|
||||
|
||||
swab_rect (image_rect);
|
||||
swab_rect (saved_image_rect);
|
||||
|
@ -1248,9 +1239,9 @@ read_layer_block (FILE *f,
|
|||
layer_mode = gimp_layer_mode_from_psp_blend_mode (blend_mode);
|
||||
if ((int) layer_mode == -1)
|
||||
{
|
||||
gimp_message_printf (("PSP: Unsupported PSP layer blend mode %s "
|
||||
"for layer %s, setting layer invisible",
|
||||
blend_mode_name (blend_mode), name));
|
||||
g_message ("PSP: Unsupported PSP layer blend mode %s "
|
||||
"for layer %s, setting layer invisible",
|
||||
blend_mode_name (blend_mode), name);
|
||||
layer_mode = NORMAL_MODE;
|
||||
visibility = FALSE;
|
||||
}
|
||||
|
@ -1258,23 +1249,23 @@ read_layer_block (FILE *f,
|
|||
width = saved_image_rect[2] - saved_image_rect[0];
|
||||
height = saved_image_rect[3] - saved_image_rect[1];
|
||||
|
||||
IFDBG(2) gimp_message_printf
|
||||
(("PSP: layer: %s %dx%d (%dx%d) @%d,%d opacity %d blend_mode %s "
|
||||
"%d bitmaps %d channels",
|
||||
name,
|
||||
image_rect[2] - image_rect[0], image_rect[3] - image_rect[1],
|
||||
width, height,
|
||||
saved_image_rect[0], saved_image_rect[1],
|
||||
opacity, blend_mode_name (blend_mode),
|
||||
bitmap_count, channel_count));
|
||||
IFDBG(2) g_message
|
||||
("PSP: layer: %s %dx%d (%dx%d) @%d,%d opacity %d blend_mode %s "
|
||||
"%d bitmaps %d channels",
|
||||
name,
|
||||
image_rect[2] - image_rect[0], image_rect[3] - image_rect[1],
|
||||
width, height,
|
||||
saved_image_rect[0], saved_image_rect[1],
|
||||
opacity, blend_mode_name (blend_mode),
|
||||
bitmap_count, channel_count);
|
||||
|
||||
IFDBG(2) gimp_message_printf
|
||||
(("PSP: mask %dx%d (%dx%d) @%d,%d",
|
||||
mask_rect[2] - mask_rect[0],
|
||||
mask_rect[3] - mask_rect[1],
|
||||
saved_mask_rect[2] - saved_mask_rect[0],
|
||||
saved_mask_rect[3] - saved_mask_rect[1],
|
||||
saved_mask_rect[0], saved_mask_rect[1]));
|
||||
IFDBG(2) g_message
|
||||
("PSP: mask %dx%d (%dx%d) @%d,%d",
|
||||
mask_rect[2] - mask_rect[0],
|
||||
mask_rect[3] - mask_rect[1],
|
||||
saved_mask_rect[2] - saved_mask_rect[0],
|
||||
saved_mask_rect[3] - saved_mask_rect[1],
|
||||
saved_mask_rect[0], saved_mask_rect[1]);
|
||||
|
||||
if (width == 0)
|
||||
{
|
||||
|
@ -1305,7 +1296,7 @@ read_layer_block (FILE *f,
|
|||
layer_mode);
|
||||
if (layer_ID == -1)
|
||||
{
|
||||
gimp_message ("PSP: Error creating layer");
|
||||
g_message ("PSP: Error creating layer");
|
||||
fclose (f);
|
||||
gimp_image_delete (image_ID);
|
||||
return -1;
|
||||
|
@ -1360,9 +1351,8 @@ read_layer_block (FILE *f,
|
|||
|
||||
if (sub_id != PSP_CHANNEL_BLOCK)
|
||||
{
|
||||
gimp_message_printf (("PSP: Invalid layer sub-block %s, "
|
||||
"should be CHANNEL",
|
||||
block_name (sub_id)));
|
||||
g_message ("PSP: Invalid layer sub-block %s, should be CHANNEL",
|
||||
block_name (sub_id));
|
||||
fclose (f);
|
||||
gimp_image_delete (image_ID);
|
||||
return -1;
|
||||
|
@ -1378,7 +1368,7 @@ read_layer_block (FILE *f,
|
|||
|| fread (&bitmap_type, 2, 1, f) < 1
|
||||
|| fread (&channel_type, 2, 1, f) < 1)
|
||||
{
|
||||
gimp_message ("PSP: Error reading channel information chunk");
|
||||
g_message ("PSP: Error reading channel information chunk");
|
||||
fclose (f);
|
||||
gimp_image_delete (image_ID);
|
||||
return -1;
|
||||
|
@ -1391,9 +1381,9 @@ read_layer_block (FILE *f,
|
|||
|
||||
if (bitmap_type > PSP_DIB_USER_MASK)
|
||||
{
|
||||
gimp_message_printf (("PSP: Invalid bitmap type %d "
|
||||
"in channel information chunk",
|
||||
bitmap_type));
|
||||
g_message ("PSP: Invalid bitmap type %d "
|
||||
"in channel information chunk",
|
||||
bitmap_type);
|
||||
fclose (f);
|
||||
gimp_image_delete (image_ID);
|
||||
return -1;
|
||||
|
@ -1401,20 +1391,20 @@ read_layer_block (FILE *f,
|
|||
|
||||
if (channel_type > PSP_CHANNEL_BLUE)
|
||||
{
|
||||
gimp_message_printf (("PSP: Invalid channel type %d "
|
||||
"in channel information chunk",
|
||||
channel_type));
|
||||
g_message ("PSP: Invalid channel type %d "
|
||||
"in channel information chunk",
|
||||
channel_type);
|
||||
fclose (f);
|
||||
gimp_image_delete (image_ID);
|
||||
return -1;
|
||||
}
|
||||
|
||||
IFDBG(2) gimp_message_printf (("PSP: channel: %s %s %d (%d) bytes "
|
||||
"%d bytespp",
|
||||
bitmap_type_name (bitmap_type),
|
||||
channel_type_name (channel_type),
|
||||
uncompressed_len, compressed_len,
|
||||
bytespp));
|
||||
IFDBG(2) g_message ("PSP: channel: %s %s %d (%d) bytes "
|
||||
"%d bytespp",
|
||||
bitmap_type_name (bitmap_type),
|
||||
channel_type_name (channel_type),
|
||||
uncompressed_len, compressed_len,
|
||||
bytespp);
|
||||
|
||||
if (bitmap_type == PSP_DIB_TRANS_MASK)
|
||||
offset = 3;
|
||||
|
@ -1483,7 +1473,7 @@ read_tube_block (FILE *f,
|
|||
|| fread (&placement_mode, 4, 1, f) < 1
|
||||
|| fread (&selection_mode, 4, 1, f) < 1)
|
||||
{
|
||||
gimp_message ("PSP: Error reading tube data chunk");
|
||||
g_message ("PSP: Error reading tube data chunk");
|
||||
fclose (f);
|
||||
gimp_image_delete (image_ID);
|
||||
return -1;
|
||||
|
@ -1520,8 +1510,6 @@ read_tube_block (FILE *f,
|
|||
(selection_mode == tsmPressure ? "pressure" :
|
||||
(selection_mode == tsmVelocity ? "velocity" :
|
||||
"default"))))));
|
||||
gimp_message (parasite_text);
|
||||
|
||||
hose_parasite = parasite_new("gimp-image-hose-parameters", PARASITE_PERSISTENT,
|
||||
strlen (parasite_text) + 1, parasite_text);
|
||||
gimp_image_attach_parasite(image_ID, hose_parasite);
|
||||
|
@ -1573,13 +1561,13 @@ load_image (char *filename)
|
|||
|| fread (&major, 2, 1, f) < 1
|
||||
|| fread (&minor, 2, 1, f) < 1)
|
||||
{
|
||||
gimp_message ("PSP: Error reading file header");
|
||||
g_message ("PSP: Error reading file header");
|
||||
fclose (f);
|
||||
return -1;
|
||||
}
|
||||
if (memcmp (buf, "Paint Shop Pro Image File\n\032\0\0\0\0\0", 32) != 0)
|
||||
{
|
||||
gimp_message ("PSP: Incorrect file signature");
|
||||
g_message ("PSP: Incorrect file signature");
|
||||
fclose (f);
|
||||
return -1;
|
||||
}
|
||||
|
@ -1593,23 +1581,23 @@ load_image (char *filename)
|
|||
*/
|
||||
if (major < 3)
|
||||
{
|
||||
gimp_message_printf (("PSP: Unsupported PSP file format version "
|
||||
"%d.%d, only knows 3.0 (and later?)",
|
||||
major, minor));
|
||||
g_message ("PSP: Unsupported PSP file format version "
|
||||
"%d.%d, only knows 3.0 (and later?)",
|
||||
major, minor);
|
||||
fclose (f);
|
||||
return -1;
|
||||
}
|
||||
else if (major == 3)
|
||||
; /* OK */
|
||||
else if (major == 4 && minor == 0)
|
||||
gimp_message ("PSP: Warning: PSP file format version "
|
||||
"4.0. Support for this format version "
|
||||
"is based on reverse engineering, "
|
||||
"as no documentation has been made available");
|
||||
g_message ("PSP: Warning: PSP file format version "
|
||||
"4.0. Support for this format version "
|
||||
"is based on reverse engineering, "
|
||||
"as no documentation has been made available");
|
||||
else
|
||||
{
|
||||
gimp_message_printf (("PSP: Unsupported PSP file format version %d.%d",
|
||||
major, minor));
|
||||
g_message ("PSP: Unsupported PSP file format version %d.%d",
|
||||
major, minor);
|
||||
fclose (f);
|
||||
return -1;
|
||||
}
|
||||
|
@ -1617,7 +1605,7 @@ load_image (char *filename)
|
|||
/* Read all the blocks */
|
||||
block_number = 0;
|
||||
|
||||
IFDBG(3) gimp_message_printf (("PSP: size = %d", st.st_size));
|
||||
IFDBG(3) g_message ("PSP: size = %d", st.st_size);
|
||||
while (ftell (f) != st.st_size
|
||||
&& (id = read_block_header (f, &block_init_len,
|
||||
&block_total_len)) != -1)
|
||||
|
@ -1628,7 +1616,7 @@ load_image (char *filename)
|
|||
{
|
||||
if (block_number != 0)
|
||||
{
|
||||
gimp_message ("PSP: Duplicate General Image Attributes block");
|
||||
g_message ("PSP: Duplicate General Image Attributes block");
|
||||
fclose (f);
|
||||
return -1;
|
||||
}
|
||||
|
@ -1636,10 +1624,10 @@ load_image (char *filename)
|
|||
block_total_len, &ia) == -1)
|
||||
return -1;
|
||||
|
||||
IFDBG(2) gimp_message_printf (("PSP: %d dpi %dx%d %s",
|
||||
(int) ia.resolution,
|
||||
ia.width, ia.height,
|
||||
compression_name (ia.compression)));
|
||||
IFDBG(2) g_message ("PSP: %d dpi %dx%d %s",
|
||||
(int) ia.resolution,
|
||||
ia.width, ia.height,
|
||||
compression_name (ia.compression));
|
||||
|
||||
image_ID = gimp_image_new (ia.width, ia.height,
|
||||
ia.greyscale ? GRAY : RGB);
|
||||
|
@ -1654,7 +1642,7 @@ load_image (char *filename)
|
|||
{
|
||||
if (block_number == 0)
|
||||
{
|
||||
gimp_message ("PSP: Missing General Image Attributes block");
|
||||
g_message ("PSP: Missing General Image Attributes block");
|
||||
fclose (f);
|
||||
gimp_image_delete (image_ID);
|
||||
return -1;
|
||||
|
@ -1694,13 +1682,13 @@ load_image (char *filename)
|
|||
case PSP_LAYER_BLOCK:
|
||||
case PSP_CHANNEL_BLOCK:
|
||||
case PSP_ALPHA_CHANNEL_BLOCK:
|
||||
gimp_message_printf (("PSP: Sub-block %s should not occur "
|
||||
"at main level of file",
|
||||
block_name (id)));
|
||||
g_message ("PSP: Sub-block %s should not occur "
|
||||
"at main level of file",
|
||||
block_name (id));
|
||||
break;
|
||||
|
||||
default:
|
||||
gimp_message_printf (("PSP: Unrecognized block id %d", id));
|
||||
g_message ("PSP: Unrecognized block id %d", id);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1733,7 +1721,7 @@ save_image (char *filename,
|
|||
gint32 image_ID,
|
||||
gint32 drawable_ID)
|
||||
{
|
||||
gimp_message ("PSP: Saving not implemented yet");
|
||||
g_message ("PSP: Saving not implemented yet");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ FROMPLUGINSDIR=YES # Used to bypass other parts below
|
|||
# The COMMON* ones are in the common subdirectory
|
||||
COMMON1 = CEL CML_explorer align_layers animationplay animoptimize apply_lens autocrop autostretch_hsv blinds blur bumpmap c_astretch checkerboard colorify compose convmatrix csource cubism curve_bend
|
||||
COMMON2 = decompose deinterlace depthmerge despeckle destripe diffraction displace edge emboss engrave exchange film flarefx fractaltrace
|
||||
COMMON3 = gauss_iir gauss_rle gbr gee gicon gif gifload glasstile gqbist gradmap grid gtm guillotine gz header hot hrz illusion iwarp jigsaw jpeg laplace lic
|
||||
COMMON3 = gauss_iir gauss_rle gbr gee gicon gif gifload glasstile gpb gqbist gradmap grid gtm guillotine gz header hot hrz illusion iwarp jigsaw jpeg laplace lic
|
||||
COMMON4 = mapcolor max_rgb mblur newsprint nlfilt noisify normalize nova oilify palette papertile pat pcx pix pixelize plasma plugindetails png pnm polar ps psd psp randomize ripple rotate rotators
|
||||
COMMON5 = sample_colorize scatter_hsv semiflatten sharpen shift smooth_palette snoise sobel sparkle spread sunras tga threshold_alpha tiff tile tileit tiler video vinvert vpropagate waves whirlpinch winclipboard wind winprint wmf xbm xwd zealouscrop
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ FROMPLUGINSDIR=YES # Used to bypass other parts below
|
|||
# The COMMON* ones are in the common subdirectory
|
||||
COMMON1 = CEL CML_explorer align_layers animationplay animoptimize apply_lens autocrop autostretch_hsv blinds blur bumpmap c_astretch checkerboard colorify compose convmatrix csource cubism curve_bend
|
||||
COMMON2 = decompose deinterlace depthmerge despeckle destripe diffraction displace edge emboss engrave exchange film flarefx fractaltrace
|
||||
COMMON3 = gauss_iir gauss_rle gbr gee gicon gif gifload glasstile gqbist gradmap grid gtm guillotine gz header hot hrz illusion iwarp jigsaw jpeg laplace lic
|
||||
COMMON3 = gauss_iir gauss_rle gbr gee gicon gif gifload glasstile gpb gqbist gradmap grid gtm guillotine gz header hot hrz illusion iwarp jigsaw jpeg laplace lic
|
||||
COMMON4 = mapcolor max_rgb mblur newsprint nlfilt noisify normalize nova oilify palette papertile pat pcx pix pixelize plasma plugindetails png pnm polar ps psd randomize ripple rotate rotators
|
||||
COMMON5 = sample_colorize scatter_hsv semiflatten sharpen shift smooth_palette snoise sobel sparkle spread sunras tga threshold_alpha tiff tile tileit tiler video vinvert vpropagate waves whirlpinch winclipboard wind winprint wmf xbm xwd zealouscrop
|
||||
|
||||
|
|
Loading…
Reference in New Issue