Commit c5c95ff9 authored by GMT 2000  Austin Donnelly's avatar GMT 2000 Austin Donnelly Committed by Austin Donnelly

update my entry. I maintain newsprint.

Sat Jan 22 22:14:18 GMT 2000  Austin Donnelly  <austin@gimp.org>

	* MAINTAINERS: update my entry.
	* PLUGIN_MAINTAINERS: I maintain newsprint.

	* app/fuzzy_select.c: fix so if you move the pointer back to
	   where you started, the selection is also the same.  Can people
	   (tigert?) give this a spin - if it isn't as intuitive as the
	   old way we should roll this back.

	* plug-ins/common/jpeg.c: use volatile to get rid of "clobber"
	   warnings from GCC.  Also, fix handling of multiple COM
	   sections, so can load images such as
	   /usr/share/pixmaps/backgrounds/space/clem_full_moon_strtrk.jpg or
	   /usr/share/pixmaps/backgrounds/space/apollo08_earthrise.jpg
	   which used to segv the jpeg plugin.

	* plug-ins/common/newsprint.c: update my email address.

	* plug-ins/common/ps.c: applied gimp-kirchgessner-000116-0.patch:
	   save using PostScript level 2 features which result in files
	   60% smaller than naive level 1 method.  Peter added a
	   checkbutton to the UI to revert to level 1 algorithm, but we
	   default to level 2.  Almost everyone should have a level 2
	   printer, new printers and ghostscript are level 3 these days.
