app/drawable_cmds.c applied (a modified version of) a patch from Garry R.

* app/drawable_cmds.c
        * tools/pdbgen/pdb/drawable.pdb: applied (a modified version of) a
        patch from Garry R. Osgood <gosgood@idt.net> that should fix bug #2202
        and problems with the Warp plug-in.

        * app/main.c
        * po-plug-ins/POTFILES.in
        * plug-ins/common/mail.c: applied a patch from
        SHIRASAKI Yasuhiro <yasuhiro@awa.tohoku.ac.jp> that handles i18n issues         and fixes a problem in the mail plug-in.
        ( Could someone please check if the change to app/main.c is the right
          thing to do ?! )

        * po-plug-ins/POTFILES.in
        * plug-ins/common/grid.c
        * plug-ins/gap/iter_ALT/gen/plug_in_grid_iter_ALT.inc:
        checked in a new version of the Grid plug_in developed by
        Tom Rathborne <tomr@aceldama.com> and me.

--Sven
This commit is contained in:
Sven Neumann 1999-11-01 12:36:23 +00:00
parent 35cb0fa47e
commit e26e778d9a
8 changed files with 441 additions and 176 deletions

View File

@ -1,3 +1,24 @@
Mon Nov 1 13:27:14 MET 1999 Sven Neumann <sven@gimp.org>
* app/drawable_cmds.c
* tools/pdbgen/pdb/drawable.pdb: applied (a modified version of) a
patch from Garry R. Osgood <gosgood@idt.net> that should fix bug #2202
and problems with the Warp plug-in.
* app/main.c
* po-plug-ins/POTFILES.in
* plug-ins/common/mail.c: applied a patch from
SHIRASAKI Yasuhiro <yasuhiro@awa.tohoku.ac.jp> that handles i18n issues
and fixes a problem in the mail plug-in.
( Could someone please check if the change to app/main.c is the right
thing to do ?! )
* po-plug-ins/POTFILES.in
* plug-ins/common/grid.c
* plug-ins/gap/iter_ALT/gen/plug_in_grid_iter_ALT.inc:
checked in a new version of the Grid plug_in developed by
Tom Rathborne <tomr@aceldama.com> and me.
Sun Oct 31 21:51:10 MET 1999 Sven Neumann <sven@gimp.org>
* libgimp/Makefile.am

View File

