Added sharpen to stable dist

* Added sharpen to stable dist

* updated sgi and despeckle plugins

* plug-ins/xd/xd.c: works with xdelta 0.18. The use of xdelta versions prior
to this is not-supported.

* plug-in/gfig/gfig.c: spelling corrections :)

* app/fileops.c: applied gimp-gord-980420-0, fixes stale save procs in the
file dialog

* app/text_tool.c: applied gimp-egger-980420-0, text tool optimization

-Yosh
This commit is contained in:
Manish Singh 1998-04-24 02:18:52 +00:00
parent f6839d817a
commit 8137f724ef
20 changed files with 2603 additions and 416 deletions

View File

@ -1,3 +1,20 @@
Thu Apr 23 19:08:16 PDT 1998 Manish Singh <yosh@gimp.org>
* Added sharpen to stable dist
* updated sgi and despeckle plugins
* plug-ins/xd/xd.c: works with xdelta 0.18. The use of xdelta
versions prior to this is not-supported.
* plug-in/gfig/gfig.c: spelling corrections :)
* app/fileops.c: applied gimp-gord-980420-0, fixes stale save
procs in the file dialog
* app/text_tool.c: applied gimp-egger-980420-0, text tool
optimization
Thu Apr 23 21:27:23 EDT 1998 Matthew Wilson <msw@gimp.org>
* app/gimage.c: set srcPR2.[xy] to srcPR1.[xy] in

View File

@ -297,8 +297,6 @@ static GSList *save_procs = NULL;
static PlugInProcDef *load_file_proc = NULL;
static PlugInProcDef *save_file_proc = NULL;
static PlugInProcDef *last_load_file_proc = NULL;
static PlugInProcDef *last_save_file_proc = NULL;
static int image_ID = 0;
@ -518,9 +516,6 @@ file_open_callback (GtkWidget *w,
open_options, FALSE, FALSE, 5);
}
load_file_proc = last_load_file_proc;
last_load_file_proc = NULL;
gtk_widget_show (open_options);
file_dialog_show (fileload);
@ -623,9 +618,6 @@ file_save_as_callback (GtkWidget *w,
break;
}
save_file_proc = last_save_file_proc;
last_save_file_proc = NULL;
gtk_widget_show (save_options);
file_dialog_show (filesave);

View File