parent c605469d
Sat Jan 22 22:14:18 GMT 2000 Austin Donnelly <austin@gimp.org>
* MAINTAINERS: update my entry.
* PLUGIN_MAINTAINERS: I maintain newsprint.
* app/fuzzy_select.c: fix so if you move the pointer back to
where you started, the selection is also the same. Can people
(tigert?) give this a spin - if it isn't as intuitive as the
old way we should roll this back.
* plug-ins/common/jpeg.c: use volatile to get rid of "clobber"
warnings from GCC. Also, fix handling of multiple COM
sections, so can load images such as
/usr/share/pixmaps/backgrounds/space/clem_full_moon_strtrk.jpg or
/usr/share/pixmaps/backgrounds/space/apollo08_earthrise.jpg
which used to segv the jpeg plugin.
* plug-ins/common/newsprint.c: update my email address.
* plug-ins/common/ps.c: applied gimp-kirchgessner-000116-0.patch:
save using PostScript level 2 features which result in files
60% smaller than naive level 1 method. Peter added a
checkbutton to the UI to revert to level 1 algorithm, but we
default to level 2. Almost everyone should have a level 2
printer, new printers and ghostscript are level 3 these days.
Sat Jan 22 21:38:08 CET 2000 Sven Neumann <sven@gimp.org> Sat Jan 22 21:38:08 CET 2000 Sven Neumann <sven@gimp.org>
* app/gimpdnd.c: corrected off-by-one error in color dnd * app/gimpdnd.c: corrected off-by-one error in color dnd
......
...@@ -34,7 +34,7 @@ Name: Austin Donnelly ...@@ -34,7 +34,7 @@ Name: Austin Donnelly
Email: austin@gimp.org Email: austin@gimp.org
url: http://www.cl.cam.ac.uk/~and1000/ url: http://www.cl.cam.ac.uk/~and1000/
ircnick: austin ircnick: austin
expertise: resolution stuff, modules, colour selectors, fonts expertise: resolution stuff, modules, colour selectors, fonts, PostScript
current work: random bug fixes, resolution current work: random bug fixes, resolution
commit access: yes commit access: yes
......
...@@ -580,7 +580,7 @@ COMMENT : ...@@ -580,7 +580,7 @@ COMMENT :
----------- -----------
NAME : newsprint NAME : newsprint
AUTHOR : Austin Donnelly AUTHOR : Austin Donnelly
MAINTAINER : MAINTAINER : Austin Donnelly <austin@gimp.org>
SIZE : 64.7 kB in 1 file (only C files counted) SIZE : 64.7 kB in 1 file (only C files counted)
COMMENT : COMMENT :
----------- -----------
......
...@@ -45,8 +45,9 @@ struct _FuzzySelect ...@@ -45,8 +45,9 @@ struct _FuzzySelect
int op; /* selection operation (ADD, SUB, etc) */ int op; /* selection operation (ADD, SUB, etc) */
int x, y; /* Point from which to execute seed fill */ int x, y; /* Point from which to execute seed fill */
int last_x; /* */ int first_x; /* */
int last_y; /* variables to keep track of sensitivity */ int first_y; /* variables to keep track of sensitivity */
double first_threshold; /* initial value of threshold slider */
}; };
...@@ -390,8 +391,9 @@ fuzzy_select_button_press (Tool *tool, ...@@ -390,8 +391,9 @@ fuzzy_select_button_press (Tool *tool,
fuzzy_sel->x = bevent->x; fuzzy_sel->x = bevent->x;
fuzzy_sel->y = bevent->y; fuzzy_sel->y = bevent->y;
fuzzy_sel->last_x = fuzzy_sel->x; fuzzy_sel->first_x = fuzzy_sel->x;
fuzzy_sel->last_y = fuzzy_sel->y; fuzzy_sel->first_y = fuzzy_sel->y;
fuzzy_sel->first_threshold = fuzzy_options->threshold;
gdk_pointer_grab (gdisp->canvas->window, FALSE, gdk_pointer_grab (gdisp->canvas->window, FALSE,
GDK_POINTER_MOTION_HINT_MASK | GDK_POINTER_MOTION_HINT_MASK |
...@@ -465,23 +467,21 @@ fuzzy_select_motion (Tool *tool, ...@@ -465,23 +467,21 @@ fuzzy_select_motion (Tool *tool,
FuzzySelect * fuzzy_sel; FuzzySelect * fuzzy_sel;
GdkSegment * new_segs; GdkSegment * new_segs;
int num_new_segs; int num_new_segs;
int diff, diff_x, diff_y; int diff_x, diff_y;
double diff;
if (tool->state != ACTIVE) if (tool->state != ACTIVE)
return; return;
fuzzy_sel = (FuzzySelect *) tool->private; fuzzy_sel = (FuzzySelect *) tool->private;
diff_x = mevent->x - fuzzy_sel->last_x; diff_x = mevent->x - fuzzy_sel->first_x;
diff_y = mevent->y - fuzzy_sel->last_y; diff_y = mevent->y - fuzzy_sel->first_y;
diff = ((ABS (diff_x) > ABS (diff_y)) ? diff_x : diff_y) / 2; diff = ((ABS (diff_x) > ABS (diff_y)) ? diff_x : diff_y) / 2.0;
fuzzy_sel->last_x = mevent->x;
fuzzy_sel->last_y = mevent->y;
gtk_adjustment_set_value (GTK_ADJUSTMENT (fuzzy_options->threshold_w), gtk_adjustment_set_value (GTK_ADJUSTMENT (fuzzy_options->threshold_w),
fuzzy_options->threshold + diff); fuzzy_sel->first_threshold + diff);
/* calculate the new fuzzy boundary */ /* calculate the new fuzzy boundary */
new_segs = fuzzy_select_calculate (tool, gdisp_ptr, &num_new_segs); new_segs = fuzzy_select_calculate (tool, gdisp_ptr, &num_new_segs);
......
...@@ -45,8 +45,9 @@ struct _FuzzySelect ...@@ -45,8 +45,9 @@ struct _FuzzySelect
int op; /* selection operation (ADD, SUB, etc) */ int op; /* selection operation (ADD, SUB, etc) */
int x, y; /* Point from which to execute seed fill */ int x, y; /* Point from which to execute seed fill */
int last_x; /* */ int first_x; /* */
int last_y; /* variables to keep track of sensitivity */ int first_y; /* variables to keep track of sensitivity */
double first_threshold; /* initial value of threshold slider */
}; };
...@@ -390,8 +391,9 @@ fuzzy_select_button_press (Tool *tool, ...@@ -390,8 +391,9 @@ fuzzy_select_button_press (Tool *tool,
fuzzy_sel->x = bevent->x; fuzzy_sel->x = bevent->x;
fuzzy_sel->y = bevent->y; fuzzy_sel->y = bevent->y;
fuzzy_sel->last_x = fuzzy_sel->x; fuzzy_sel->first_x = fuzzy_sel->x;
fuzzy_sel->last_y = fuzzy_sel->y; fuzzy_sel->first_y = fuzzy_sel->y;
fuzzy_sel->first_threshold = fuzzy_options->threshold;
gdk_pointer_grab (gdisp->canvas->window, FALSE, gdk_pointer_grab (gdisp->canvas->window, FALSE,
GDK_POINTER_MOTION_HINT_MASK | GDK_POINTER_MOTION_HINT_MASK |
...@@ -465,23 +467,21 @@ fuzzy_select_motion (Tool *tool, ...@@ -465,23 +467,21 @@ fuzzy_select_motion (Tool *tool,
FuzzySelect * fuzzy_sel; FuzzySelect * fuzzy_sel;
GdkSegment * new_segs; GdkSegment * new_segs;
int num_new_segs; int num_new_segs;
int diff, diff_x, diff_y; int diff_x, diff_y;
double diff;
if (tool->state != ACTIVE) if (tool->state != ACTIVE)
return; return;
fuzzy_sel = (FuzzySelect *) tool->private; fuzzy_sel = (FuzzySelect *) tool->private;
diff_x = mevent->x - fuzzy_sel->last_x; diff_x = mevent->x - fuzzy_sel->first_x;
diff_y = mevent->y - fuzzy_sel->last_y; diff_y = mevent->y - fuzzy_sel->first_y;
diff = ((ABS (diff_x) > ABS (diff_y)) ? diff_x : diff_y) / 2; diff = ((ABS (diff_x) > ABS (diff_y)) ? diff_x : diff_y) / 2.0;
fuzzy_sel->last_x = mevent->x;
fuzzy_sel->last_y = mevent->y;
gtk_adjustment_set_value (GTK_ADJUSTMENT (fuzzy_options->threshold_w), gtk_adjustment_set_value (GTK_ADJUSTMENT (fuzzy_options->threshold_w),
fuzzy_options->threshold + diff); fuzzy_sel->first_threshold + diff);
/* calculate the new fuzzy boundary */ /* calculate the new fuzzy boundary */
new_segs = fuzzy_select_calculate (tool, gdisp_ptr, &num_new_segs); new_segs = fuzzy_select_calculate (tool, gdisp_ptr, &num_new_segs);
......
...@@ -45,8 +45,9 @@ struct _FuzzySelect ...@@ -45,8 +45,9 @@ struct _FuzzySelect
int op; /* selection operation (ADD, SUB, etc) */ int op; /* selection operation (ADD, SUB, etc) */
int x, y; /* Point from which to execute seed fill */ int x, y; /* Point from which to execute seed fill */
int last_x; /* */ int first_x; /* */
int last_y; /* variables to keep track of sensitivity */ int first_y; /* variables to keep track of sensitivity */
double first_threshold; /* initial value of threshold slider */
}; };
...@@ -390,8 +391,9 @@ fuzzy_select_button_press (Tool *tool, ...@@ -390,8 +391,9 @@ fuzzy_select_button_press (Tool *tool,
fuzzy_sel->x = bevent->x; fuzzy_sel->x = bevent->x;
fuzzy_sel->y = bevent->y; fuzzy_sel->y = bevent->y;
fuzzy_sel->last_x = fuzzy_sel->x; fuzzy_sel->first_x = fuzzy_sel->x;
fuzzy_sel->last_y = fuzzy_sel->y; fuzzy_sel->first_y = fuzzy_sel->y;
fuzzy_sel->first_threshold = fuzzy_options->threshold;
gdk_pointer_grab (gdisp->canvas->window, FALSE, gdk_pointer_grab (gdisp->canvas->window, FALSE,
GDK_POINTER_MOTION_HINT_MASK | GDK_POINTER_MOTION_HINT_MASK |
...@@ -465,23 +467,21 @@ fuzzy_select_motion (Tool *tool, ...@@ -465,23 +467,21 @@ fuzzy_select_motion (Tool *tool,
FuzzySelect * fuzzy_sel; FuzzySelect * fuzzy_sel;
GdkSegment * new_segs; GdkSegment * new_segs;
int num_new_segs; int num_new_segs;
int diff, diff_x, diff_y; int diff_x, diff_y;
double diff;
if (tool->state != ACTIVE) if (tool->state != ACTIVE)
return; return;
fuzzy_sel = (FuzzySelect *) tool->private; fuzzy_sel = (FuzzySelect *) tool->private;
diff_x = mevent->x - fuzzy_sel->last_x; diff_x = mevent->x - fuzzy_sel->first_x;
diff_y = mevent->y - fuzzy_sel->last_y; diff_y = mevent->y - fuzzy_sel->first_y;
diff = ((ABS (diff_x) > ABS (diff_y)) ? diff_x : diff_y) / 2; diff = ((ABS (diff_x) > ABS (diff_y)) ? diff_x : diff_y) / 2.0;
fuzzy_sel->last_x = mevent->x;
fuzzy_sel->last_y = mevent->y;
gtk_adjustment_set_value (GTK_ADJUSTMENT (fuzzy_options->threshold_w), gtk_adjustment_set_value (GTK_ADJUSTMENT (fuzzy_options->threshold_w),
fuzzy_options->threshold + diff); fuzzy_sel->first_threshold + diff);
/* calculate the new fuzzy boundary */ /* calculate the new fuzzy boundary */
new_segs = fuzzy_select_calculate (tool, gdisp_ptr, &num_new_segs); new_segs = fuzzy_select_calculate (tool, gdisp_ptr, &num_new_segs);
......
...@@ -45,8 +45,9 @@ struct _FuzzySelect ...@@ -45,8 +45,9 @@ struct _FuzzySelect
int op; /* selection operation (ADD, SUB, etc) */ int op; /* selection operation (ADD, SUB, etc) */
int x, y; /* Point from which to execute seed fill */ int x, y; /* Point from which to execute seed fill */
int last_x; /* */ int first_x; /* */
int last_y; /* variables to keep track of sensitivity */ int first_y; /* variables to keep track of sensitivity */
double first_threshold; /* initial value of threshold slider */
}; };
...@@ -390,8 +391,9 @@ fuzzy_select_button_press (Tool *tool, ...@@ -390,8 +391,9 @@ fuzzy_select_button_press (Tool *tool,
fuzzy_sel->x = bevent->x; fuzzy_sel->x = bevent->x;
fuzzy_sel->y = bevent->y; fuzzy_sel->y = bevent->y;
fuzzy_sel->last_x = fuzzy_sel->x; fuzzy_sel->first_x = fuzzy_sel->x;
fuzzy_sel->last_y = fuzzy_sel->y; fuzzy_sel->first_y = fuzzy_sel->y;
fuzzy_sel->first_threshold = fuzzy_options->threshold;
gdk_pointer_grab (gdisp->canvas->window, FALSE, gdk_pointer_grab (gdisp->canvas->window, FALSE,
GDK_POINTER_MOTION_HINT_MASK | GDK_POINTER_MOTION_HINT_MASK |
...@@ -465,23 +467,21 @@ fuzzy_select_motion (Tool *tool, ...@@ -465,23 +467,21 @@ fuzzy_select_motion (Tool *tool,
FuzzySelect * fuzzy_sel; FuzzySelect * fuzzy_sel;
GdkSegment * new_segs; GdkSegment * new_segs;
int num_new_segs; int num_new_segs;
int diff, diff_x, diff_y; int diff_x, diff_y;
double diff;
if (tool->state != ACTIVE) if (tool->state != ACTIVE)
return; return;
fuzzy_sel = (FuzzySelect *) tool->private; fuzzy_sel = (FuzzySelect *) tool->private;
diff_x = mevent->x - fuzzy_sel->last_x; diff_x = mevent->x - fuzzy_sel->first_x;
diff_y = mevent->y - fuzzy_sel->last_y; diff_y = mevent->y - fuzzy_sel->first_y;
diff = ((ABS (diff_x) > ABS (diff_y)) ? diff_x : diff_y) / 2; diff = ((ABS (diff_x) > ABS (diff_y)) ? diff_x : diff_y) / 2.0;
fuzzy_sel->last_x = mevent->x;
fuzzy_sel->last_y = mevent->y;
gtk_adjustment_set_value (GTK_ADJUSTMENT (fuzzy_options->threshold_w), gtk_adjustment_set_value (GTK_ADJUSTMENT (fuzzy_options->threshold_w),
fuzzy_options->threshold + diff); fuzzy_sel->first_threshold + diff);
/* calculate the new fuzzy boundary */ /* calculate the new fuzzy boundary */
new_segs = fuzzy_select_calculate (tool, gdisp_ptr, &num_new_segs); new_segs = fuzzy_select_calculate (tool, gdisp_ptr, &num_new_segs);
......
...@@ -103,6 +103,23 @@ ...@@ -103,6 +103,23 @@
* changed. * changed.
*/ */
/*
* 22-DEC-99 - volatiles added
* - Austin Donnelly <austin@gimp.org>
*
* When gcc complains a variable may be clobbered by a longjmp or
* vfork, it means the following: setjmp() was called by the JPEG
* library for error recovery purposes, but gcc is keeping some
* variables in registers without updating the memory locations on the
* stack consistently. If JPEG error recovery is every invoked, the
* values of these variable will be inconsistent. This is almost
* always a bug, but not one that's commonly seen unless JPEG recovery
* code is exercised frequently. The correct solution is to tell gcc
* to keep the stack version of the affected variables up to date, by
* using the "volatile" keyword. Here endeth the lesson.
*/
#include "config.h" /* configure cares about HAVE_PROGRESSIVE_JPEG */ #include "config.h" /* configure cares about HAVE_PROGRESSIVE_JPEG */
#include <glib.h> /* We want glib.h first because of some #include <glib.h> /* We want glib.h first because of some
...@@ -125,6 +142,7 @@ ...@@ -125,6 +142,7 @@
#include "libgimp/stdplugins-intl.h" #include "libgimp/stdplugins-intl.h"
#include <signal.h>
#define SCALE_WIDTH 125 #define SCALE_WIDTH 125
...@@ -368,6 +386,11 @@ run (char *name, ...@@ -368,6 +386,11 @@ run (char *name,
values[0].type = PARAM_STATUS; values[0].type = PARAM_STATUS;
values[0].data.d_status = STATUS_CALLING_ERROR; values[0].data.d_status = STATUS_CALLING_ERROR;
#if 0
printf ("JPEG: Waiting (pid %d)...\n", getpid());
kill (getpid(), SIGSTOP);
#endif
if (strcmp (name, "file_jpeg_load") == 0) if (strcmp (name, "file_jpeg_load") == 0)
{ {
INIT_I18N(); INIT_I18N();
...@@ -699,7 +722,7 @@ load_image (char *filename, ...@@ -699,7 +722,7 @@ load_image (char *filename,
struct my_error_mgr jerr; struct my_error_mgr jerr;
FILE *infile; FILE *infile;
guchar *buf; guchar *buf;
guchar *padded_buf = NULL; guchar * volatile padded_buf = NULL;
guchar **rowbuf; guchar **rowbuf;
char *name; char *name;
int image_type; int image_type;
...@@ -710,8 +733,8 @@ load_image (char *filename, ...@@ -710,8 +733,8 @@ load_image (char *filename,
#ifdef GIMP_HAVE_PARASITES #ifdef GIMP_HAVE_PARASITES
JpegSaveVals local_save_vals; JpegSaveVals local_save_vals;
Parasite *comment_parasite = NULL; Parasite * volatile comment_parasite = NULL;
Parasite *vals_parasite = NULL; Parasite * volatile vals_parasite = NULL;
#endif /* GIMP_HAVE_PARASITES */ #endif /* GIMP_HAVE_PARASITES */
...@@ -775,6 +798,7 @@ load_image (char *filename, ...@@ -775,6 +798,7 @@ load_image (char *filename,
{ {
char *string = local_image_comments->str; char *string = local_image_comments->str;
g_string_free (local_image_comments,FALSE); g_string_free (local_image_comments,FALSE);
local_image_comments = NULL;
comment_parasite = parasite_new ("gimp-comment", PARASITE_PERSISTENT, comment_parasite = parasite_new ("gimp-comment", PARASITE_PERSISTENT,
strlen (string) + 1, string); strlen (string) + 1, string);
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* Copyright (C) 1995 Spencer Kimball and Peter Mattis * Copyright (C) 1995 Spencer Kimball and Peter Mattis
* *
* newsprint plug-in * newsprint plug-in
* Copyright (C) 1997-1998 Austin Donnelly <austin@greenend.org.uk> * Copyright (C) 1997-1998 Austin Donnelly <austin@gimp.org>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
......
...@@ -8,6 +8,9 @@ ...@@ -8,6 +8,9 @@
* Added controls for TextAlphaBits and GraphicsAlphaBits * Added controls for TextAlphaBits and GraphicsAlphaBits
* George White <aa056@chebucto.ns.ca> * George White <aa056@chebucto.ns.ca>
* *
* Added Ascii85 encoding
* Austin Donnelly <austin@gimp.org>
*
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
...@@ -41,10 +44,11 @@ ...@@ -41,10 +44,11 @@
* V 1.06, PK, 22-Dec-98: Fix problem with writing color PS files. * V 1.06, PK, 22-Dec-98: Fix problem with writing color PS files.
* Ghostview may hang when displaying the files. * Ghostview may hang when displaying the files.
* V 1.07, PK, 14-Sep-99: Add resolution to image * V 1.07, PK, 14-Sep-99: Add resolution to image
* V 1.08, PK, 16-Jan-2000: Add PostScript-Level 2 by Austin Donnelly
*/ */
#define VERSIO 1.07 #define VERSIO 1.08
static char dversio[] = "v1.07 14-Sep-99"; static char dversio[] = "v1.08 16-Jan-2000";
static char ident[] = "@(#) GIMP PostScript/PDF file-plugin v1.07 14-Sep-99"; static char ident[] = "@(#) GIMP PostScript/PDF file-plugin v1.08 16-Jan-2000";
#include "config.h" #include "config.h"
...@@ -66,7 +70,7 @@ static char ident[] = "@(#) GIMP PostScript/PDF file-plugin v1.07 14-Sep-99"; ...@@ -66,7 +70,7 @@ static char ident[] = "@(#) GIMP PostScript/PDF file-plugin v1.07 14-Sep-99";
#define USE_REAL_OUTPUTFILE #define USE_REAL_OUTPUTFILE
#endif #endif
#define STR_LENGTH 64 #define STR_LENGTH 64
/* Load info */ /* Load info */
...@@ -111,6 +115,7 @@ typedef struct ...@@ -111,6 +115,7 @@ typedef struct
gint unit_mm; /* Unit of measure (0: inch, 1: mm) */ gint unit_mm; /* Unit of measure (0: inch, 1: mm) */
gint keep_ratio; /* Keep aspect ratio */ gint keep_ratio; /* Keep aspect ratio */
gint rotate; /* Rotation (0, 90, 180, 270) */ gint rotate; /* Rotation (0, 90, 180, 270) */
gint level; /* PostScript Level */
gint eps; /* Encapsulated PostScript flag */ gint eps; /* Encapsulated PostScript flag */
gint preview; /* Preview Flag */ gint preview; /* Preview Flag */
gint preview_size; /* Preview size */ gint preview_size; /* Preview size */
...@@ -128,6 +133,7 @@ static PSSaveVals psvals = ...@@ -128,6 +133,7 @@ static PSSaveVals psvals =
1, /* Unit is mm */ 1, /* Unit is mm */
1, /* Keep edge ratio */ 1, /* Keep edge ratio */
90, /* Rotate */ 90, /* Rotate */
2, /* PostScript Level */
0, /* Encapsulated PostScript flag */ 0, /* Encapsulated PostScript flag */
0, /* Preview flag */ 0, /* Preview flag */
256 /* Preview size */ 256 /* Preview size */
...@@ -238,6 +244,7 @@ typedef struct ...@@ -238,6 +244,7 @@ typedef struct
int keep_ratio; int keep_ratio;
int unit[2]; int unit[2];
int rot[4]; int rot[4];
int level;
int eps; int eps;
int preview; int preview;
int preview_size; int preview_size;
...@@ -265,6 +272,82 @@ GPlugInInfo PLUG_IN_INFO = ...@@ -265,6 +272,82 @@ GPlugInInfo PLUG_IN_INFO =
static GRunModeType l_run_mode; static GRunModeType l_run_mode;
static guint32 ascii85_buf;
static int ascii85_len = 0;
static int ascii85_linewidth = 0;
static void
ascii85_init (void)
{
ascii85_len = 0;
ascii85_linewidth = 0;
}
static void
ascii85_flush (FILE *ofp)
{
char c[5];
int i;
gboolean zero_case = (ascii85_buf == 0);
for (i=4; i >= 0; i--)
{
c[i] = (ascii85_buf % 85) + '!';
ascii85_buf /= 85;
}
/* check for special case: "!!!!!" becomes "z", but only if not
* at end of data. */
if (zero_case && (ascii85_len == 4))
{
putc ('z', ofp);
ascii85_linewidth++;
}
else
{
ascii85_linewidth += ascii85_len+1;
for (i=0; i < ascii85_len+1; i++)
putc (c[i], ofp);
}
if (ascii85_linewidth >= 75)
{
putc ('\n', ofp);
ascii85_linewidth = 0;
}
ascii85_len = 0;
ascii85_buf = 0;
}
static inline void
ascii85_out (unsigned char byte, FILE *ofp)
{
if (ascii85_len == 4)
ascii85_flush (ofp);
ascii85_buf <<= 8;
ascii85_buf |= byte;
ascii85_len++;
}
static void
ascii85_done (FILE *ofp)
{
if (ascii85_len)
{
/* zero any unfilled buffer portion, then flush */
ascii85_buf <<= (8 * (4-ascii85_len));
ascii85_flush (ofp);
}
putc ('~', ofp);
putc ('>', ofp);
putc ('\n', ofp);
}
MAIN () MAIN ()
...@@ -315,7 +398,8 @@ query (void) ...@@ -315,7 +398,8 @@ query (void)
{ PARAM_INT32, "keep_ratio", "0: use width/height, 1: keep aspect ratio" }, { PARAM_INT32, "keep_ratio", "0: use width/height, 1: keep aspect ratio" },
{ PARAM_INT32, "rotation", "0, 90, 180, 270" }, { PARAM_INT32, "rotation", "0, 90, 180, 270" },
{ PARAM_INT32, "eps_flag", "0: PostScript, 1: Encapsulated PostScript" }, { PARAM_INT32, "eps_flag", "0: PostScript, 1: Encapsulated PostScript" },
{ PARAM_INT32, "preview", "0: no preview, >0: max. size of preview" } { PARAM_INT32, "preview", "0: no preview, >0: max. size of preview" },
{ PARAM_INT32, "level", "1: PostScript Level 1, 2: PostScript Level 2" }
}; };
static int nsave_args = sizeof (save_args) / sizeof (save_args[0]); static int nsave_args = sizeof (save_args) / sizeof (save_args[0]);
...@@ -349,7 +433,7 @@ query (void) ...@@ -349,7 +433,7 @@ query (void)
_("save file in PostScript file format"), _("save file in PostScript file format"),
_("PostScript saving handles all image types except \ _("PostScript saving handles all image types except \
those with alpha channels."), those with alpha channels."),
"Peter Kirchgessner <pkirchg@aol.com>", "Peter Kirchgessner <peter@kirchgessner.net>",
"Peter Kirchgessner", "Peter Kirchgessner",
dversio, dversio,
"<Save>/PostScript", "<Save>/PostScript",
...@@ -473,20 +557,20 @@ run (char *name, ...@@ -473,20 +557,20 @@ run (char *name,
image_ID = orig_image_ID = param[1].data.d_int32; image_ID = orig_image_ID = param[1].data.d_int32;
drawable_ID = param[2].data.d_int32; drawable_ID = param[2].data.d_int32;
/* eventually export the image */ /* eventually export the image */
switch (run_mode) switch (run_mode)
{ {
case RUN_INTERACTIVE: case RUN_INTERACTIVE:
case RUN_WITH_LAST_VALS: case RUN_WITH_LAST_VALS:
init_gtk (); init_gtk ();
export = gimp_export_image (&image_ID, &drawable_ID, "PS", export = gimp_export_image (&image_ID, &drawable_ID, "PS",
(CAN_HANDLE_RGB | CAN_HANDLE_GRAY | CAN_HANDLE_INDEXED)); (CAN_HANDLE_RGB | CAN_HANDLE_GRAY | CAN_HANDLE_INDEXED));
if (export == EXPORT_CANCEL) if (export == EXPORT_CANCEL)
{ {
*nreturn_vals = 1;