@ -42,9 +42,9 @@ static ProcRecord drawable_bytes_proc;
static ProcRecord drawable_width_proc;
static ProcRecord drawable_height_proc;
static ProcRecord drawable_offsets_proc;
static ProcRecord drawable_is_layer_proc;
static ProcRecord drawable_is_layer_mask_proc;
static ProcRecord drawable_is_channel_proc;
static ProcRecord drawable_layer_proc;
static ProcRecord drawable_layer_mask_proc;
static ProcRecord drawable_channel_proc;
static ProcRecord drawable_get_pixel_proc;
static ProcRecord drawable_set_pixel_proc;
static ProcRecord drawable_set_image_proc;
@ -68,9 +68,9 @@ register_drawable_procs (void)
procedural_db_register (&drawable_width_proc);
procedural_db_register (&drawable_height_proc);
procedural_db_register (&drawable_offsets_proc);
procedural_db_register (&drawable_is_layer_proc);
procedural_db_register (&drawable_is_layer_mask_proc);
procedural_db_register (&drawable_is_channel_proc);
procedural_db_register (&drawable_layer_proc);
procedural_db_register (&drawable_layer_mask_proc);
procedural_db_register (&drawable_channel_proc);
procedural_db_register (&drawable_get_pixel_proc);
procedural_db_register (&drawable_set_pixel_proc);
procedural_db_register (&drawable_set_image_proc);
@ -134,6 +134,8 @@ drawable_fill_invoker (Argument *args)
gint32 fill_type;
drawable = gimp_drawable_get_ID (args[0].value.pdb_int);
if (drawable == NULL)
success = FALSE;
fill_type = args[1].value.pdb_int;
if (fill_type < FOREGROUND_FILL || fill_type > NO_FILL)
@ -333,8 +335,11 @@ drawable_image_invoker (Argument *args)
GimpImage *gimage;
drawable = gimp_drawable_get_ID (args[0].value.pdb_int);
if (drawable == NULL)
success = FALSE;
success = (gimage = drawable_gimage (drawable)) != NULL;
if (success)
success = (gimage = drawable_gimage (drawable)) != NULL;
return_args = procedural_db_return_args (&drawable_image_proc, success);
@ -875,20 +880,20 @@ static ProcRecord drawable_offsets_proc =
};
static Argument *
drawable_is_layer_invoker (Argument *args)
drawable_layer_invoker (Argument *args)
{
Argument *return_args;
GimpDrawable *drawable;
drawable = gimp_drawable_get_ID (args[0].value.pdb_int);
return_args = procedural_db_return_args (&drawable_is_layer_proc, TRUE);
return_args = procedural_db_return_args (&drawable_layer_proc, TRUE);
return_args[1].value.pdb_int = drawable_layer (drawable) ? TRUE : FALSE;
return return_args;
}
static ProcArg drawable_is_layer_inargs[] =
static ProcArg drawable_layer_inargs[] =
{
{
PDB_DRAWABLE,
@ -897,7 +902,7 @@ static ProcArg drawable_is_layer_inargs[] =
}
};
static ProcArg drawable_is_layer_outargs[] =
static ProcArg drawable_layer_outargs[] =
{
{
PDB_INT32,
@ -906,9 +911,9 @@ static ProcArg drawable_is_layer_outargs[] =
}
};
static ProcRecord drawable_is_layer_proc =
static ProcRecord drawable_layer_proc =
{
"gimp_drawable_is_layer",
"gimp_drawable_layer",
"Returns whether the drawable is a layer.",
"This procedure returns non-zero if the specified drawable is a layer.",
"Spencer Kimball & Peter Mattis",
@ -916,27 +921,27 @@ static ProcRecord drawable_is_layer_proc =
"1995-1996",
PDB_INTERNAL,
1,
drawable_is_layer_inargs,
drawable_layer_inargs,
1,
drawable_is_layer_outargs,
{ { drawable_is_layer_invoker } }
drawable_layer_outargs,
{ { drawable_layer_invoker } }
};
static Argument *
drawable_is_layer_mask_invoker (Argument *args)
drawable_layer_mask_invoker (Argument *args)
{
Argument *return_args;
GimpDrawable *drawable;
drawable = gimp_drawable_get_ID (args[0].value.pdb_int);
return_args = procedural_db_return_args (&drawable_is_layer_mask_proc, TRUE);
return_args = procedural_db_return_args (&drawable_layer_mask_proc, TRUE);
return_args[1].value.pdb_int = drawable_layer_mask (drawable) ? TRUE : FALSE;
return return_args;
}
static ProcArg drawable_is_layer_mask_inargs[] =
static ProcArg drawable_layer_mask_inargs[] =
{
{
PDB_DRAWABLE,
@ -945,7 +950,7 @@ static ProcArg drawable_is_layer_mask_inargs[] =
}
};
static ProcArg drawable_is_layer_mask_outargs[] =
static ProcArg drawable_layer_mask_outargs[] =
{
{
PDB_INT32,
@ -954,9 +959,9 @@ static ProcArg drawable_is_layer_mask_outargs[] =
}
};
static ProcRecord drawable_is_layer_mask_proc =
static ProcRecord drawable_layer_mask_proc =
{
"gimp_drawable_is_layer_mask",
"gimp_drawable_layer_mask",
"Returns whether the drawable is a layer mask.",
"This procedure returns non-zero if the specified drawable is a layer mask.",
"Spencer Kimball & Peter Mattis",
@ -964,27 +969,27 @@ static ProcRecord drawable_is_layer_mask_proc =
"1995-1996",
PDB_INTERNAL,
1,
drawable_is_layer_mask_inargs,
drawable_layer_mask_inargs,
1,
drawable_is_layer_mask_outargs,
{ { drawable_is_layer_mask_invoker } }
drawable_layer_mask_outargs,
{ { drawable_layer_mask_invoker } }
};
static Argument *
drawable_is_channel_invoker (Argument *args)
drawable_channel_invoker (Argument *args)
{
Argument *return_args;
GimpDrawable *drawable;
drawable = gimp_drawable_get_ID (args[0].value.pdb_int);
return_args = procedural_db_return_args (&drawable_is_channel_proc, TRUE);
return_args = procedural_db_return_args (&drawable_channel_proc, TRUE);
return_args[1].value.pdb_int = drawable_channel (drawable) ? TRUE : FALSE;
return return_args;
}
static ProcArg drawable_is_channel_inargs[] =
static ProcArg drawable_channel_inargs[] =
{
{
PDB_DRAWABLE,
@ -993,7 +998,7 @@ static ProcArg drawable_is_channel_inargs[] =
}
};
static ProcArg drawable_is_channel_outargs[] =
static ProcArg drawable_channel_outargs[] =
{
{
PDB_INT32,
@ -1002,9 +1007,9 @@ static ProcArg drawable_is_channel_outargs[] =
}
};
static ProcRecord drawable_is_channel_proc =
static ProcRecord drawable_channel_proc =
{
"gimp_drawable_is_channel",
"gimp_drawable_channel",
"Returns whether the drawable is a channel.",
"This procedure returns non-zero if the specified drawable is a channel.",
"Spencer Kimball & Peter Mattis",
@ -1012,10 +1017,10 @@ static ProcRecord drawable_is_channel_proc =
"1995-1996",
PDB_INTERNAL,
1,
drawable_is_channel_inargs,
drawable_channel_inargs,
1,
drawable_is_channel_outargs,
{ { drawable_is_channel_invoker } }
drawable_channel_outargs,
{ { drawable_channel_invoker } }
};
static Argument *

View File

@ -121,6 +121,7 @@ main (int argc, char **argv)
/* Initialize i18n support */
INIT_LOCALE("gimp");
bindtextdomain("gimp-std-plugins", LOCALEDIR);
gtk_init (&argc, &argv);

View File