@ -377,7 +377,7 @@ text_control (Tool *tool,
case RESUME :
break;
case HALT :
if (the_text_tool->shell != NULL && GTK_WIDGET_VISIBLE (the_text_tool->shell))
if (the_text_tool->shell && GTK_WIDGET_VISIBLE (the_text_tool->shell))
gtk_widget_hide (the_text_tool->shell);
break;
}
@ -1051,7 +1051,7 @@ text_validate_combo (TextTool *text_tool,
if (text_tool->foundry != best_combo[0])
{
text_tool->foundry = best_combo[0];
if (which != 0)
if (which)
gtk_option_menu_set_history (GTK_OPTION_MENU (text_tool->option_menus[0]), text_tool->foundry);
}
if (text_tool->weight != best_combo[1])
@ -1694,12 +1694,12 @@ text_gdk_image_to_region (GdkImage *image,
{
pixel = gdk_image_get_pixel (image, j, i);
if (pixel == black_pixel)
value += 255;
value ++;
}
value = value / scale2;
/* store the alpha value in the data */
*data++ = (unsigned char) value;
*data++= (unsigned char) ((value * 255) / scale2);
}
}
}
@ -1735,7 +1735,7 @@ text_render (GImage *gimage,
void * pr;
/* determine the layer type */
if (drawable != NULL)
if (drawable)
layer_type = drawable_type_with_alpha (drawable);
else
layer_type = gimage_base_type_with_alpha (gimage);
@ -2418,7 +2418,7 @@ text_tool_invoker_ext (Argument *args)
{
int_value = args[1].value.pdb_int;
drawable = drawable_get_ID (int_value);
if (drawable != NULL && gimage != drawable_gimage (drawable))
if (drawable && gimage != drawable_gimage (drawable))
success = FALSE;
}
/* x, y coordinates */

View File

@ -377,7 +377,7 @@ text_control (Tool *tool,
case RESUME :
break;
case HALT :
if (the_text_tool->shell != NULL && GTK_WIDGET_VISIBLE (the_text_tool->shell))
if (the_text_tool->shell && GTK_WIDGET_VISIBLE (the_text_tool->shell))
gtk_widget_hide (the_text_tool->shell);
break;
}
@ -1051,7 +1051,7 @@ text_validate_combo (TextTool *text_tool,
if (text_tool->foundry != best_combo[0])
{
text_tool->foundry = best_combo[0];
if (which != 0)
if (which)
gtk_option_menu_set_history (GTK_OPTION_MENU (text_tool->option_menus[0]), text_tool->foundry);
}
if (text_tool->weight != best_combo[1])
@ -1694,12 +1694,12 @@ text_gdk_image_to_region (GdkImage *image,
{
pixel = gdk_image_get_pixel (image, j, i);
if (pixel == black_pixel)
value += 255;
value ++;
}
value = value / scale2;
/* store the alpha value in the data */
*data++ = (unsigned char) value;
*data++= (unsigned char) ((value * 255) / scale2);
}
}
}
@ -1735,7 +1735,7 @@ text_render (GImage *gimage,
void * pr;
/* determine the layer type */
if (drawable != NULL)
if (drawable)
layer_type = drawable_type_with_alpha (drawable);
else
layer_type = gimage_base_type_with_alpha (gimage);
@ -2418,7 +2418,7 @@ text_tool_invoker_ext (Argument *args)
{
int_value = args[1].value.pdb_int;
drawable = drawable_get_ID (int_value);
if (drawable != NULL && gimage != drawable_gimage (drawable))
if (drawable && gimage != drawable_gimage (drawable))
success = FALSE;
}
/* x, y coordinates */

View File

@ -377,7 +377,7 @@ text_control (Tool *tool,
case RESUME :
break;
case HALT :
if (the_text_tool->shell != NULL && GTK_WIDGET_VISIBLE (the_text_tool->shell))
if (the_text_tool->shell && GTK_WIDGET_VISIBLE (the_text_tool->shell))
gtk_widget_hide (the_text_tool->shell);
break;
}
@ -1051,7 +1051,7 @@ text_validate_combo (TextTool *text_tool,
if (text_tool->foundry != best_combo[0])
{
text_tool->foundry = best_combo[0];
if (which != 0)
if (which)
gtk_option_menu_set_history (GTK_OPTION_MENU (text_tool->option_menus[0]), text_tool->foundry);
}
if (text_tool->weight != best_combo[1])
@ -1694,12 +1694,12 @@ text_gdk_image_to_region (GdkImage *image,
{
pixel = gdk_image_get_pixel (image, j, i);
if (pixel == black_pixel)
value += 255;
value ++;
}
value = value / scale2;
/* store the alpha value in the data */
*data++ = (unsigned char) value;
*data++= (unsigned char) ((value * 255) / scale2);
}
}
}
@ -1735,7 +1735,7 @@ text_render (GImage *gimage,
void * pr;
/* determine the layer type */
if (drawable != NULL)
if (drawable)
layer_type = drawable_type_with_alpha (drawable);
else
layer_type = gimage_base_type_with_alpha (gimage);
@ -2418,7 +2418,7 @@ text_tool_invoker_ext (Argument *args)
{
int_value = args[1].value.pdb_int;
drawable = drawable_get_ID (int_value);
if (drawable != NULL && gimage != drawable_gimage (drawable))
if (drawable && gimage != drawable_gimage (drawable))
success = FALSE;
}
/* x, y coordinates */

View File

@ -545,6 +545,7 @@ plug-ins/MapObject/Makefile
plug-ins/gfig/Makefile
plug-ins/gfig/gfig-examples/Makefile
plug-ins/screenshot/Makefile
plug-ins/sharpen/Makefile
app/Makefile
docs/Makefile
data/Makefile

View File

@ -103,6 +103,7 @@ SUBDIRS = \
screenshot \
semiflatten \
sgi \
sharpen \
shift \
sinus \
smooth_palette \

View File

@ -42,59 +42,29 @@
*
* Revision History:
*
*
* Revison ? 1998/03/16 adrian
* changed MIN, MAX to DESPECKLE_MIN, DESPECKLE_MAX
* since some compilers dont like max/min
* being defined twice.
*
* -Adrian
*
* $Log$
* Revision 1.9 1998/04/13 05:41:41 yosh
* Have fun recompiling gimp everyone. It's the great FSF address change!
* Revision 1.10 1998/04/24 02:18:39 yosh
* * Added sharpen to stable dist
*
* * updated sgi and despeckle plugins
*
* * plug-ins/xd/xd.c: works with xdelta 0.18. The use of xdelta versions prior
* to this is not-supported.
*
* * plug-in/gfig/gfig.c: spelling corrections :)
*
* * app/fileops.c: applied gimp-gord-980420-0, fixes stale save procs in the
* file dialog
*
* * app/text_tool.c: applied gimp-egger-980420-0, text tool optimization
*
* -Yosh
*
* Revision 1.8 1998/03/26 02:08:17 yosh
* * applied gimp-quinet-980122-0 and tweaked the tests a bit, this makes the
* optional library tests in configure.
*
* * applied gimp-jbuhler-980321-0, fixes more warnings in plug-ins
*
* -Yosh
*
* Revision 1.7 1998/03/16 23:02:25 adrian
* Mon Mar 16 17:50:56 EST 1998 Adrian Likins <adrian@gimp.org>
*
* * plugins/illusion/illusion.c:
* * plugins/papertile/papertile.c:
* * plugins/fractaltrace/fractaltrace.c:
* * plugins/flame/flame.c: Changed MAIN(); to MAIN()
*
* *gimprc_user: added a commented out (install-colormap)
* option
*
* *app/install.c: comsetic update to show info about .gimp/scripts
*
* *plugins/sparkle/sparckle.c:
* *plugins/despeckle/despeckle.c: made a local MIN/MAX instead
* of redefing the normal one (causes problems on some compilers)
*
* -adrian
*
* Revision 1.6 1998/03/16 06:33:44 yosh
* configure saves CFLAGS properly
* all plugins should parse gtkrc now
*
* -Yosh
*
* Revision 1.5 1998/01/25 09:29:23 yosh
* Plugin updates
* Properly generated aa Makefile (still not built by default)
* Sven's no args script patch
*
* -Yosh
* Revision 1.17 1998/04/23 14:39:47 mike
* Updated preview code to handle images with alpha (preview now shows checker
* pattern).
* Added call to gtk_window_set_wmclass() to make sure the GIMP icon is used
* by default.
*
* Revision 1.16 1998/01/22 14:35:03 mike
* Added black & white level controls.
@ -165,25 +135,21 @@
#include <libgimp/gimpui.h>
/*
* Macros...
*/
#define DESPECKLE_MIN(a,b) (((a) < (b)) ? (a) : (b))
#define DESPECKLE_MAX(a,b) (((a) > (b)) ? (a) : (b))
/*
* Constants...
*/
#define PLUG_IN_NAME "plug_in_despeckle"
#define PLUG_IN_VERSION "1.2 - 22 January 1998"
#define PLUG_IN_VERSION "1.3 - 23 April 1998"
#define PREVIEW_SIZE 128
#define SCALE_WIDTH 64
#define ENTRY_WIDTH 64
#define MAX_RADIUS 20
#define CHECK_SIZE 8
#define CHECK_DARK 85
#define CHECK_LIGHT 170
#define FILTER_ADAPTIVE 0x01
#define FILTER_RECURSIVE 0x02
@ -290,7 +256,7 @@ query(void)
"Despeckle filter, typically used to \'despeckle\' a photographic image.",
"This plug-in selectively performs a median or adaptive box filter on an image.",
"Michael Sweet <mike@easysw.com>",
"Michael Sweet <mike@easysw.com>",
"Copyright 1997-1998 by Michael Sweet",
PLUG_IN_VERSION,
"<Image>/Filters/Enhance/Despeckle", "RGB*, GRAY*",
PROC_PLUG_IN, nargs, nreturn_vals, args, return_vals);
@ -740,6 +706,7 @@ despeckle_dialog(void)
dialog = gtk_dialog_new();
gtk_window_set_title(GTK_WINDOW(dialog), "Despeckle " PLUG_IN_VERSION);
gtk_window_set_wmclass(GTK_WINDOW(dialog), "despeckle", "Gimp");
gtk_window_position(GTK_WINDOW(dialog), GTK_WIN_POS_MOUSE);
gtk_container_border_width(GTK_CONTAINER(dialog), 0);
gtk_signal_connect(GTK_OBJECT(dialog), "destroy",
@ -770,8 +737,8 @@ despeckle_dialog(void)
gtk_table_attach(GTK_TABLE(ptable), frame, 0, 1, 0, 1, 0, 0, 0, 0);
gtk_widget_show(frame);
preview_width = DESPECKLE_MIN(sel_width, PREVIEW_SIZE);
preview_height = DESPECKLE_MIN(sel_height, PREVIEW_SIZE);
preview_width = MIN(sel_width, PREVIEW_SIZE);
preview_height = MIN(sel_height, PREVIEW_SIZE);
preview = gtk_preview_new(GTK_PREVIEW_COLOR);
gtk_preview_size(GTK_PREVIEW(preview), preview_width, preview_height);
@ -779,8 +746,8 @@ despeckle_dialog(void)
gtk_widget_show(preview);
hscroll_data = gtk_adjustment_new(0, 0, sel_width - 1, 1.0,
DESPECKLE_MIN(preview_width, sel_width),
DESPECKLE_MIN(preview_width, sel_width));
MIN(preview_width, sel_width),
MIN(preview_width, sel_width));
gtk_signal_connect(hscroll_data, "value_changed",
(GtkSignalFunc)preview_scroll_callback, NULL);
@ -791,8 +758,8 @@ despeckle_dialog(void)
gtk_widget_show(scrollbar);
vscroll_data = gtk_adjustment_new(0, 0, sel_height - 1, 1.0,
DESPECKLE_MIN(preview_height, sel_height),
DESPECKLE_MIN(preview_height, sel_height));
MIN(preview_height, sel_height),
MIN(preview_height, sel_height));
gtk_signal_connect(vscroll_data, "value_changed",
(GtkSignalFunc)preview_scroll_callback, NULL);
@ -806,8 +773,8 @@ despeckle_dialog(void)
preview_x1 = sel_x1;
preview_y1 = sel_y1;
preview_x2 = preview_x1 + DESPECKLE_MIN(preview_width, sel_width);
preview_y2 = preview_y1 + DESPECKLE_MIN(preview_height, sel_height);
preview_x2 = preview_x1 + MIN(preview_width, sel_width);
preview_y2 = preview_y1 + MIN(preview_height, sel_height);
/*
* Filter type controls...
@ -944,8 +911,8 @@ preview_scroll_callback(void)
{
preview_x1 = sel_x1 + GTK_ADJUSTMENT(hscroll_data)->value;
preview_y1 = sel_y1 + GTK_ADJUSTMENT(vscroll_data)->value;
preview_x2 = preview_x1 + DESPECKLE_MIN(preview_width, sel_width);
preview_y2 = preview_y1 + DESPECKLE_MIN(preview_height, sel_height);
preview_x2 = preview_x1 + MIN(preview_width, sel_width);
preview_y2 = preview_y1 + MIN(preview_height, sel_height);
preview_update();
}
@ -971,7 +938,9 @@ preview_update(void)
radius, /* Current radius */
hist0, /* Histogram count for 0 values */
hist255; /* Histogram count for 255 values */
guchar rgb[PREVIEW_SIZE * 3], /* Output image */
guchar check, /* Checkerboard pattern */
rgb[PREVIEW_SIZE * PREVIEW_SIZE * 3],
/* Output image */
*rgb_ptr; /* Pixel pointer for output */
@ -1095,38 +1064,81 @@ preview_update(void)
* Draw this row...
*/
rgb_ptr = rgb + y * preview_width * 3;
switch (img_bpp)
{
case 1 :
case 2 :
for (x = 0, dst_ptr = preview_dst, rgb_ptr = rgb;
x < preview_width;
x ++, dst_ptr += img_bpp, rgb_ptr += 3)
for (x = preview_width, dst_ptr = preview_dst;
x > 0;
x --, dst_ptr ++, rgb_ptr += 3)
rgb_ptr[0] = rgb_ptr[1] = rgb_ptr[2] = *dst_ptr;
break;
gtk_preview_draw_row(GTK_PREVIEW(preview), rgb, 0, y, preview_width);
case 2 :
for (x = preview_width, dst_ptr = preview_dst;
x > 0;
x --, dst_ptr += 2, rgb_ptr += 3)
if (dst_ptr[1] == 255)
rgb_ptr[0] = rgb_ptr[1] = rgb_ptr[2] = *dst_ptr;
else
{
if ((y & CHECK_SIZE) ^ (x & CHECK_SIZE))
check = CHECK_LIGHT;
else
check = CHECK_DARK;
if (dst_ptr[1] == 0)
rgb_ptr[0] = rgb_ptr[1] = rgb_ptr[2] = check;
else
rgb_ptr[0] = rgb_ptr[1] = rgb_ptr[2] =
check + ((dst_ptr[0] - check) * dst_ptr[1]) / 255;
};
break;
case 3 :
gtk_preview_draw_row(GTK_PREVIEW(preview), preview_dst, 0, y,
preview_width);
memcpy(rgb_ptr, dst_ptr, preview_width * 3);
break;
case 4 :
for (x = 0, dst_ptr = preview_dst, rgb_ptr = rgb;
x < preview_width;
x ++, dst_ptr += 4, rgb_ptr += 3)
{
rgb_ptr[0] = dst_ptr[0];
rgb_ptr[1] = dst_ptr[1];
rgb_ptr[2] = dst_ptr[2];
};
for (x = preview_width, dst_ptr = preview_dst;
x > 0;
x --, dst_ptr += 4, rgb_ptr += 3)
if (dst_ptr[3] == 255)
{
rgb_ptr[0] = dst_ptr[0];
rgb_ptr[1] = dst_ptr[1];
rgb_ptr[2] = dst_ptr[2];
}
else
{
if ((y & CHECK_SIZE) ^ (x & CHECK_SIZE))
check = CHECK_LIGHT;
else
check = CHECK_DARK;
gtk_preview_draw_row(GTK_PREVIEW(preview), rgb, 0, y, preview_width);
if (dst_ptr[3] == 0)
rgb_ptr[0] = rgb_ptr[1] = rgb_ptr[2] = check;
else
{
rgb_ptr[0] = check + ((dst_ptr[0] - check) * dst_ptr[3]) / 255;
rgb_ptr[1] = check + ((dst_ptr[1] - check) * dst_ptr[3]) / 255;
rgb_ptr[2] = check + ((dst_ptr[2] - check) * dst_ptr[3]) / 255;
};
};
break;
};
};
/*
* Update the screen...
*/
for (y = 0, rgb_ptr = rgb;
y < preview_height;
y ++, rgb_ptr += preview_width * 3)
gtk_preview_draw_row(GTK_PREVIEW(preview), rgb_ptr, 0, y, preview_width);
gtk_widget_draw(preview, NULL);
gdk_flush();
}

View File

@ -25,7 +25,7 @@
*
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* Revision history

1078
plug-ins/common/sharpen.c Normal file

File diff suppressed because it is too large Load Diff

View File

@ -42,59 +42,29 @@
*
* Revision History:
*
*
* Revison ? 1998/03/16 adrian
* changed MIN, MAX to DESPECKLE_MIN, DESPECKLE_MAX
* since some compilers dont like max/min
* being defined twice.
*
* -Adrian
*
* $Log$
* Revision 1.9 1998/04/13 05:41:41 yosh
* Have fun recompiling gimp everyone. It's the great FSF address change!
* Revision 1.10 1998/04/24 02:18:39 yosh
* * Added sharpen to stable dist
*
* * updated sgi and despeckle plugins
*
* * plug-ins/xd/xd.c: works with xdelta 0.18. The use of xdelta versions prior
* to this is not-supported.
*
* * plug-in/gfig/gfig.c: spelling corrections :)
*
* * app/fileops.c: applied gimp-gord-980420-0, fixes stale save procs in the
* file dialog
*
* * app/text_tool.c: applied gimp-egger-980420-0, text tool optimization
*
* -Yosh
*
* Revision 1.8 1998/03/26 02:08:17 yosh
* * applied gimp-quinet-980122-0 and tweaked the tests a bit, this makes the
* optional library tests in configure.
*
* * applied gimp-jbuhler-980321-0, fixes more warnings in plug-ins
*
* -Yosh
*
* Revision 1.7 1998/03/16 23:02:25 adrian
* Mon Mar 16 17:50:56 EST 1998 Adrian Likins <adrian@gimp.org>
*
* * plugins/illusion/illusion.c:
* * plugins/papertile/papertile.c:
* * plugins/fractaltrace/fractaltrace.c:
* * plugins/flame/flame.c: Changed MAIN(); to MAIN()
*
* *gimprc_user: added a commented out (install-colormap)
* option
*
* *app/install.c: comsetic update to show info about .gimp/scripts
*
* *plugins/sparkle/sparckle.c:
* *plugins/despeckle/despeckle.c: made a local MIN/MAX instead
* of redefing the normal one (causes problems on some compilers)
*
* -adrian
*
* Revision 1.6 1998/03/16 06:33:44 yosh
* configure saves CFLAGS properly
* all plugins should parse gtkrc now
*
* -Yosh
*
* Revision 1.5 1998/01/25 09:29:23 yosh
* Plugin updates
* Properly generated aa Makefile (still not built by default)
* Sven's no args script patch
*
* -Yosh
* Revision 1.17 1998/04/23 14:39:47 mike
* Updated preview code to handle images with alpha (preview now shows checker
* pattern).
* Added call to gtk_window_set_wmclass() to make sure the GIMP icon is used
* by default.
*
* Revision 1.16 1998/01/22 14:35:03 mike
* Added black & white level controls.
@ -165,25 +135,21 @@
#include <libgimp/gimpui.h>
/*
* Macros...
*/
#define DESPECKLE_MIN(a,b) (((a) < (b)) ? (a) : (b))
#define DESPECKLE_MAX(a,b) (((a) > (b)) ? (a) : (b))
/*
* Constants...
*/
#define PLUG_IN_NAME "plug_in_despeckle"
#define PLUG_IN_VERSION "1.2 - 22 January 1998"
#define PLUG_IN_VERSION "1.3 - 23 April 1998"
#define PREVIEW_SIZE 128
#define SCALE_WIDTH 64
#define ENTRY_WIDTH 64
#define MAX_RADIUS 20
#define CHECK_SIZE 8
#define CHECK_DARK 85
#define CHECK_LIGHT 170
#define FILTER_ADAPTIVE 0x01
#define FILTER_RECURSIVE 0x02
@ -290,7 +256,7 @@ query(void)
"Despeckle filter, typically used to \'despeckle\' a photographic image.",
"This plug-in selectively performs a median or adaptive box filter on an image.",
"Michael Sweet <mike@easysw.com>",
"Michael Sweet <mike@easysw.com>",
"Copyright 1997-1998 by Michael Sweet",
PLUG_IN_VERSION,
"<Image>/Filters/Enhance/Despeckle", "RGB*, GRAY*",
PROC_PLUG_IN, nargs, nreturn_vals, args, return_vals);
@ -740,6 +706,7 @@ despeckle_dialog(void)
dialog = gtk_dialog_new();
gtk_window_set_title(GTK_WINDOW(dialog), "Despeckle " PLUG_IN_VERSION);
gtk_window_set_wmclass(GTK_WINDOW(dialog), "despeckle", "Gimp");
gtk_window_position(GTK_WINDOW(dialog), GTK_WIN_POS_MOUSE);
gtk_container_border_width(GTK_CONTAINER(dialog), 0);
gtk_signal_connect(GTK_OBJECT(dialog), "destroy",
@ -770,8 +737,8 @@ despeckle_dialog(void)
gtk_table_attach(GTK_TABLE(ptable), frame, 0, 1, 0, 1, 0, 0, 0, 0);
gtk_widget_show(frame);
preview_width = DESPECKLE_MIN(sel_width, PREVIEW_SIZE);
preview_height = DESPECKLE_MIN(sel_height, PREVIEW_SIZE);
preview_width = MIN(sel_width, PREVIEW_SIZE);
preview_height = MIN(sel_height, PREVIEW_SIZE);
preview = gtk_preview_new(GTK_PREVIEW_COLOR);
gtk_preview_size(GTK_PREVIEW(preview), preview_width, preview_height);
@ -779,8 +746,8 @@ despeckle_dialog(void)
gtk_widget_show(preview);
hscroll_data = gtk_adjustment_new(0, 0, sel_width - 1, 1.0,
DESPECKLE_MIN(preview_width, sel_width),
DESPECKLE_MIN(preview_width, sel_width));
MIN(preview_width, sel_width),
MIN(preview_width, sel_width));
gtk_signal_connect(hscroll_data, "value_changed",
(GtkSignalFunc)preview_scroll_callback, NULL);
@ -791,8 +758,8 @@ despeckle_dialog(void)
gtk_widget_show(scrollbar);
vscroll_data = gtk_adjustment_new(0, 0, sel_height - 1, 1.0,
DESPECKLE_MIN(preview_height, sel_height),
DESPECKLE_MIN(preview_height, sel_height));
MIN(preview_height, sel_height),
MIN(preview_height, sel_height));
gtk_signal_connect(vscroll_data, "value_changed",
(GtkSignalFunc)preview_scroll_callback, NULL);
@ -806,8 +773,8 @@ despeckle_dialog(void)
preview_x1 = sel_x1;
preview_y1 = sel_y1;
preview_x2 = preview_x1 + DESPECKLE_MIN(preview_width, sel_width);
preview_y2 = preview_y1 + DESPECKLE_MIN(preview_height, sel_height);
preview_x2 = preview_x1 + MIN(preview_width, sel_width);
preview_y2 = preview_y1 + MIN(preview_height, sel_height);
/*
* Filter type controls...
@ -944,8 +911,8 @@ preview_scroll_callback(void)
{
preview_x1 = sel_x1 + GTK_ADJUSTMENT(hscroll_data)->value;
preview_y1 = sel_y1 + GTK_ADJUSTMENT(vscroll_data)->value;
preview_x2 = preview_x1 + DESPECKLE_MIN(preview_width, sel_width);
preview_y2 = preview_y1 + DESPECKLE_MIN(preview_height, sel_height);
preview_x2 = preview_x1 + MIN(preview_width, sel_width);
preview_y2 = preview_y1 + MIN(preview_height, sel_height);
preview_update();
}
@ -971,7 +938,9 @@ preview_update(void)
radius, /* Current radius */
hist0, /* Histogram count for 0 values */
hist255; /* Histogram count for 255 values */
guchar rgb[PREVIEW_SIZE * 3], /* Output image */
guchar check, /* Checkerboard pattern */
rgb[PREVIEW_SIZE * PREVIEW_SIZE * 3],
/* Output image */
*rgb_ptr; /* Pixel pointer for output */
@ -1095,38 +1064,81 @@ preview_update(void)
* Draw this row...
*/
rgb_ptr = rgb + y * preview_width * 3;
switch (img_bpp)
{
case 1 :
case 2 :
for (x = 0, dst_ptr = preview_dst, rgb_ptr = rgb;
x < preview_width;
x ++, dst_ptr += img_bpp, rgb_ptr += 3)
for (x = preview_width, dst_ptr = preview_dst;
x > 0;
x --, dst_ptr ++, rgb_ptr += 3)
rgb_ptr[0] = rgb_ptr[1] = rgb_ptr[2] = *dst_ptr;
break;
gtk_preview_draw_row(GTK_PREVIEW(preview), rgb, 0, y, preview_width);
case 2 :
for (x = preview_width, dst_ptr = preview_dst;
x > 0;
x --, dst_ptr += 2, rgb_ptr += 3)
if (dst_ptr[1] == 255)
rgb_ptr[0] = rgb_ptr[1] = rgb_ptr[2] = *dst_ptr;
else
{
if ((y & CHECK_SIZE) ^ (x & CHECK_SIZE))
check = CHECK_LIGHT;
else
check = CHECK_DARK;
if (dst_ptr[1] == 0)
rgb_ptr[0] = rgb_ptr[1] = rgb_ptr[2] = check;
else
rgb_ptr[0] = rgb_ptr[1] = rgb_ptr[2] =
check + ((dst_ptr[0] - check) * dst_ptr[1]) / 255;
};
break;
case 3 :
gtk_preview_draw_row(GTK_PREVIEW(preview), preview_dst, 0, y,
preview_width);
memcpy(rgb_ptr, dst_ptr, preview_width * 3);
break;
case 4 :
for (x = 0, dst_ptr = preview_dst, rgb_ptr = rgb;
x < preview_width;
x ++, dst_ptr += 4, rgb_ptr += 3)
{
rgb_ptr[0] = dst_ptr[0];
rgb_ptr[1] = dst_ptr[1];
rgb_ptr[2] = dst_ptr[2];
};
for (x = preview_width, dst_ptr = preview_dst;
x > 0;
x --, dst_ptr += 4, rgb_ptr += 3)
if (dst_ptr[3] == 255)
{
rgb_ptr[0] = dst_ptr[0];
rgb_ptr[1] = dst_ptr[1];
rgb_ptr[2] = dst_ptr[2];
}
else
{
if ((y & CHECK_SIZE) ^ (x & CHECK_SIZE))
check = CHECK_LIGHT;
else
check = CHECK_DARK;
gtk_preview_draw_row(GTK_PREVIEW(preview), rgb, 0, y, preview_width);
if (dst_ptr[3] == 0)
rgb_ptr[0] = rgb_ptr[1] = rgb_ptr[2] = check;
else
{
rgb_ptr[0] = check + ((dst_ptr[0] - check) * dst_ptr[3]) / 255;
rgb_ptr[1] = check + ((dst_ptr[1] - check) * dst_ptr[3]) / 255;
rgb_ptr[2] = check + ((dst_ptr[2] - check) * dst_ptr[3]) / 255;
};
};
break;
};
};
/*
* Update the screen...
*/
for (y = 0, rgb_ptr = rgb;
y < preview_height;
y ++, rgb_ptr += preview_width * 3)
gtk_preview_draw_row(GTK_PREVIEW(preview), rgb_ptr, 0, y, preview_width);
gtk_widget_draw(preview, NULL);
gdk_flush();
}