@ -33,8 +33,13 @@
#include "libgimp/gimp.h"
#include "libgimp/gimpintl.h"
#include "libgimp/gimpchainbutton.h"
#include "libgimp/gimpcolorbutton.h"
#include "libgimp/gimpsizeentry.h"
#define SPIN_BUTTON_WIDTH 75
#define COLOR_BUTTON_WIDTH 55
/* Declare local functions. */
static void query (void);
static void run (char *name,
@ -42,35 +47,43 @@ static void run (char *name,
GParam *param,
int *nreturn_vals,
GParam **return_vals);
static gint dialog (gint32 image_ID,
GDrawable *drawable);
static gint dialog (gint32 image_ID, GDrawable *drawable);
static void doit (GDrawable *drawable);
GPlugInInfo PLUG_IN_INFO =
{
NULL, /* init_proc */
NULL, /* quit_proc */
query, /* query_proc */
run, /* run_proc */
NULL, /* init_proc */
NULL, /* quit_proc */
query, /* query_proc */
run, /* run_proc */
};
gint bytes;
gint sx1, sy1, sx2, sy2;
int run_flag = 0;
gint run_flag = FALSE;
typedef struct
{
gint width;
gint height;
gint x_offset;
gint y_offset;
gint hwidth;
gint hspace;
gint hoffset;
guint8 hcolor[4];
gint vwidth;
gint vspace;
gint voffset;
guint8 vcolor[4];
gint iwidth;
gint ispace;
gint ioffset;
guint8 icolor[4];
}
config;
Config;
config my_config =
Config grid_cfg =
{
16, 16, /* width, height */
0, 0, /* x_offset, y_offset */
1, 16, 8, { 0, 0, 128, 255 }, /* horizontal */
1, 16, 8, { 0, 0, 128, 255 }, /* vertical */
0, 2, 6, { 0, 0, 255, 255 }, /* intersection */
};
@ -81,13 +94,27 @@ void query (void)
{
static GParamDef args[] =
{
{PARAM_INT32, "run_mode", "Interactive, non-interactive"},
{PARAM_IMAGE, "image", "Input image"},
{PARAM_INT32, "run_mode", "Interactive, non-interactive"},
{PARAM_IMAGE, "image", "Input image"},
{PARAM_DRAWABLE, "drawable", "Input drawable"},
{PARAM_INT32, "width", "Width"},
{PARAM_INT32, "height", "Height"},
{PARAM_INT32, "x_offset", "X Offset"},
{PARAM_INT32, "y_offset", "Y Offset"},
{PARAM_INT32, "hwidth", "Horizontal Width"},
{PARAM_INT32, "hspace", "Horizontal Spacing"},
{PARAM_INT32, "hoffset", "Horizontal Offset"},
{PARAM_COLOR, "hcolor", "Horizontal Colour"},
{PARAM_INT8, "hopacity", "Horizontal Opacity (0...255)"},
{PARAM_INT32, "vwidth", "Vertical Width"},
{PARAM_INT32, "vspace", "Vertical Spacing"},
{PARAM_INT32, "voffset", "Vertical Offset"},
{PARAM_COLOR, "vcolor", "Vertical Colour"},
{PARAM_INT8, "vopacity", "Vertical Opacity (0...255)"},
{PARAM_INT32, "iwidth", "Intersection Width"},
{PARAM_INT32, "ispace", "Intersection Spacing"},
{PARAM_INT32, "ioffset", "Intersection Offset"},
{PARAM_COLOR, "icolor", "Intersection Colour"},
{PARAM_INT8, "iopacity", "Intersection Opacity (0...255)"},
};
static GParamDef *return_vals = NULL;
static int nargs = sizeof (args) / sizeof (args[0]);
@ -97,7 +124,7 @@ void query (void)
"Draws a grid.",
"",
"Tim Newsome",
"Tim Newsome, Sven Neumann",
"Tim Newsome, Sven Neumann, Tom Rathborne",
"1997, 1999",
"<Image>/Filters/Render/Grid",
"RGB*, GRAY*",
@ -128,34 +155,52 @@ run (char *name,
if (run_mode == RUN_NONINTERACTIVE)
{
if (n_params != 7)
{
status = STATUS_CALLING_ERROR;
}
if (n_params != 18)
status = STATUS_CALLING_ERROR;
if( status == STATUS_SUCCESS)
{
my_config.width = param[3].data.d_int32;
my_config.height = param[4].data.d_int32;
my_config.x_offset = param[5].data.d_int32;
my_config.y_offset = param[6].data.d_int32;
grid_cfg.hwidth = param[3].data.d_int32;
grid_cfg.hspace = param[4].data.d_int32;
grid_cfg.hoffset = param[5].data.d_int32;
grid_cfg.hcolor[0] = param[6].data.d_color.red;
grid_cfg.hcolor[1] = param[6].data.d_color.green;
grid_cfg.hcolor[2] = param[6].data.d_color.blue;
grid_cfg.hcolor[3] = param[7].data.d_int8;
grid_cfg.vwidth = param[8].data.d_int32;
grid_cfg.vspace = param[9].data.d_int32;
grid_cfg.voffset = param[10].data.d_int32;
grid_cfg.vcolor[0] = param[11].data.d_color.red;
grid_cfg.vcolor[1] = param[11].data.d_color.green;
grid_cfg.vcolor[2] = param[11].data.d_color.blue;
grid_cfg.vcolor[3] = param[12].data.d_int8;
grid_cfg.iwidth = param[13].data.d_int32;
grid_cfg.ispace = param[14].data.d_int32;
grid_cfg.ioffset = param[15].data.d_int32;
grid_cfg.icolor[0] = param[16].data.d_color.red;
grid_cfg.icolor[1] = param[16].data.d_color.green;
grid_cfg.icolor[2] = param[16].data.d_color.blue;
grid_cfg.icolor[3] = param[17].data.d_int8;
}
}
else
{
/* Possibly retrieve data */
gimp_get_data ("plug_in_grid", &my_config);
gimp_get_data ("plug_in_grid", &grid_cfg);
}
if (run_mode == RUN_INTERACTIVE)
if (run_mode == RUN_INTERACTIVE)
{
if (!dialog (image_ID, drawable))
{
if (!dialog (image_ID, drawable))
{
/* The dialog was closed, or something similarly evil happened. */
status = STATUS_EXECUTION_ERROR;
}
/* The dialog was closed, or something similarly evil happened. */
status = STATUS_EXECUTION_ERROR;
}
}
if (my_config.width <= 0 || my_config.height <= 0)
if (grid_cfg.hspace <= 0 || grid_cfg.vspace <= 0)
{
status = STATUS_EXECUTION_ERROR;
}
@ -174,7 +219,7 @@ run (char *name,
gimp_displays_flush ();
if (run_mode == RUN_INTERACTIVE)
gimp_set_data ("plug_in_grid", &my_config, sizeof (my_config));
gimp_set_data ("plug_in_grid", &grid_cfg, sizeof (grid_cfg));
}
else
{
@ -187,15 +232,41 @@ run (char *name,
values[0].data.d_status = status;
}
G_INLINE_FUNC void
pix_composite (guchar *p1,
guchar p2[4],
int bytes,
int alpha)
{
int b;
if (alpha)
{
bytes--;
}
for (b = 0; b < bytes; b++)
{
*p1 = *p1 * (1.0 - p2[3]/255.0) + p2[b] * p2[3]/255.0;
p1++;
}
if (alpha && *p1 < 255)
{
b = *p1 + 255.0 * ((double)p2[3] / (255.0 - *p1));
*p1 = b > 255 ? 255 : b;
}
}
static void
doit (GDrawable * drawable)
{
GPixelRgn srcPR, destPR;
gint width, height;
int w, h, b;
guchar *copybuf;
guchar color[4] = {0, 0, 0, 0};
gint width, height, bytes;
guchar *dest;
int x, y, alpha;
/* Get the input area. This is the bounding box of the selection in
* the image (or the entire image if there is no selection). Only
* operating on the input area is simply an optimization. It doesn't
@ -204,55 +275,67 @@ doit (GDrawable * drawable)
*/
gimp_drawable_mask_bounds (drawable->id, &sx1, &sy1, &sx2, &sy2);
/* Get the size of the input image. (This will/must be the same
* as the size of the output image.
/* Get the size of the input image.
* (This will/must be the same as the size of the output image.)
*/
width = drawable->width;
width = drawable->width;
height = drawable->height;
bytes = drawable->bpp;
if (gimp_drawable_has_alpha (drawable->id))
{
color[bytes - 1] = 0xff;
}
bytes = drawable->bpp;
alpha = gimp_drawable_has_alpha (drawable->id);
/* initialize the pixel regions */
gimp_pixel_rgn_init (&srcPR, drawable, 0, 0, width, height, FALSE, FALSE);
gimp_pixel_rgn_init (&destPR, drawable, 0, 0, width, height, TRUE, TRUE);
/* First off, copy the old one to the new one. */
copybuf = malloc (width * bytes);
for (h = sy1; h < sy2; h++)
dest = malloc (width * bytes);
for (y = sy1; y < sy2; y++)
{
gimp_pixel_rgn_get_row (&srcPR, copybuf, sx1, h, (sx2-sx1));
if ((h - my_config.y_offset) % my_config.height == 0)
gimp_pixel_rgn_get_row (&srcPR, dest, sx1, y, (sx2-sx1));
if (((y - grid_cfg.voffset + height) % grid_cfg.vspace) < grid_cfg.vwidth )
{ /* Draw row */
for (w = sx1; w < sx2; w++)
for (x = sx1; x < sx2; x++)
{
for (b = 0; b < bytes; b++)
{
copybuf[(w-sx1) * bytes + b] = color[b];
}
pix_composite ( &dest[(x-sx1) * bytes], grid_cfg.hcolor, bytes, alpha);
}
}
else
{
for (w = sx1; w < sx2; w++)
if (((y - grid_cfg.voffset + height + ((grid_cfg.iwidth - grid_cfg.vwidth) / 2)) % grid_cfg.vspace) < grid_cfg.iwidth )
{ /* Draw irow */
for (x = sx1; x < sx2; x++)
{
if ((w - my_config.x_offset) % my_config.width == 0)
{
for (b = 0; b < bytes; b++)
{
copybuf[(w-sx1) * bytes + b] = color[b];
}
}
if ((((x - grid_cfg.hoffset + width - (grid_cfg.hwidth /2)) % grid_cfg.hspace) >= grid_cfg.ispace
&& ((x - grid_cfg.hoffset + width - (grid_cfg.hwidth /2)) % grid_cfg.hspace) < grid_cfg.ioffset)
|| (abs(((x - grid_cfg.hoffset + width - (grid_cfg.hwidth /2)) % grid_cfg.hspace) - grid_cfg.hspace) >= grid_cfg.ispace
&& (abs(((x - grid_cfg.hoffset + width - (grid_cfg.hwidth /2)) % grid_cfg.hspace) - grid_cfg.hspace) < grid_cfg.ioffset))) {
pix_composite ( &dest[(x-sx1) * bytes], grid_cfg.icolor, bytes, alpha);
}
}
}
gimp_pixel_rgn_set_row (&destPR, copybuf, sx1, h , (sx2-sx1) );
gimp_progress_update ((double) h / (double) (sy2 - sy1));
}
for (x = sx1; x < sx2; x++)
{
if (((x - grid_cfg.hoffset + width) % grid_cfg.hspace) < grid_cfg.hwidth )
{
pix_composite ( &dest[(x-sx1) * bytes], grid_cfg.vcolor, bytes, alpha);
}
if ((((x - grid_cfg.hoffset + width + ((grid_cfg.iwidth - grid_cfg.hwidth)/ 2)) % grid_cfg.hspace) < grid_cfg.iwidth)
&& (( (((y - grid_cfg.voffset + height - (grid_cfg.vwidth / 2)) % grid_cfg.vspace) >= grid_cfg.ispace)
&& (((y - grid_cfg.voffset + height - (grid_cfg.vwidth / 2)) % grid_cfg.vspace) < grid_cfg.ioffset))
|| (( (abs(((y - grid_cfg.voffset + height - (grid_cfg.vwidth / 2)) % grid_cfg.vspace) - grid_cfg.vspace) >= grid_cfg.ispace)
&& (abs(((y - grid_cfg.voffset + height - (grid_cfg.vwidth / 2)) % grid_cfg.vspace) - grid_cfg.vspace) < grid_cfg.ioffset))
))
)
{
pix_composite ( &dest[(x-sx1) * bytes], grid_cfg.icolor, bytes, alpha);
}
}
gimp_pixel_rgn_set_row (&destPR, dest, sx1, y, (sx2-sx1) );
gimp_progress_update ((double) y / (double) (sy2 - sy1));
}
free (copybuf);
free (dest);
/* update the timred region */
gimp_drawable_flush (drawable);
@ -275,16 +358,23 @@ ok_callback (GtkWidget * widget, gpointer data)
{
GtkWidget *entry;
run_flag = 1;
run_flag = TRUE;
entry = gtk_object_get_data (GTK_OBJECT (data), "size");
my_config.width = (int)(gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (entry), 0) + 0.5);
my_config.height = (int)(gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (entry), 1) + 0.5);
entry = gtk_object_get_data (GTK_OBJECT (data), "width");
grid_cfg.hwidth = (int)(gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (entry), 0) + 0.5);
grid_cfg.vwidth = (int)(gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (entry), 1) + 0.5);
grid_cfg.iwidth = (int)(gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (entry), 2) + 0.5);
entry = gtk_object_get_data (GTK_OBJECT (data), "offset");
my_config.x_offset = (int)(gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (entry), 0) + 0.5);
my_config.y_offset = (int)(gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (entry), 1) + 0.5);
entry = gtk_object_get_data (GTK_OBJECT (data), "space");
grid_cfg.hspace = (int)(gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (entry), 0) + 0.5);
grid_cfg.vspace = (int)(gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (entry), 1) + 0.5);
grid_cfg.ispace = (int)(gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (entry), 2) + 0.5);
entry = gtk_object_get_data (GTK_OBJECT (data), "offset");
grid_cfg.hoffset = (int)(gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (entry), 0) + 0.5);
grid_cfg.voffset = (int)(gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (entry), 1) + 0.5);
grid_cfg.ioffset = (int)(gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (entry), 2) + 0.5);
gtk_widget_destroy (GTK_WIDGET (data));
}
@ -321,21 +411,26 @@ entry_callback (GtkWidget * widget, gpointer data)
}
}
static gint
dialog (gint32 image_ID,
GDrawable *drawable)
{
GtkWidget *dlg;
GtkWidget *hbbox;
GtkWidget *button;
GtkWidget *hbbox;
GtkWidget *hbox;
GtkWidget *size;
GtkWidget *width;
GtkWidget *width_button;
GtkWidget *space;
GtkWidget *space_button;
GtkWidget *offset;
GtkWidget *align;
GUnit unit;
gdouble xres;
gdouble yres;
gchar **argv;
gint argc;
gchar **argv;
gint argc;
argc = 1;
argv = g_new (gchar *, 1);
@ -379,77 +474,191 @@ dialog (gint32 image_ID,
gtk_box_pack_start (GTK_BOX (hbbox), button, FALSE, FALSE, 0);
gtk_widget_show (button);
/* The size entries */
/* The width entries */
hbox = gtk_hbox_new (FALSE, 0);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dlg)->vbox), hbox, FALSE, FALSE, 4);
size = gimp_size_entry_new (2, /* number_of_fields */
unit, /* unit */
"%a", /* unit_format */
TRUE, /* menu_show_pixels */
TRUE, /* menu_show_percent */
FALSE, /* show_refval */
75, /* spinbutton_usize */
GIMP_SIZE_ENTRY_UPDATE_SIZE); /* update_policy */
width = gimp_size_entry_new (3, /* number_of_fields */
UNIT_PIXEL, /* FIXME - use unit */
"%a", /* unit_format */
TRUE, /* menu_show_pixels */
TRUE, /* menu_show_percent */
FALSE, /* show_refval */
SPIN_BUTTON_WIDTH, /* spinbutton_usize */
GIMP_SIZE_ENTRY_UPDATE_SIZE); /* update_policy */
/* set the resolution to the image resolution */
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (size), 0, xres, TRUE);
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (size), 1, yres, TRUE);
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (width), 0, xres, TRUE);
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (width), 1, yres, TRUE);
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (width), 2, xres, TRUE);
/* set the size (in pixels) that will be treated as 0% and 100% */
gimp_size_entry_set_size (GIMP_SIZE_ENTRY (size), 0, 0.0, (gdouble)(drawable->width));
gimp_size_entry_set_size (GIMP_SIZE_ENTRY (size), 1, 0.0, (gdouble)(drawable->height));
gimp_size_entry_set_size (GIMP_SIZE_ENTRY (width), 0, 0.0, (gdouble)(drawable->width));
gimp_size_entry_set_size (GIMP_SIZE_ENTRY (width), 1, 0.0, (gdouble)(drawable->height));
gimp_size_entry_set_size (GIMP_SIZE_ENTRY (width), 2, 0.0, (gdouble)(drawable->width));
/* set upper and lower limits (in pixels) */
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (size), 0, 0.0, (gdouble)(drawable->width));
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (size), 1, 0.0, (gdouble)(drawable->height));
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (width), 0, 0.0, (gdouble)(drawable->width));
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (width), 1, 0.0, (gdouble)(drawable->height));
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (width), 2, 0.0, (gdouble)(drawable->width));
/* initialize the values */
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (size), 0, (gdouble)my_config.width);
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (size), 1, (gdouble)my_config.height);
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (width), 0, (gdouble)grid_cfg.hwidth);
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (width), 1, (gdouble)grid_cfg.vwidth);
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (width), 2, (gdouble)grid_cfg.iwidth);
/* attach labels */
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (size), _("X"), 0, 1, 0.5);
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (size), _("Y"), 0, 2, 0.5);
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (size), _("Size: "), 1, 0, 0.0);
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (width), _("Horizontal"), 0, 1, 0.0);
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (width), _("Vertical"), 0, 2, 0.0);
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (width), _("Intersection"), 0, 3, 0.0);
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (width), _("Width: "), 1, 0, 0.0);
/* put a chain_button under the size_entries */
button = gimp_chain_button_new (GIMP_CHAIN_BOTTOM);
if (my_config.width == my_config.height)
gimp_chain_button_set_active (GIMP_CHAIN_BUTTON (button), TRUE);
gtk_table_attach_defaults (GTK_TABLE (size), button, 1, 3, 2, 3);
gtk_widget_show (button);
width_button = gimp_chain_button_new (GIMP_CHAIN_BOTTOM);
if (grid_cfg.hwidth == grid_cfg.vwidth)
gimp_chain_button_set_active (GIMP_CHAIN_BUTTON (width_button), TRUE);
gtk_table_attach_defaults (GTK_TABLE (width), width_button, 1, 3, 2, 3);
gtk_widget_show (width_button);
/* connect to the 'value_changed' and "unit_changed" signals because we have to
take care of keeping the entries in sync when the chainbutton is active */
gtk_signal_connect (GTK_OBJECT (size), "value_changed", (GtkSignalFunc) entry_callback, button);
gtk_signal_connect (GTK_OBJECT (size), "unit_changed", (GtkSignalFunc) entry_callback, button);
gtk_signal_connect (GTK_OBJECT (width), "value_changed",
(GtkSignalFunc) entry_callback, width_button);
gtk_signal_connect (GTK_OBJECT (width), "unit_changed",
(GtkSignalFunc) entry_callback, width_button);
gtk_box_pack_end (GTK_BOX (hbox), size, FALSE, FALSE, 4);
gtk_widget_show (size);
gtk_box_pack_end (GTK_BOX (hbox), width, FALSE, FALSE, 4);
gtk_widget_show (width);
gtk_widget_show (hbox);
/* the offset entries */
hbox = gtk_hbox_new (FALSE, 4);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dlg)->vbox), hbox, FALSE, FALSE, 0);
offset = gimp_size_entry_new (2, unit, "%a", TRUE, TRUE, FALSE, 75,
GIMP_SIZE_ENTRY_UPDATE_SIZE);
/* The space entries */
hbox = gtk_hbox_new (FALSE, 0);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dlg)->vbox), hbox, FALSE, FALSE, 4);
space = gimp_size_entry_new (3, /* number_of_fields */
UNIT_PIXEL, /* FIXME - use unit */
"%a", /* unit_format */
TRUE, /* menu_show_pixels */
TRUE, /* menu_show_percent */
FALSE, /* show_refval */
SPIN_BUTTON_WIDTH, /* spinbutton_usize */
GIMP_SIZE_ENTRY_UPDATE_SIZE); /* update_policy */
/* set the resolution to the image resolution */
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (space), 0, xres, TRUE);
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (space), 1, yres, TRUE);
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (space), 2, xres, TRUE);
/* set the size (in pixels) that will be treated as 0% and 100% */
gimp_size_entry_set_size (GIMP_SIZE_ENTRY (space), 0, 0.0, (gdouble)(drawable->width));
gimp_size_entry_set_size (GIMP_SIZE_ENTRY (space), 1, 0.0, (gdouble)(drawable->height));
gimp_size_entry_set_size (GIMP_SIZE_ENTRY (space), 2, 0.0, (gdouble)(drawable->width));
/* set upper and lower limits (in pixels) */
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (space), 0, 0.0, (gdouble)(drawable->width));
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (space), 1, 0.0, (gdouble)(drawable->height));
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (space), 2, 0.0, (gdouble)(drawable->width));
/* initialize the values */
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (space), 0, (gdouble)grid_cfg.hspace);
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (space), 1, (gdouble)grid_cfg.vspace);
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (space), 2, (gdouble)grid_cfg.ispace);
/* attach labels */
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (space), _("Spacing: "), 1, 0, 0.0);
/* put a chain_button under the size_entries */
space_button = gimp_chain_button_new (GIMP_CHAIN_BOTTOM);
if (grid_cfg.hspace == grid_cfg.vspace)
gimp_chain_button_set_active (GIMP_CHAIN_BUTTON (space_button), TRUE);
gtk_table_attach_defaults (GTK_TABLE (space), space_button, 1, 3, 2, 3);
gtk_widget_show (space_button);
/* connect to the 'value_changed' and "unit_changed" signals because we have to
take care of keeping the entries in sync when the chainbutton is active */
gtk_signal_connect (GTK_OBJECT (space), "value_changed",
(GtkSignalFunc) entry_callback, space_button);
gtk_signal_connect (GTK_OBJECT (space), "unit_changed",
(GtkSignalFunc) entry_callback, space_button);
gtk_box_pack_end (GTK_BOX (hbox), space, FALSE, FALSE, 4);
gtk_widget_show (space);
gtk_widget_show (hbox);
/* The offset entries */
hbox = gtk_hbox_new (FALSE, 0);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dlg)->vbox), hbox, FALSE, FALSE, 4);
offset = gimp_size_entry_new (3, /* number_of_fields */
UNIT_PIXEL, /* FIXME - use unit */
"%a", /* unit_format */
TRUE, /* menu_show_pixels */
TRUE, /* menu_show_percent */
FALSE, /* show_refval */
SPIN_BUTTON_WIDTH, /* spinbutton_usize */
GIMP_SIZE_ENTRY_UPDATE_SIZE); /* update_policy */
/* set the resolution to the image resolution */
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (offset), 0, xres, TRUE);
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (offset), 1, yres, TRUE);
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (offset), 2, xres, TRUE);
/* set the size (in pixels) that will be treated as 0% and 100% */
gimp_size_entry_set_size (GIMP_SIZE_ENTRY (offset), 0, 0.0, (gdouble)(drawable->width));
gimp_size_entry_set_size (GIMP_SIZE_ENTRY (offset), 1, 0.0, (gdouble)(drawable->height));
gimp_size_entry_set_size (GIMP_SIZE_ENTRY (offset), 2, 0.0, (gdouble)(drawable->width));
/* set upper and lower limits (in pixels) */
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (offset), 0, 0.0, (gdouble)(drawable->width));
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (offset), 1, 0.0, (gdouble)(drawable->height));
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (offset), 0, (gdouble)my_config.x_offset);
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (offset), 1, (gdouble)my_config.y_offset);
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (offset), _("Offset: "), 1, 0, 0.0);
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (offset), 2, 0.0, (gdouble)(drawable->width));
/* initialize the values */
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (offset), 0, (gdouble)grid_cfg.hoffset);
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (offset), 1, (gdouble)grid_cfg.voffset);
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (offset), 2, (gdouble)grid_cfg.ioffset);
/* attach labels */
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (offset), _("Offset: "), 1, 0, 0.0);
/* attach color selectors */
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (offset), _("Color: "), 2, 0, 0.0);
button = gimp_color_button_new (_("Horizontal Color"), COLOR_BUTTON_WIDTH, 16,
grid_cfg.hcolor, 4);
align = gtk_alignment_new (0.0, 0.5, 0, 0);
gtk_container_add (GTK_CONTAINER (align), button);
gtk_table_attach (GTK_TABLE (offset), align, 1, 2, 2, 3,
GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_EXPAND, 0, 10);
gtk_widget_show (button);
gtk_widget_show (align);
button = gimp_color_button_new (_("Vertical Color"), COLOR_BUTTON_WIDTH, 16,
grid_cfg.vcolor, 4);
align = gtk_alignment_new (0.0, 0.5, 0, 0);
gtk_container_add (GTK_CONTAINER (align), button);
gtk_table_attach (GTK_TABLE (offset), align, 2, 3, 2, 3,
GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_EXPAND, 0, 10);
gtk_widget_show (button);
gtk_widget_show (align);
button = gimp_color_button_new (_("Intersection Color"), COLOR_BUTTON_WIDTH, 16,
grid_cfg.icolor, 4);
align = gtk_alignment_new (0.0, 0.5, 0, 0);
gtk_container_add (GTK_CONTAINER (align), button);
gtk_table_attach (GTK_TABLE (offset), align, 3, 4, 2, 3,
GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_EXPAND, 0, 10);
gtk_widget_show (button);
gtk_widget_show (align);
gtk_box_pack_end (GTK_BOX (hbox), offset, FALSE, FALSE, 4);
gtk_widget_show (offset);
gtk_widget_show (hbox);
gtk_widget_show (dlg);
gtk_object_set_data (GTK_OBJECT (dlg), "size", size);
gtk_object_set_data (GTK_OBJECT (dlg), "width", width);
gtk_object_set_data (GTK_OBJECT (dlg), "space", space);
gtk_object_set_data (GTK_OBJECT (dlg), "offset", offset);
gtk_main ();
@ -457,3 +666,5 @@ dialog (gint32 image_ID,
return run_flag;
}