View File

@ -888,7 +888,7 @@ plug_in_parse_gfig_path()
/*
Translate SPACE to "\\040", etc.
Tkane from gflare plugin
Taken from gflare plugin
*/
void
gfig_name_encode (gchar *dest, gchar *src)
@ -1207,7 +1207,7 @@ gfig_load (gchar *filename, gchar *name)
if(strncmp(GFIG_HEADER,load_buf,strlen(load_buf)))
{
gchar err[256];
sprintf(err,"File '%s' Not a gfig file",gfig->filename);
sprintf(err,"File '%s' is not a gfig file",gfig->filename);
create_warn_dialog(err);
return(NULL);
}
@ -2285,7 +2285,7 @@ bezier_dialog (void)
gtk_signal_connect (GTK_OBJECT (toggle), "toggled",
(GtkSignalFunc) gfig_toggle_update,
(gpointer)&bezier_closed);
gtk_tooltips_set_tip(gfig_tooltips,toggle,"Close curve on compeletion",NULL);
gtk_tooltips_set_tip(gfig_tooltips,toggle,"Close curve on completion",NULL);
gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (toggle),bezier_closed);
gtk_widget_show(toggle);
gtk_box_pack_start(GTK_BOX(vbox),toggle, TRUE, TRUE, 0);
@ -2940,7 +2940,7 @@ paint_menu_callback (GtkWidget *widget, gpointer data)
{
#ifdef DEBUG
printf("layer type set to %s\n",
((DRAWONLAYERS)gtk_object_get_user_data (GTK_OBJECT (widget)) == SINGLE_LAYER)?"SINGLE_LAYER":"MULIT_LAYER");
((DRAWONLAYERS)gtk_object_get_user_data (GTK_OBJECT (widget)) == SINGLE_LAYER)?"SINGLE_LAYER":"MULTI_LAYER");
#endif /* DEBUG */
selvals.onlayers = (DRAWONLAYERS)gtk_object_get_user_data (GTK_OBJECT (widget));
/* Type only meaningful if creating new layers */
@ -3223,7 +3223,7 @@ paint_page()
gtk_signal_connect (GTK_OBJECT (toggle), "toggled",
(GtkSignalFunc) gfig_toggle_update,
(gpointer)&selvals.approxcircles);
gtk_tooltips_set_tip(gfig_tooltips,toggle,"Approx. circles & ellipses using lines. Alows the use of brush fading with these types of objects.",NULL);
gtk_tooltips_set_tip(gfig_tooltips,toggle,"Approx. circles & ellipses using lines. Allows the use of brush fading with these types of objects.",NULL);
gtk_widget_show(toggle);
return(vbox);
@ -4879,7 +4879,7 @@ done_warn_dialog (GtkWidget *w,gint count)
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (window)->action_area), button, TRUE, TRUE, 0);
gtk_widget_show (button);
label = gtk_label_new("Unsaved Gifg objects continue with exiting?");
label = gtk_label_new("Unsaved Gfig objects - continue with exiting?");
gtk_misc_set_padding (GTK_MISC (label), 10, 10);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (window)->vbox), label, TRUE, TRUE, 0);
gtk_widget_show (label);
@ -8304,7 +8304,7 @@ d_load_circle(FILE *from)
new_obj->points->next = edge_pnt;
}
}
g_warning("[%d] No enought points for circle",line_no);
g_warning("[%d] Not enough points for circle",line_no);
return(NULL);
}
@ -8657,7 +8657,7 @@ d_load_ellipse(FILE *from)
new_obj->points->next = edge_pnt;
}
}
g_warning("[%d] No enought points for ellipse",line_no);
g_warning("[%d] Not enough points for ellipse",line_no);
return(NULL);
}
@ -9943,7 +9943,7 @@ line_definition(double x1, double y1, double x2, double y2, double *lgrad, doubl
if(grad1 == 0.0)
{
#ifdef DEBUG
printf("Infiite grad....\n");
printf("Infinite grad....\n");
#endif /* DEBUG */
return;
}
@ -10205,7 +10205,7 @@ d_load_arc(FILE *from)
d_pnt_add_line(new_obj,xpnt,ypnt,-1);
}
}
g_warning("[%d] No enought points for arc",line_no);
g_warning("[%d] Not enough points for arc",line_no);
return(NULL);
}

View File

@ -25,7 +25,7 @@
*
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* Revision history

View File

@ -3,7 +3,7 @@
*
* SGI image file plug-in for the GIMP.
*
* Copyright 1997 Michael Sweet (mike@easysw.com)
* Copyright 1997-1998 Michael Sweet (mike@easysw.com)
*
* 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
@ -34,59 +34,25 @@
* Revision History:
*
* $Log$
* Revision 1.7 1998/04/13 05:43:38 yosh
* Have fun recompiling gimp everyone. It's the great FSF address change!
* Revision 1.8 1998/04/24 02:18:44 yosh
* * Added sharpen to stable dist
*
* * updated sgi and despeckle plugins
*
* * plug-ins/xd/xd.c: works with xdelta 0.18. The use of xdelta versions prior
* to this is not-supported.
*
* * plug-in/gfig/gfig.c: spelling corrections :)
*
* * app/fileops.c: applied gimp-gord-980420-0, fixes stale save procs in the
* file dialog
*
* * app/text_tool.c: applied gimp-egger-980420-0, text tool optimization
*
* -Yosh
*
* Revision 1.6 1998/04/11 05:07:49 yosh
* * app/app_procs.c: fixed up idle handler for file open (look like testgtk
* idle demo)
*
* * app/colomaps.c: fixup for visual test and use of gdk_color_alloc for some
* fixed colors (from Owen Taylor)
*
* * app/errors.h
* * app/errors.c
* * app/main.c
* * libgimp/gimp.c: redid the signal handlers so we only get a debug prompt on
* SIGSEGV, SIGBUS, and SIGFPE.
*
* * applied gimp-jbuhler-980408-0 and gimp-joke-980409-0 (warning fixups)
*
* * applied gimp-monnaux-980409-0 for configurable plugin path for multiarch
* setups
*
* -Yosh
*
* Revision 1.5 1998/04/07 03:41:18 yosh
* configure.in: fix for $srcdir != $builddir for data. Tightened check for
* random() and add -lucb on systems that need it. Fix for xdelta.h check. Find
* xemacs as well as emacs. Properly define settings for print plugin.
*
* app/Makefile.am: ditch -DNDEBUG, since nothing uses it
*
* flame: properly handle random() and friends
*
* pnm: workaround for systems with old sprintfs
*
* print, sgi: fold back in portability fixes
*
* threshold_alpha: properly get params in non-interactive mode
*
* bmp: updated and merged in
*
* -Yosh
*
* Revision 1.4 1998/04/01 22:14:50 neo
* Added checks for print spoolers to configure.in as suggested by Michael
* Sweet. The print plug-in still needs some changes to Makefile.am to make
* make use of this.
*
* Updated print and sgi plug-ins to version on the registry.
*
*
* --Sven
* Revision 1.4 1998/04/23 17:40:49 mike
* Updated to support 16-bit <unsigned> image data.
*
* Revision 1.3 1997/11/14 17:17:59 mike
* Updated to dynamically allocate return params in the run() function.
@ -114,7 +80,7 @@
* Constants...
*/
#define PLUG_IN_VERSION "1.0.4 - 14 November 1997"
#define PLUG_IN_VERSION "1.1 - 23 April 1998"
/*
@ -194,7 +160,7 @@ query(void)
"Loads files in SGI image file format",
"This plug-in loads SGI image files.",
"Michael Sweet <mike@easysw.com>",
"Michael Sweet <mike@easysw.com>",
"Copyright 1997-1998 by Michael Sweet",
PLUG_IN_VERSION,
"<Load>/SGI", NULL, PROC_PLUG_IN, nload_args, nload_return_vals,
load_args, load_return_vals);
@ -203,12 +169,12 @@ query(void)
"Saves files in SGI image file format",
"This plug-in saves SGI image files.",
"Michael Sweet <mike@easysw.com>",
"Michael Sweet <mike@easysw.com>",
"Copyright 1997-1998 by Michael Sweet",
PLUG_IN_VERSION,
"<Save>/SGI", "RGB*,GRAY*", PROC_PLUG_IN, nsave_args, 0, save_args, NULL);
gimp_register_magic_load_handler("file_sgi_load", "rgb,bw,sgi", "", "0,short,474");
gimp_register_save_handler("file_sgi_save", "rgb,bw,sgi", "");
gimp_register_magic_load_handler("file_sgi_load", "rgb,bw,sgi,icon", "", "0,short,474");
gimp_register_save_handler("file_sgi_save", "rgb,bw,sgi,icon", "");
}
@ -341,7 +307,7 @@ load_image(char *filename) /* I - File to load */
guchar **pixels, /* Pixel rows */
*pixel, /* Pixel data */
*pptr; /* Current pixel */
short **rows; /* SGI image data */
unsigned short **rows; /* SGI image data */
char progress[255]; /* Title for progress display... */
@ -427,8 +393,8 @@ load_image(char *filename) /* I - File to load */
for (i = 0; i < tile_height; i ++)
pixels[i] = pixel + sgip->xsize * sgip->zsize * i;
rows = g_new(short *, sgip->zsize);
rows[0] = g_new(short, sgip->xsize * sgip->zsize);
rows = g_new(unsigned short *, sgip->zsize);
rows[0] = g_new(unsigned short, sgip->xsize * sgip->zsize);
for (i = 1; i < sgip->zsize; i ++)
rows[i] = rows[0] + i * sgip->xsize;
@ -467,12 +433,12 @@ load_image(char *filename) /* I - File to load */
else
{
/*
* 16-bit (signed) pixels...
* 16-bit (unsigned) pixels...
*/
for (x = 0, pptr = pixels[count]; x < sgip->xsize; x ++)
for (i = 0; i < sgip->zsize; i ++, pptr ++)
*pptr = (unsigned)(rows[i][x] + 32768) >> 8;
*pptr = rows[i][x] >> 8;
}
}
@ -516,6 +482,8 @@ save_image(char *filename, /* I - File to save to */
int i, j, /* Looping var */
x, /* Current X coordinate */
y, /* Current Y coordinate */
image_type, /* Type of image */
layer_type, /* Type of drawable/layer */
tile_height, /* Height of tile in GIMP */
count, /* Count of rows to put in image */
zsize; /* Number of channels in file */
@ -525,7 +493,7 @@ save_image(char *filename, /* I - File to save to */
guchar **pixels, /* Pixel rows */
*pixel, /* Pixel data */
*pptr; /* Current pixel */
short **rows; /* SGI image data */
unsigned short **rows; /* SGI image data */
char progress[255]; /* Title for progress display... */
@ -584,8 +552,8 @@ save_image(char *filename, /* I - File to save to */
for (i = 0; i < tile_height; i ++)
pixels[i]= pixel + drawable->width * zsize * i;
rows = g_new(short *, sgip->zsize);
rows[0] = g_new(short, sgip->xsize * sgip->zsize);
rows = g_new(unsigned short *, sgip->zsize);
rows[0] = g_new(unsigned short, sgip->xsize * sgip->zsize);
for (i = 1; i < sgip->zsize; i ++)
rows[i] = rows[0] + i * sgip->xsize;
@ -697,7 +665,7 @@ save_dialog(void)
{
"No Compression",
"RLE Compression",
"Advanced RLE\n(Not supported by SGI)"
"Aggressive RLE\n(Not supported by SGI)"
};
@ -720,7 +688,8 @@ save_dialog(void)
*/
dlg = gtk_dialog_new();
gtk_window_set_title(GTK_WINDOW(dlg), "SGI Options");
gtk_window_set_title(GTK_WINDOW(dlg), "SGI - " PLUG_IN_VERSION);
gtk_window_set_wmclass(GTK_WINDOW(dlg), "sgi", "Gimp");
gtk_window_position(GTK_WINDOW(dlg), GTK_WIN_POS_MOUSE);
gtk_signal_connect(GTK_OBJECT(dlg), "destroy",
(GtkSignalFunc)save_close_callback, NULL);

View File

@ -3,7 +3,7 @@
*
* SGI image file format library definitions.
*
* Copyright 1997 Michael Sweet (mike@easysw.com)
* Copyright 1997-1998 Michael Sweet (mike@easysw.com)
*
* 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
@ -22,39 +22,28 @@
* Revision History:
*
* $Log$
* Revision 1.6 1998/04/13 05:43:39 yosh
* Have fun recompiling gimp everyone. It's the great FSF address change!
* Revision 1.7 1998/04/24 02:18:45 yosh
* * Added sharpen to stable dist
*
* * updated sgi and despeckle plugins
*
* * plug-ins/xd/xd.c: works with xdelta 0.18. The use of xdelta versions prior
* to this is not-supported.
*
* * plug-in/gfig/gfig.c: spelling corrections :)
*
* * app/fileops.c: applied gimp-gord-980420-0, fixes stale save procs in the
* file dialog
*
* * app/text_tool.c: applied gimp-egger-980420-0, text tool optimization
*
* -Yosh
*
* Revision 1.5 1998/04/07 03:41:19 yosh
* configure.in: fix for $srcdir != $builddir for data. Tightened check for
* random() and add -lucb on systems that need it. Fix for xdelta.h check. Find
* xemacs as well as emacs. Properly define settings for print plugin.
* Revision 1.4 1998/04/23 17:40:49 mike
* Updated to support 16-bit <unsigned> image data.
*
* app/Makefile.am: ditch -DNDEBUG, since nothing uses it
*
* flame: properly handle random() and friends
*
* pnm: workaround for systems with old sprintfs
*
* print, sgi: fold back in portability fixes
*
* threshold_alpha: properly get params in non-interactive mode
*
* bmp: updated and merged in
*
* -Yosh
*
* Revision 1.4 1998/04/01 22:14:51 neo
* Added checks for print spoolers to configure.in as suggested by Michael
* Sweet. The print plug-in still needs some changes to Makefile.am to make
* make use of this.
*
* Updated print and sgi plug-ins to version on the registry.
*
*
* --Sven
* Revision 1.3 1998/02/05 17:10:58 mike
* Added sgiOpenFile() function for opening an existing file pointer.
*
* Revision 1.2 1997/06/18 00:55:28 mike
* Updated to hold length table when writing.
@ -108,7 +97,7 @@ typedef struct
nextrow, /* File offset for next row */
**table, /* Offset table for compression */
**length; /* Length table for compression */
short *arle_row; /* Advanced RLE compression buffer */
unsigned short *arle_row; /* Advanced RLE compression buffer */
long arle_offset, /* Advanced RLE buffer offset */
arle_length; /* Advanced RLE buffer length */
} sgi_t;
@ -119,10 +108,12 @@ typedef struct
*/
extern int sgiClose(sgi_t *sgip);
extern int sgiGetRow(sgi_t *sgip, short *row, int y, int z);
extern int sgiGetRow(sgi_t *sgip, unsigned short *row, int y, int z);
extern sgi_t *sgiOpen(char *filename, int mode, int comp, int bpp,
int xsize, int ysize, int zsize);
extern int sgiPutRow(sgi_t *sgip, short *row, int y, int z);
extern sgi_t *sgiOpenFile(FILE *file, int mode, int comp, int bpp,
int xsize, int ysize, int zsize);
extern int sgiPutRow(sgi_t *sgip, unsigned short *row, int y, int z);
# ifdef __cplusplus
}