View File

@ -181,7 +181,7 @@ static m_info mail_info = {
if you prefer that as the default */
};
static gchar * mesg_body;
static gchar * mesg_body = "\0";
static int run_flag = 0;
MAIN ()

View File

@ -6,10 +6,21 @@ gint p_plug_in_grid_iter_ALT(GRunModeType run_mode, gint32 total_steps, gdouble
{
typedef struct t_plug_in_grid_Vals
{
long width;
long height;
long x_offset;
long y_offset;
long hwidth;
long hspace;
long hoffset;
t_color hcolor;
char hopacity;
long vwidth;
long vspace;
long voffset;
t_color vcolor;
char vopacity;
long iwidth;
long ispace;
long ioffset;
t_color icolor;
char iopacity;
} t_plug_in_grid_Vals;
t_plug_in_grid_Vals buf, *buf_from, *buf_to;
@ -28,10 +39,21 @@ gint p_plug_in_grid_iter_ALT(GRunModeType run_mode, gint32 total_steps, gdouble
buf_to = (t_plug_in_grid_Vals *)&g_plugin_data_to[0];
memcpy(&buf, buf_from, sizeof(buf));
p_delta_long(&buf.width, buf_from->width, buf_to->width, total_steps, current_step);
p_delta_long(&buf.height, buf_from->height, buf_to->height, total_steps, current_step);
p_delta_long(&buf.x_offset, buf_from->x_offset, buf_to->x_offset, total_steps, current_step);
p_delta_long(&buf.y_offset, buf_from->y_offset, buf_to->y_offset, total_steps, current_step);
p_delta_long(&buf.hwidth, buf_from->hwidth, buf_to->hwidth, total_steps, current_step);
p_delta_long(&buf.hspace, buf_from->hspace, buf_to->hspace, total_steps, current_step);
p_delta_long(&buf.hoffset, buf_from->hoffset, buf_to->hoffset, total_steps, current_step);
p_delta_color(&buf.hcolor, &buf_from->hcolor, &buf_to->hcolor, total_steps, current_step);
p_delta_char(&buf.hopacity, buf_from->hopacity, buf_to->hopacity, total_steps, current_step);
p_delta_long(&buf.vwidth, buf_from->vwidth, buf_to->vwidth, total_steps, current_step);
p_delta_long(&buf.vspace, buf_from->vspace, buf_to->vspace, total_steps, current_step);
p_delta_long(&buf.voffset, buf_from->voffset, buf_to->voffset, total_steps, current_step);
p_delta_color(&buf.vcolor, &buf_from->vcolor, &buf_to->vcolor, total_steps, current_step);
p_delta_char(&buf.vopacity, buf_from->vopacity, buf_to->vopacity, total_steps, current_step);
p_delta_long(&buf.iwidth, buf_from->iwidth, buf_to->iwidth, total_steps, current_step);
p_delta_long(&buf.ispace, buf_from->ispace, buf_to->ispace, total_steps, current_step);
p_delta_long(&buf.ioffset, buf_from->ioffset, buf_to->ioffset, total_steps, current_step);
p_delta_color(&buf.icolor, &buf_from->icolor, &buf_to->icolor, total_steps, current_step);
p_delta_char(&buf.iopacity, buf_from->iopacity, buf_to->iopacity, total_steps, current_step);
gimp_set_data("plug_in_grid", &buf, sizeof(buf));

View File

@ -31,7 +31,9 @@ plug-ins/common/depthmerge.c
plug-ins/common/destripe.c
plug-ins/common/gif.c
plug-ins/common/gifload.c
plug-ins/common/grid.c
plug-ins/common/film.c
plug-ins/common/mail.c
plug-ins/common/normalize.c
plug-ins/common/oilify.c
plug-ins/common/png.c

View File

@ -130,6 +130,7 @@ HELP
{ name => 'fill_type', type => 'enum GimpFillType',
desc => 'The type of fill: %%desc%%' }
);
delete $inargs[0]->{no_success};
%invoke = ( code => 'drawable_fill (drawable, (GimpFillType) fill_type);' );
}
@ -212,6 +213,8 @@ sub drawable_image {
@outargs = ( &std_image_arg );
$outargs[0]->{desc} = "The drawable's image";
delete $inargs[0]->{no_success};
%invoke = (
code => 'success = (gimage = drawable_gimage (drawable)) != NULL;'
);
@ -309,15 +312,15 @@ HELP
%invoke = ( code => 'drawable_offsets (drawable, &offset_x, &offset_y);' );
}
sub drawable_is_layer {
sub drawable_layer {
&drawable_is_proc('layer');
}
sub drawable_is_layer_mask {
sub drawable_layer_mask {
&drawable_is_proc('layer mask');
}
sub drawable_is_channel {
sub drawable_channel {
&drawable_is_proc('channel');
}
@ -509,8 +512,8 @@ CODE
drawable_mask_bounds drawable_image drawable_type
drawable_has_alpha drawable_type_with_alpha drawable_is_rgb
drawable_is_gray drawable_is_indexed drawable_bytes drawable_width
drawable_height drawable_offsets drawable_is_layer
drawable_is_layer_mask drawable_is_channel drawable_get_pixel
drawable_height drawable_offsets drawable_layer
drawable_layer_mask drawable_channel drawable_get_pixel
drawable_set_pixel drawable_set_image drawable_thumbnail);
%exports = (app => [@procs], lib => [@procs]);