View File

@ -3,7 +3,7 @@
*
* SGI image file format library routines.
*
* Copyright 1997 Michael Sweet (mike@easysw.com)
* Copyright 1997-1998 Michael Sweet (mike@easysw.com)
*
* 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
@ -24,6 +24,7 @@
* sgiClose() - Close an SGI image file.
* sgiGetRow() - Get a row of image data from a file.
* sgiOpen() - Open an SGI image file for reading or writing.
* sgiOpenFile() - Open an SGI image file for reading or writing.
* sgiPutRow() - Put a row of image data to a file.
* getlong() - Get a 32-bit big-endian integer.
* getshort() - Get a 16-bit big-endian integer.
@ -37,40 +38,28 @@
* Revision History:
*
* $Log$
* Revision 1.5 1998/04/13 05:43:40 yosh
* Have fun recompiling gimp everyone. It's the great FSF address change!
* Revision 1.6 1998/04/24 02:18:46 yosh
* * Added sharpen to stable dist
*
* * updated sgi and despeckle plugins
*
* * plug-ins/xd/xd.c: works with xdelta 0.18. The use of xdelta versions prior
* to this is not-supported.
*
* * plug-in/gfig/gfig.c: spelling corrections :)
*
* * app/fileops.c: applied gimp-gord-980420-0, fixes stale save procs in the
* file dialog
*
* * app/text_tool.c: applied gimp-egger-980420-0, text tool optimization
*
* -Yosh
*
* Revision 1.4 1998/04/11 05:07:50 yosh
* * app/app_procs.c: fixed up idle handler for file open (look like testgtk
* idle demo)
* Revision 1.5 1998/04/23 17:40:49 mike
* Updated to support 16-bit <unsigned> image data.
*
* * app/colomaps.c: fixup for visual test and use of gdk_color_alloc for some
* fixed colors (from Owen Taylor)
*
* * app/errors.h
* * app/errors.c
* * app/main.c
* * libgimp/gimp.c: redid the signal handlers so we only get a debug prompt on
* SIGSEGV, SIGBUS, and SIGFPE.
*
* * applied gimp-jbuhler-980408-0 and gimp-joke-980409-0 (warning fixups)
*
* * applied gimp-monnaux-980409-0 for configurable plugin path for multiarch
* setups
*
* -Yosh
*
* Revision 1.3 1998/04/01 22:14:53 neo
* Added checks for print spoolers to configure.in as suggested by Michael
* Sweet. The print plug-in still needs some changes to Makefile.am to make
* make use of this.
*
* Updated print and sgi plug-ins to version on the registry.
*
*
* --Sven
* Revision 1.4 1998/02/05 17:10:58 mike
* Added sgiOpenFile() function for opening an existing file pointer.
*
* Revision 1.3 1997/07/02 16:40:16 mike
* sgiOpen() wasn't opening files with "rb" or "wb+". This caused problems
@ -96,11 +85,11 @@
static int getlong(FILE *);
static int getshort(FILE *);
static int putlong(long, FILE *);
static int putshort(short, FILE *);
static int read_rle8(FILE *, short *, int);
static int read_rle16(FILE *, short *, int);
static int write_rle8(FILE *, short *, int);
static int write_rle16(FILE *, short *, int);
static int putshort(unsigned short, FILE *);
static int read_rle8(FILE *, unsigned short *, int);
static int read_rle16(FILE *, unsigned short *, int);
static int write_rle8(FILE *, unsigned short *, int);
static int write_rle16(FILE *, unsigned short *, int);
/*
@ -165,10 +154,10 @@ sgiClose(sgi_t *sgip) /* I - SGI image */
*/
int
sgiGetRow(sgi_t *sgip, /* I - SGI image */
short *row, /* O - Row to read */
int y, /* I - Line to read */
int z) /* I - Channel to read */
sgiGetRow(sgi_t *sgip, /* I - SGI image */
unsigned short *row, /* O - Row to read */
int y, /* I - Line to read */
int z) /* I - Channel to read */
{
int x; /* X coordinate */
long offset; /* File offset */
@ -232,6 +221,38 @@ sgiOpen(char *filename, /* I - File to open */
int xsize, /* I - Width of image in pixels */
int ysize, /* I - Height of image in pixels */
int zsize) /* I - Number of channels */
{
sgi_t *sgip; /* New SGI image file */
FILE *file; /* Image file pointer */
if (mode == SGI_READ)
file = fopen(filename, "rb");
else
file = fopen(filename, "wb+");
if (file == NULL)
return (NULL);
if ((sgip = sgiOpenFile(file, mode, comp, bpp, xsize, ysize, zsize)) == NULL)
fclose(file);
return (sgip);
}
/*
* 'sgiOpenFile()' - Open an SGI image file for reading or writing.
*/
sgi_t *
sgiOpenFile(FILE *file, /* I - File to open */
int mode, /* I - Open mode (SGI_READ or SGI_WRITE) */
int comp, /* I - Type of compression */
int bpp, /* I - Bytes per pixel */
int xsize, /* I - Width of image in pixels */
int ysize, /* I - Height of image in pixels */
int zsize) /* I - Number of channels */
{
int i, j; /* Looping var */
char name[80]; /* Name of file in image header */
@ -242,27 +263,16 @@ sgiOpen(char *filename, /* I - File to open */
if ((sgip = calloc(sizeof(sgi_t), 1)) == NULL)
return (NULL);
sgip->file = file;
switch (mode)
{
case SGI_READ :
if (filename == NULL)
{
free(sgip);
return (NULL);
}
if ((sgip->file = fopen(filename, "rb")) == NULL)
{
free(sgip);
return (NULL);
}
sgip->mode = SGI_READ;
magic = getshort(sgip->file);
if (magic != SGI_MAGIC)
{
fclose(sgip->file);
free(sgip);
return (NULL);
}
@ -296,8 +306,7 @@ sgiOpen(char *filename, /* I - File to open */
break;
case SGI_WRITE :
if (filename == NULL ||
xsize < 1 ||
if (xsize < 1 ||
ysize < 1 ||
zsize < 1 ||
bpp < 1 || bpp > 2 ||
@ -307,12 +316,6 @@ sgiOpen(char *filename, /* I - File to open */
return (NULL);
}
if ((sgip->file = fopen(filename, "wb+")) == NULL)
{
free(sgip);
return (NULL);
}
sgip->mode = SGI_WRITE;
putshort(SGI_MAGIC, sgip->file);
@ -335,10 +338,6 @@ sgiOpen(char *filename, /* I - File to open */
putlong(0, sgip->file); /* Reserved */
memset(name, 0, sizeof(name));
if (strrchr(filename, '/') == NULL)
strncpy(name, filename, sizeof(name) - 1);
else
strncpy(name, strrchr(filename, '/') + 1, sizeof(name) - 1);
fwrite(name, sizeof(name), 1, sgip->file);
for (i = 0; i < 102; i ++)
@ -365,7 +364,7 @@ sgiOpen(char *filename, /* I - File to open */
break;
case SGI_COMP_ARLE : /* Aggressive RLE */
sgip->arle_row = calloc(xsize, sizeof(short));
sgip->arle_row = (unsigned short *)calloc(xsize, sizeof(unsigned short));
sgip->arle_offset = 0;
case SGI_COMP_RLE : /* Run-Length Encoding */
@ -404,10 +403,10 @@ sgiOpen(char *filename, /* I - File to open */
*/
int
sgiPutRow(sgi_t *sgip, /* I - SGI image */
short *row, /* I - Row to write */
int y, /* I - Line to write */
int z) /* I - Channel to write */
sgiPutRow(sgi_t *sgip, /* I - SGI image */
unsigned short *row, /* I - Row to write */
int y, /* I - Line to write */
int z) /* I - Channel to write */
{
int x; /* X coordinate */
long offset; /* File offset */
@ -602,8 +601,8 @@ putlong(long n, /* I - Long to write */
*/
static int
putshort(short n, /* I - Short to write */
FILE *fp) /* I - File to write to */
putshort(unsigned short n, /* I - Short to write */
FILE *fp) /* I - File to write to */
{
if (putc(n >> 8, fp) == EOF)
return (EOF);
@ -619,9 +618,9 @@ putshort(short n, /* I - Short to write */
*/
static int
read_rle8(FILE *fp, /* I - File to read from */
short *row, /* O - Data */
int xsize) /* I - Width of data in pixels */
read_rle8(FILE *fp, /* I - File to read from */
unsigned short *row, /* O - Data */
int xsize) /* I - Width of data in pixels */
{
int i, /* Looping var */
ch, /* Current character */
@ -664,9 +663,9 @@ read_rle8(FILE *fp, /* I - File to read from */
*/
static int
read_rle16(FILE *fp, /* I - File to read from */
short *row, /* O - Data */
int xsize) /* I - Width of data in pixels */
read_rle16(FILE *fp, /* I - File to read from */
unsigned short *row, /* O - Data */
int xsize)/* I - Width of data in pixels */
{
int i, /* Looping var */
ch, /* Current character */
@ -709,16 +708,16 @@ read_rle16(FILE *fp, /* I - File to read from */
*/
static int
write_rle8(FILE *fp, /* I - File to write to */
short *row, /* I - Data */
int xsize) /* I - Width of data in pixels */
write_rle8(FILE *fp, /* I - File to write to */
unsigned short *row, /* I - Data */
int xsize)/* I - Width of data in pixels */
{
int length,
count,
i,
x;
short *start,
repeat;
int length, /* Length of output line */
count, /* Number of repeated/non-repeated pixels */
i, /* Looping var */
x; /* Looping var */
unsigned short *start, /* Start of sequence */
repeat; /* Repeated pixel */
for (x = xsize, length = 0; x > 0;)
@ -801,16 +800,16 @@ write_rle8(FILE *fp, /* I - File to write to */
*/
static int
write_rle16(FILE *fp, /* I - File to write to */
short *row, /* I - Data */
int xsize)/* I - Width of data in pixels */
write_rle16(FILE *fp, /* I - File to write to */
unsigned short *row,/* I - Data */
int xsize)/* I - Width of data in pixels */
{
int length,
count,
i,
x;
short *start,
repeat;
int length, /* Length of output line */
count, /* Number of repeated/non-repeated pixels */
i, /* Looping var */
x; /* Looping var */
unsigned short *start, /* Start of sequence */
repeat; /* Repeated pixel */
for (x = xsize, length = 0; x > 0;)

View File

@ -0,0 +1,6 @@
Makefile.in
Makefile
.deps
_libs
.libs
sharpen

View File

@ -0,0 +1,39 @@
## Process this file with automake to produce Makefile.in
pluginlibdir = $(gimpplugindir)/plug-ins
pluginlib_PROGRAMS = sharpen
sharpen_SOURCES = \
sharpen.c
INCLUDES = \
$(X_CFLAGS) \
-I$(top_srcdir) \
-I$(includedir)
LDADD = \
$(top_builddir)/libgimp/libgimpui.la \
$(top_builddir)/libgimp/libgimp.la \
$(X_LIBS) \
\
-lc
DEPS = \
$(top_builddir)/libgimp/libgimpui.la \
$(top_builddir)/libgimp/libgimp.la
sharpen_DEPENDENCIES = $(DEPS)
.PHONY: files
files:
@files=`ls $(DISTFILES) 2> /dev/null`; for p in $$files; do \
echo $$p; \
done
@for subdir in $(SUBDIRS); do \
files=`cd $$subdir; $(MAKE) files | grep -v "make\[[1-9]\]"`; \
for file in $$files; do \
echo $$subdir/$$file; \
done; \
done

1078
plug-ins/sharpen/sharpen.c Normal file

File diff suppressed because it is too large Load Diff

View File

@ -39,10 +39,6 @@
#include "xdelta.h"
#include "X11/xpm.h"
#ifdef XDELTA_OLD_PREFIX
#include <zlib.h>
#endif
#define PREVIEW_MAX_DIM 64
static void query (void);
@ -265,11 +261,7 @@ get_name_ver_and_xd (gchar* filename0,
if (valid_file (filename))
*xd = xd_open_write (filename);
else
#ifdef XDELTA_OLD_PREFIX
*xd = xd_create (filename, Z_DEFAULT_COMPRESSION);
#else
*xd = xd_create (filename);
#endif
}
else
*xd = xd_open_write (filename); /* !! it's write so it can update preview segments */