mirror of https://github.com/GNOME/gimp.git
pdbgened, header file removed
* app/layer_cmds.[ch]: pdbgened, header file removed * app/internal_procs.c: use pdbgen register for layer funcs * app/*_cmds.c: various pdbgen formatting fixes * app/Makefile.am: removed layer_cmds.h * app/layer.c * app/layerF.h: changed AddMaskType enum to capitals -Yosh
This commit is contained in:
parent
be58493784
commit
107038e5dc
13
ChangeLog
13
ChangeLog
|
@ -1,3 +1,16 @@
|
|||
Sat Apr 24 13:28:13 PDT 1999 Manish Singh <yosh@gimp.org>
|
||||
|
||||
* app/layer_cmds.[ch]: pdbgened, header file removed
|
||||
|
||||
* app/internal_procs.c: use pdbgen register for layer funcs
|
||||
|
||||
* app/*_cmds.c: various pdbgen formatting fixes
|
||||
|
||||
* app/Makefile.am: removed layer_cmds.h
|
||||
|
||||
* app/layer.c
|
||||
* app/layerF.h: changed AddMaskType enum to capitals
|
||||
|
||||
Sat Apr 24 11:30:34 1999 ape@lrdpf.spacetec.no (Asbjorn Pettersen)
|
||||
|
||||
* app/plug_in.c (plug_in_open): Add OS/2 patches. Setting pipes
|
||||
|
|
|
@ -243,7 +243,6 @@ gimp_SOURCES = \
|
|||
layerF.h \
|
||||
layer_pvt.h \
|
||||
layer_cmds.c \
|
||||
layer_cmds.h \
|
||||
layer_select.c \
|
||||
layer_select.h \
|
||||
layers_dialog.c \
|
||||
|
|
|
@ -92,7 +92,7 @@ brushes_popup_invoker (Argument *args)
|
|||
{
|
||||
if (brush && strlen (brush))
|
||||
newdialog = brush_select_new (title, brush, opacity, spacing,
|
||||
paint_mode);
|
||||
paint_mode);
|
||||
else
|
||||
newdialog = brush_select_new (title, NULL, 0.0, 0, 0);
|
||||
|
||||
|
@ -269,11 +269,11 @@ brushes_set_popup_invoker (Argument *args)
|
|||
|
||||
bsp->spacing_data->value = bsp->spacing_value;
|
||||
gtk_signal_emit_by_name (GTK_OBJECT (bsp->spacing_data),
|
||||
"value_changed");
|
||||
"value_changed");
|
||||
|
||||
bsp->opacity_data->value = bsp->opacity_value * 100.0;
|
||||
gtk_signal_emit_by_name (GTK_OBJECT (bsp->opacity_data),
|
||||
"value_changed");
|
||||
"value_changed");
|
||||
|
||||
gtk_option_menu_set_history (GTK_OPTION_MENU (bsp->option_menu), bsp->paint_mode);
|
||||
|
||||
|
|
|
@ -515,10 +515,10 @@ brushes_get_brush_data_invoker (Argument *args)
|
|||
brushp = (GimpBrushP) list->data;
|
||||
|
||||
if (!strcmp (brushp->name, name))
|
||||
{
|
||||
success = TRUE;
|
||||
break;
|
||||
}
|
||||
{
|
||||
success = TRUE;
|
||||
break;
|
||||
}
|
||||
|
||||
list = list->next;
|
||||
}
|
||||
|
|
|
@ -657,7 +657,7 @@ static ProcArg channel_set_opacity_inargs[] =
|
|||
{
|
||||
PDB_FLOAT,
|
||||
"opacity",
|
||||
"The new channel opacity"
|
||||
"The new channel opacity (0 <= opacity <= 100)"
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -98,19 +98,19 @@ brightness_contrast_invoker (Argument *args)
|
|||
gimage = gimp_drawable_gimage (drawable);
|
||||
|
||||
lut = brightness_contrast_lut_new (brightness / 255.0,
|
||||
contrast / 127.0,
|
||||
gimp_drawable_bytes (drawable));
|
||||
contrast / 127.0,
|
||||
gimp_drawable_bytes (drawable));
|
||||
|
||||
/* The application should occur only within selection bounds */
|
||||
gimp_drawable_mask_bounds (drawable, &x1, &y1, &x2, &y2);
|
||||
|
||||
pixel_region_init (&srcPR, gimp_drawable_data (drawable),
|
||||
x1, y1, (x2 - x1), (y2 - y1), FALSE);
|
||||
x1, y1, (x2 - x1), (y2 - y1), FALSE);
|
||||
pixel_region_init (&destPR, gimp_drawable_shadow (drawable),
|
||||
x1, y1, (x2 - x1), (y2 - y1), TRUE);
|
||||
x1, y1, (x2 - x1), (y2 - y1), TRUE);
|
||||
|
||||
pixel_regions_process_parallel ((p_func) gimp_lut_process, lut, 2,
|
||||
&srcPR, &destPR);
|
||||
&srcPR, &destPR);
|
||||
|
||||
gimp_lut_free (lut);
|
||||
gimp_drawable_merge_shadow (drawable, TRUE);
|
||||
|
@ -229,19 +229,19 @@ levels_invoker (Argument *args)
|
|||
|
||||
/* setup the lut */
|
||||
lut = levels_lut_new (gamma, low_input, high_input,
|
||||
low_output, high_output,
|
||||
gimp_drawable_bytes (drawable));
|
||||
low_output, high_output,
|
||||
gimp_drawable_bytes (drawable));
|
||||
|
||||
/* The application should occur only within selection bounds */
|
||||
gimp_drawable_mask_bounds (drawable, &x1, &y1, &x2, &y2);
|
||||
|
||||
pixel_region_init (&srcPR, gimp_drawable_data (drawable),
|
||||
x1, y1, (x2 - x1), (y2 - y1), FALSE);
|
||||
x1, y1, (x2 - x1), (y2 - y1), FALSE);
|
||||
pixel_region_init (&destPR, gimp_drawable_shadow (drawable),
|
||||
x1, y1, (x2 - x1), (y2 - y1), TRUE);
|
||||
x1, y1, (x2 - x1), (y2 - y1), TRUE);
|
||||
|
||||
pixel_regions_process_parallel ((p_func) gimp_lut_process, lut, 2,
|
||||
&srcPR, &destPR);
|
||||
&srcPR, &destPR);
|
||||
|
||||
gimp_lut_free(lut);
|
||||
gimp_drawable_merge_shadow (drawable, TRUE);
|
||||
|
@ -340,12 +340,12 @@ posterize_invoker (Argument *args)
|
|||
gimp_drawable_mask_bounds (drawable, &x1, &y1, &x2, &y2);
|
||||
|
||||
pixel_region_init (&srcPR, gimp_drawable_data (drawable),
|
||||
x1, y1, (x2 - x1), (y2 - y1), FALSE);
|
||||
x1, y1, (x2 - x1), (y2 - y1), FALSE);
|
||||
pixel_region_init (&destPR, gimp_drawable_shadow (drawable),
|
||||
x1, y1, (x2 - x1), (y2 - y1), TRUE);
|
||||
x1, y1, (x2 - x1), (y2 - y1), TRUE);
|
||||
|
||||
pixel_regions_process_parallel ((p_func) gimp_lut_process, lut, 2,
|
||||
&srcPR, &destPR);
|
||||
&srcPR, &destPR);
|
||||
|
||||
gimp_lut_free (lut);
|
||||
gimp_drawable_merge_shadow (drawable, TRUE);
|
||||
|
@ -575,8 +575,8 @@ curves_spline_invoker (Argument *args)
|
|||
for (i = 0; i < 5; i++)
|
||||
for (j = 0; j < 17; j++)
|
||||
{
|
||||
cd.points[i][j][0] = -1;
|
||||
cd.points[i][j][1] = -1;
|
||||
cd.points[i][j][0] = -1;
|
||||
cd.points[i][j][1] = -1;
|
||||
}
|
||||
|
||||
cd.drawable = drawable;
|
||||
|
@ -595,12 +595,12 @@ curves_spline_invoker (Argument *args)
|
|||
gimp_drawable_mask_bounds (drawable, &x1, &y1, &x2, &y2);
|
||||
|
||||
pixel_region_init (&srcPR, gimp_drawable_data (drawable),
|
||||
x1, y1, (x2 - x1), (y2 - y1), FALSE);
|
||||
x1, y1, (x2 - x1), (y2 - y1), FALSE);
|
||||
pixel_region_init (&destPR, gimp_drawable_shadow (drawable),
|
||||
x1, y1, (x2 - x1), (y2 - y1), TRUE);
|
||||
x1, y1, (x2 - x1), (y2 - y1), TRUE);
|
||||
|
||||
pixel_regions_process_parallel ((p_func) gimp_lut_process, cd.lut, 2,
|
||||
&srcPR, &destPR);
|
||||
&srcPR, &destPR);
|
||||
|
||||
gimp_lut_free (cd.lut);
|
||||
gimp_drawable_merge_shadow (drawable, TRUE);
|
||||
|
@ -698,17 +698,17 @@ curves_explicit_invoker (Argument *args)
|
|||
|
||||
cd.lut = gimp_lut_new ();
|
||||
gimp_lut_setup (cd.lut, (GimpLutFunc) curves_lut_func,
|
||||
(void *) &cd, gimp_drawable_bytes(drawable));
|
||||
(void *) &cd, gimp_drawable_bytes(drawable));
|
||||
|
||||
/* The application should occur only within selection bounds */
|
||||
gimp_drawable_mask_bounds (drawable, &x1, &y1, &x2, &y2);
|
||||
pixel_region_init (&srcPR, gimp_drawable_data (drawable),
|
||||
x1, y1, (x2 - x1), (y2 - y1), FALSE);
|
||||
x1, y1, (x2 - x1), (y2 - y1), FALSE);
|
||||
pixel_region_init (&destPR, gimp_drawable_shadow (drawable),
|
||||
x1, y1, (x2 - x1), (y2 - y1), TRUE);
|
||||
x1, y1, (x2 - x1), (y2 - y1), TRUE);
|
||||
|
||||
pixel_regions_process_parallel ((p_func) gimp_lut_process, cd.lut, 2,
|
||||
&srcPR, &destPR);
|
||||
&srcPR, &destPR);
|
||||
|
||||
gimp_lut_free (cd.lut);
|
||||
gimp_drawable_merge_shadow (drawable, TRUE);
|
||||
|
@ -821,9 +821,9 @@ color_balance_invoker (Argument *args)
|
|||
gimp_drawable_mask_bounds (drawable, &x1, &y1, &x2, &y2);
|
||||
|
||||
pixel_region_init (&srcPR, gimp_drawable_data (drawable),
|
||||
x1, y1, (x2 - x1), (y2 - y1), FALSE);
|
||||
x1, y1, (x2 - x1), (y2 - y1), FALSE);
|
||||
pixel_region_init (&destPR, gimp_drawable_shadow (drawable),
|
||||
x1, y1, (x2 - x1), (y2 - y1), TRUE);
|
||||
x1, y1, (x2 - x1), (y2 - y1), TRUE);
|
||||
|
||||
for (pr = pixel_regions_register (2, &srcPR, &destPR); pr;
|
||||
pr = pixel_regions_process (pr))
|
||||
|
@ -931,11 +931,11 @@ histogram_invoker (Argument *args)
|
|||
htd.drawable = drawable;
|
||||
htd.color = gimp_drawable_color (drawable);
|
||||
htd.histogram = histogram_widget_new (HISTOGRAM_WIDTH,
|
||||
HISTOGRAM_HEIGHT);
|
||||
HISTOGRAM_HEIGHT);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (htd.histogram), "rangechanged",
|
||||
(GtkSignalFunc) histogram_tool_histogram_range,
|
||||
(void*) &htd);
|
||||
(GtkSignalFunc) histogram_tool_histogram_range,
|
||||
(void*) &htd);
|
||||
|
||||
/* The information collection should occur only within selection bounds */
|
||||
no_mask = (gimp_drawable_mask_bounds (drawable, &x1, &y1, &x2, &y2) == FALSE);
|
||||
|
@ -943,12 +943,12 @@ histogram_invoker (Argument *args)
|
|||
|
||||
/* Configure the src from the drawable data */
|
||||
pixel_region_init (&srcPR, gimp_drawable_data (drawable),
|
||||
x1, y1, (x2 - x1), (y2 - y1), FALSE);
|
||||
x1, y1, (x2 - x1), (y2 - y1), FALSE);
|
||||
|
||||
/* Configure the mask from the gimage's selection mask */
|
||||
mask = gimage_get_mask (drawable_gimage (GIMP_DRAWABLE (drawable)));
|
||||
pixel_region_init (&maskPR, gimp_drawable_data (GIMP_DRAWABLE(mask)),
|
||||
x1 + off_x, y1 + off_y, (x2 - x1), (y2 - y1), FALSE);
|
||||
x1 + off_x, y1 + off_y, (x2 - x1), (y2 - y1), FALSE);
|
||||
|
||||
/* Apply the image transformation to the pixels */
|
||||
htd.hist = gimp_histogram_new ();
|
||||
|
@ -959,7 +959,7 @@ histogram_invoker (Argument *args)
|
|||
|
||||
/* Calculate the statistics */
|
||||
histogram_tool_histogram_range (htd.histogram, start_range, end_range,
|
||||
&htd);
|
||||
&htd);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1111,9 +1111,9 @@ hue_saturation_invoker (Argument *args)
|
|||
gimp_drawable_mask_bounds (drawable, &x1, &y1, &x2, &y2);
|
||||
|
||||
pixel_region_init (&srcPR, gimp_drawable_data (drawable),
|
||||
x1, y1, (x2 - x1), (y2 - y1), FALSE);
|
||||
x1, y1, (x2 - x1), (y2 - y1), FALSE);
|
||||
pixel_region_init (&destPR, gimp_drawable_shadow (drawable),
|
||||
x1, y1, (x2 - x1), (y2 - y1), TRUE);
|
||||
x1, y1, (x2 - x1), (y2 - y1), TRUE);
|
||||
|
||||
for (pr = pixel_regions_register (2, &srcPR, &destPR); pr;
|
||||
pr = pixel_regions_process (pr))
|
||||
|
@ -1209,12 +1209,12 @@ threshold_invoker (Argument *args)
|
|||
gimp_drawable_mask_bounds (drawable, &x1, &y1, &x2, &y2);
|
||||
|
||||
pixel_region_init (&srcPR, gimp_drawable_data (drawable),
|
||||
x1, y1, (x2 - x1), (y2 - y1), FALSE);
|
||||
x1, y1, (x2 - x1), (y2 - y1), FALSE);
|
||||
pixel_region_init (&destPR, gimp_drawable_shadow (drawable),
|
||||
x1, y1, (x2 - x1), (y2 - y1), TRUE);
|
||||
x1, y1, (x2 - x1), (y2 - y1), TRUE);
|
||||
|
||||
pixel_regions_process_parallel ((p_func) threshold_2, (void*) &td, 2,
|
||||
&srcPR, &destPR);
|
||||
&srcPR, &destPR);
|
||||
|
||||
gimp_drawable_merge_shadow (drawable, TRUE);
|
||||
drawable_update (drawable, x1, y1, (x2 - x1), (y2 - y1));
|
||||
|
|
|
@ -222,7 +222,7 @@ convert_indexed_palette_invoker (Argument *args)
|
|||
{
|
||||
case MAKE_PALETTE:
|
||||
if (num_cols < 1 || num_cols > MAXNUMCOLORS)
|
||||
success = FALSE;
|
||||
success = FALSE;
|
||||
break;
|
||||
|
||||
case REUSE_PALETTE:
|
||||
|
@ -232,22 +232,22 @@ convert_indexed_palette_invoker (Argument *args)
|
|||
|
||||
case CUSTOM_PALETTE:
|
||||
if (!palette_entries_list)
|
||||
palette_init_palettes (FALSE);
|
||||
palette_init_palettes (FALSE);
|
||||
|
||||
for (list = palette_entries_list; list; list = list->next)
|
||||
{
|
||||
entries = (PaletteEntriesP) list->data;
|
||||
if (!strcmp (palette_name, entries->name))
|
||||
{
|
||||
the_palette = entries;
|
||||
break;
|
||||
}
|
||||
}
|
||||
{
|
||||
entries = (PaletteEntriesP) list->data;
|
||||
if (!strcmp (palette_name, entries->name))
|
||||
{
|
||||
the_palette = entries;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (the_palette == NULL)
|
||||
success = FALSE;
|
||||
success = FALSE;
|
||||
else
|
||||
theCustomPalette = the_palette;
|
||||
theCustomPalette = the_palette;
|
||||
|
||||
break;
|
||||
|
||||
|
|
|
@ -493,13 +493,13 @@ layer_create_mask (layer, add_mask_type)
|
|||
|
||||
switch (add_mask_type)
|
||||
{
|
||||
case WhiteMask:
|
||||
case ADD_WHITE_MASK:
|
||||
color_region (&maskPR, &white_mask);
|
||||
break;
|
||||
case BlackMask:
|
||||
case ADD_BLACK_MASK:
|
||||
color_region (&maskPR, &black_mask);
|
||||
break;
|
||||
case AlphaMask:
|
||||
case ADD_ALPHA_MASK:
|
||||
/* Extract the layer's alpha channel */
|
||||
if (layer_has_alpha (layer))
|
||||
{
|
||||
|
|
|
@ -1047,7 +1047,7 @@ drawable_get_pixel_invoker (Argument *args)
|
|||
pixel = g_new (gint8, num_channels);
|
||||
|
||||
tile = tile_manager_get_tile (drawable_data (drawable), x, y,
|
||||
TRUE, TRUE);
|
||||
TRUE, TRUE);
|
||||
|
||||
x %= TILE_WIDTH;
|
||||
y %= TILE_WIDTH;
|
||||
|
@ -1157,7 +1157,7 @@ drawable_set_pixel_invoker (Argument *args)
|
|||
num_channels == drawable_bytes (drawable))
|
||||
{
|
||||
tile = tile_manager_get_tile (drawable_data (drawable), x, y,
|
||||
TRUE, TRUE);
|
||||
TRUE, TRUE);
|
||||
|
||||
x %= TILE_WIDTH;
|
||||
y %= TILE_WIDTH;
|
||||
|
|
|
@ -493,13 +493,13 @@ layer_create_mask (layer, add_mask_type)
|
|||
|
||||
switch (add_mask_type)
|
||||
{
|
||||
case WhiteMask:
|
||||
case ADD_WHITE_MASK:
|
||||
color_region (&maskPR, &white_mask);
|
||||
break;
|
||||
case BlackMask:
|
||||
case ADD_BLACK_MASK:
|
||||
color_region (&maskPR, &black_mask);
|
||||
break;
|
||||
case AlphaMask:
|
||||
case ADD_ALPHA_MASK:
|
||||
/* Extract the layer's alpha channel */
|
||||
if (layer_has_alpha (layer))
|
||||
{
|
||||
|
|
|
@ -238,7 +238,7 @@ gradients_set_popup_invoker (Argument *args)
|
|||
active = tmp->data;
|
||||
|
||||
if (!strcmp (gradient_name, active->name))
|
||||
break; /* We found the one we want */
|
||||
break; /* We found the one we want */
|
||||
|
||||
pos++;
|
||||
tmp = tmp->next;
|
||||
|
@ -320,10 +320,10 @@ gradients_get_gradient_data_invoker (Argument *args)
|
|||
grad = list->data;
|
||||
|
||||
if (!strcmp (grad->name, name))
|
||||
{
|
||||
success = TRUE;
|
||||
break; /* We found it! */
|
||||
}
|
||||
{
|
||||
success = TRUE;
|
||||
break; /* We found it! */
|
||||
}
|
||||
|
||||
list = list->next;
|
||||
}
|
||||
|
|
|
@ -3473,7 +3473,7 @@ fill_white_callback (GtkWidget *w,
|
|||
AddMaskOptions *options;
|
||||
|
||||
options = (AddMaskOptions *) client_data;
|
||||
options->add_mask_type = WhiteMask;
|
||||
options->add_mask_type = ADD_WHITE_MASK;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -3483,7 +3483,7 @@ fill_black_callback (GtkWidget *w,
|
|||
AddMaskOptions *options;
|
||||
|
||||
options = (AddMaskOptions *) client_data;
|
||||
options->add_mask_type = BlackMask;
|
||||
options->add_mask_type = ADD_BLACK_MASK;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -3493,7 +3493,7 @@ fill_alpha_callback (GtkWidget *w,
|
|||
AddMaskOptions *options;
|
||||
|
||||
options = (AddMaskOptions *) client_data;
|
||||
options->add_mask_type = AlphaMask;
|
||||
options->add_mask_type = ADD_ALPHA_MASK;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -3528,7 +3528,7 @@ layers_dialog_add_mask_query (Layer *layer)
|
|||
/* the new options structure */
|
||||
options = (AddMaskOptions *) g_malloc (sizeof (AddMaskOptions));
|
||||
options->layer = layer;
|
||||
options->add_mask_type = WhiteMask;
|
||||
options->add_mask_type = ADD_WHITE_MASK;
|
||||
|
||||
/* the dialog */
|
||||
options->query_box = gtk_dialog_new ();
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
#include "app_procs.h"
|
||||
#include "gimage_cmds.h"
|
||||
#include "gimage_mask_cmds.h"
|
||||
#include "layer_cmds.h"
|
||||
#include "internal_procs.h"
|
||||
#include "procedural_db.h"
|
||||
|
||||
|
@ -52,6 +51,7 @@ void register_pattern_select_procs (void);
|
|||
void register_parasite_procs (void);
|
||||
void register_drawable_procs (void);
|
||||
void register_procedural_db_procs (void);
|
||||
void register_layer_procs (void);
|
||||
|
||||
void
|
||||
internal_procs_init (void)
|
||||
|
@ -178,36 +178,8 @@ internal_procs_init (void)
|
|||
pcount/total_pcount);
|
||||
|
||||
/* Layer procedures */
|
||||
procedural_db_register (&layer_new_proc); pcount++;
|
||||
procedural_db_register (&layer_copy_proc); pcount++;
|
||||
procedural_db_register (&layer_create_mask_proc); pcount++;
|
||||
procedural_db_register (&layer_scale_proc); pcount++;
|
||||
procedural_db_register (&layer_resize_proc); pcount++;
|
||||
procedural_db_register (&layer_delete_proc); pcount++;
|
||||
procedural_db_register (&layer_translate_proc); pcount++;
|
||||
procedural_db_register (&layer_add_alpha_proc); pcount++;
|
||||
procedural_db_register (&layer_get_name_proc); pcount++;
|
||||
procedural_db_register (&layer_set_name_proc); pcount++;
|
||||
procedural_db_register (&layer_get_visible_proc); pcount++;
|
||||
procedural_db_register (&layer_set_visible_proc); pcount++;
|
||||
procedural_db_register (&layer_get_preserve_trans_proc); pcount++;
|
||||
procedural_db_register (&layer_set_preserve_trans_proc); pcount++;
|
||||
procedural_db_register (&layer_get_apply_mask_proc); pcount++;
|
||||
procedural_db_register (&layer_set_apply_mask_proc); pcount++;
|
||||
procedural_db_register (&layer_get_show_mask_proc); pcount++;
|
||||
procedural_db_register (&layer_set_show_mask_proc); pcount++;
|
||||
procedural_db_register (&layer_get_edit_mask_proc); pcount++;
|
||||
procedural_db_register (&layer_set_edit_mask_proc); pcount++;
|
||||
procedural_db_register (&layer_get_opacity_proc); pcount++;
|
||||
procedural_db_register (&layer_set_opacity_proc); pcount++;
|
||||
procedural_db_register (&layer_get_mode_proc); pcount++;
|
||||
procedural_db_register (&layer_set_mode_proc); pcount++;
|
||||
procedural_db_register (&layer_set_offsets_proc); pcount++;
|
||||
procedural_db_register (&layer_mask_proc); pcount++;
|
||||
procedural_db_register (&layer_is_floating_sel_proc); pcount++;
|
||||
procedural_db_register (&layer_get_tattoo_proc); pcount++;
|
||||
procedural_db_register (&layer_get_linked_proc); pcount++;
|
||||
procedural_db_register (&layer_set_linked_proc); pcount++;
|
||||
register_layer_procs ();
|
||||
pcount += 30;
|
||||
|
||||
app_init_update_status(NULL, _("Channel procedures"),
|
||||
pcount/total_pcount);
|
||||
|
|
|
@ -493,13 +493,13 @@ layer_create_mask (layer, add_mask_type)
|
|||
|
||||
switch (add_mask_type)
|
||||
{
|
||||
case WhiteMask:
|
||||
case ADD_WHITE_MASK:
|
||||
color_region (&maskPR, &white_mask);
|
||||
break;
|
||||
case BlackMask:
|
||||
case ADD_BLACK_MASK:
|
||||
color_region (&maskPR, &black_mask);
|
||||
break;
|
||||
case AlphaMask:
|
||||
case ADD_ALPHA_MASK:
|
||||
/* Extract the layer's alpha channel */
|
||||
if (layer_has_alpha (layer))
|
||||
{
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
#ifndef __LAYER_F_H__
|
||||
#define __LAYER_F_H__
|
||||
|
||||
typedef enum
|
||||
typedef enum /*< chop=ADD_ >*/
|
||||
{
|
||||
WhiteMask,
|
||||
BlackMask,
|
||||
AlphaMask
|
||||
ADD_WHITE_MASK,
|
||||
ADD_BLACK_MASK,
|
||||
ADD_ALPHA_MASK
|
||||
} AddMaskType;
|
||||
|
||||
typedef struct _GimpLayer GimpLayer;
|
||||
|
|
2365
app/layer_cmds.c
2365
app/layer_cmds.c
File diff suppressed because it is too large
Load Diff
|
@ -1,54 +0,0 @@
|
|||
/* The GIMP -- an image manipulation program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
#ifndef __LAYER_CMDS_H__
|
||||
#define __LAYER_CMDS_H__
|
||||
|
||||
#include "procedural_db.h"
|
||||
|
||||
extern ProcRecord layer_new_proc;
|
||||
extern ProcRecord layer_copy_proc;
|
||||
extern ProcRecord layer_create_mask_proc;
|
||||
extern ProcRecord layer_scale_proc;
|
||||
extern ProcRecord layer_resize_proc;
|
||||
extern ProcRecord layer_delete_proc;
|
||||
extern ProcRecord layer_translate_proc;
|
||||
extern ProcRecord layer_add_alpha_proc;
|
||||
extern ProcRecord layer_get_name_proc;
|
||||
extern ProcRecord layer_set_name_proc;
|
||||
extern ProcRecord layer_get_visible_proc;
|
||||
extern ProcRecord layer_set_visible_proc;
|
||||
extern ProcRecord layer_get_preserve_trans_proc;
|
||||
extern ProcRecord layer_set_preserve_trans_proc;
|
||||
extern ProcRecord layer_get_apply_mask_proc;
|
||||
extern ProcRecord layer_set_apply_mask_proc;
|
||||
extern ProcRecord layer_get_show_mask_proc;
|
||||
extern ProcRecord layer_set_show_mask_proc;
|
||||
extern ProcRecord layer_get_edit_mask_proc;
|
||||
extern ProcRecord layer_set_edit_mask_proc;
|
||||
extern ProcRecord layer_get_opacity_proc;
|
||||
extern ProcRecord layer_set_opacity_proc;
|
||||
extern ProcRecord layer_get_mode_proc;
|
||||
extern ProcRecord layer_set_mode_proc;
|
||||
extern ProcRecord layer_set_offsets_proc;
|
||||
extern ProcRecord layer_mask_proc;
|
||||
extern ProcRecord layer_is_floating_sel_proc;
|
||||
extern ProcRecord layer_get_tattoo_proc;
|
||||
extern ProcRecord layer_get_linked_proc;
|
||||
extern ProcRecord layer_set_linked_proc;
|
||||
|
||||
#endif /* __LAYER_CMDS_H__ */
|
|
@ -3473,7 +3473,7 @@ fill_white_callback (GtkWidget *w,
|
|||
AddMaskOptions *options;
|
||||
|
||||
options = (AddMaskOptions *) client_data;
|
||||
options->add_mask_type = WhiteMask;
|
||||
options->add_mask_type = ADD_WHITE_MASK;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -3483,7 +3483,7 @@ fill_black_callback (GtkWidget *w,
|
|||
AddMaskOptions *options;
|
||||
|
||||
options = (AddMaskOptions *) client_data;
|
||||
options->add_mask_type = BlackMask;
|
||||
options->add_mask_type = ADD_BLACK_MASK;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -3493,7 +3493,7 @@ fill_alpha_callback (GtkWidget *w,
|
|||
AddMaskOptions *options;
|
||||
|
||||
options = (AddMaskOptions *) client_data;
|
||||
options->add_mask_type = AlphaMask;
|
||||
options->add_mask_type = ADD_ALPHA_MASK;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -3528,7 +3528,7 @@ layers_dialog_add_mask_query (Layer *layer)
|
|||
/* the new options structure */
|
||||
options = (AddMaskOptions *) g_malloc (sizeof (AddMaskOptions));
|
||||
options->layer = layer;
|
||||
options->add_mask_type = WhiteMask;
|
||||
options->add_mask_type = ADD_WHITE_MASK;
|
||||
|
||||
/* the dialog */
|
||||
options->query_box = gtk_dialog_new ();
|
||||
|
|
|
@ -166,7 +166,7 @@ path_get_points_invoker (Argument *args)
|
|||
pptr = pl->data;
|
||||
|
||||
if (!strcmp (pname, pptr->name->str))
|
||||
break; /* Found the path */
|
||||
break; /* Found the path */
|
||||
|
||||
pl = pl->next;
|
||||
pptr = NULL;
|
||||
|
@ -179,24 +179,24 @@ path_get_points_invoker (Argument *args)
|
|||
|
||||
points_list = pptr->path_details;
|
||||
if (points_list)
|
||||
{
|
||||
num_pdetails = g_slist_length (points_list) * 3;
|
||||
{
|
||||
num_pdetails = g_slist_length (points_list) * 3;
|
||||
|
||||
pnts = g_new (gdouble, num_pdetails);
|
||||
pnts = g_new (gdouble, num_pdetails);
|
||||
|
||||
/* fill points and types in */
|
||||
while (points_list)
|
||||
{
|
||||
PATHPOINTP ppoint = points_list->data;
|
||||
pnts[pcount] = ppoint->x;
|
||||
pnts[pcount + 1] = ppoint->y;
|
||||
pnts[pcount + 2] = (gfloat) ppoint->type; /* Bit of fiddle but should be understandable why it was done */
|
||||
pcount += 3;
|
||||
points_list = points_list->next;
|
||||
}
|
||||
}
|
||||
/* fill points and types in */
|
||||
while (points_list)
|
||||
{
|
||||
PATHPOINTP ppoint = points_list->data;
|
||||
pnts[pcount] = ppoint->x;
|
||||
pnts[pcount + 1] = ppoint->y;
|
||||
pnts[pcount + 2] = (gfloat) ppoint->type; /* Bit of fiddle but should be understandable why it was done */
|
||||
pcount += 3;
|
||||
points_list = points_list->next;
|
||||
}
|
||||
}
|
||||
else
|
||||
success = FALSE;
|
||||
success = FALSE;
|
||||
}
|
||||
else
|
||||
success = FALSE;
|
||||
|
@ -422,7 +422,7 @@ path_set_points_invoker (Argument *args)
|
|||
success = FALSE;
|
||||
|
||||
if (success && !paths_set_path_points (gimage, pname, ptype, pclosed,
|
||||
numpoints, pnts))
|
||||
numpoints, pnts))
|
||||
success = FALSE;
|
||||
}
|
||||
|
||||
|
@ -494,8 +494,8 @@ path_stroke_current_invoker (Argument *args)
|
|||
if (plist && plist->bz_paths && plist->last_selected_row >= 0)
|
||||
{
|
||||
if ((pptr = (PATHP) g_slist_nth_data (plist->bz_paths,
|
||||
plist->last_selected_row)))
|
||||
|
||||
plist->last_selected_row)))
|
||||
|
||||
paths_stroke (gimage, plist, pptr); /* Found the path to stroke.. */
|
||||
else
|
||||
success = FALSE;
|
||||
|
@ -559,9 +559,9 @@ path_get_point_at_dist_invoker (Argument *args)
|
|||
if (plist && plist->bz_paths && plist->last_selected_row >= 0)
|
||||
{
|
||||
pptr = (PATHP) g_slist_nth_data (plist->bz_paths,
|
||||
plist->last_selected_row);
|
||||
plist->last_selected_row);
|
||||
success = paths_distance (pptr, distance, &x_point, &y_point,
|
||||
&gradient);
|
||||
&gradient);
|
||||
}
|
||||
else
|
||||
success = FALSE;
|
||||
|
@ -661,7 +661,7 @@ path_get_tattoo_invoker (Argument *args)
|
|||
pptr = pl->data;
|
||||
|
||||
if (!strcmp (pname, pptr->name->str))
|
||||
break; /* Found the path */
|
||||
break; /* Found the path */
|
||||
|
||||
pl = pl->next;
|
||||
pptr = NULL;
|
||||
|
|
|
@ -240,10 +240,10 @@ patterns_get_pattern_data_invoker (Argument *args)
|
|||
patternp = (GPatternP) list->data;
|
||||
|
||||
if (!strcmp (patternp->name, name))
|
||||
{
|
||||
success = TRUE;
|
||||
break;
|
||||
}
|
||||
{
|
||||
success = TRUE;
|
||||
break;
|
||||
}
|
||||
|
||||
list = list->next;
|
||||
}
|
||||
|
@ -254,7 +254,7 @@ patterns_get_pattern_data_invoker (Argument *args)
|
|||
if (success)
|
||||
{
|
||||
length = patternp->mask->height * patternp->mask->width *
|
||||
patternp->mask->bytes;
|
||||
patternp->mask->bytes;
|
||||
mask_data = g_new (gint8, length);
|
||||
g_memmove (mask_data, temp_buf_data (patternp->mask), length);
|
||||
}
|
||||
|
|
|
@ -238,7 +238,7 @@ procedural_db_print_entry (gpointer key,
|
|||
g_string_free (buf, TRUE);
|
||||
}
|
||||
|
||||
/* This really doesn't belong here, but it depends on your generated type_str
|
||||
/* This really doesn't belong here, but it depends on our generated type_str
|
||||
* array.
|
||||
*/
|
||||
const char *
|
||||
|
|
|
@ -155,10 +155,10 @@ text_fontname_invoker (Argument *args)
|
|||
if (success)
|
||||
{
|
||||
real_fontname = text_xlfd_insert_size (fontname, size, size_type,
|
||||
antialias);
|
||||
antialias);
|
||||
|
||||
text_layer = text_render (gimage, drawable, x, y, real_fontname, text,
|
||||
border, antialias);
|
||||
border, antialias);
|
||||
|
||||
if (text_layer == NULL)
|
||||
success = FALSE;
|
||||
|
@ -289,8 +289,8 @@ text_get_extents_fontname_invoker (Argument *args)
|
|||
real_fontname = text_xlfd_insert_size (fontname, size, size_type, FALSE);
|
||||
|
||||
success = text_get_extents (real_fontname, text,
|
||||
&width, &height,
|
||||
&ascent, &descent);
|
||||
&width, &height,
|
||||
&ascent, &descent);
|
||||
|
||||
g_free (real_fontname);
|
||||
}
|
||||
|
@ -428,13 +428,13 @@ text_invoker (Argument *args)
|
|||
argv[9].arg_type = PDB_STRING;
|
||||
argv[9].value.pdb_pointer =
|
||||
text_xlfd_create (foundry,
|
||||
family,
|
||||
weight,
|
||||
slant,
|
||||
set_width,
|
||||
spacing,
|
||||
registry,
|
||||
encoding);
|
||||
family,
|
||||
weight,
|
||||
slant,
|
||||
set_width,
|
||||
spacing,
|
||||
registry,
|
||||
encoding);
|
||||
|
||||
return text_fontname_invoker (argv);
|
||||
}
|
||||
|
@ -610,13 +610,13 @@ text_get_extents_invoker (Argument *args)
|
|||
argv[3].arg_type = PDB_STRING;
|
||||
argv[3].value.pdb_pointer =
|
||||
text_xlfd_create (foundry,
|
||||
family,
|
||||
weight,
|
||||
slant,
|
||||
set_width,
|
||||
spacing,
|
||||
registry,
|
||||
encoding);
|
||||
family,
|
||||
weight,
|
||||
slant,
|
||||
set_width,
|
||||
spacing,
|
||||
registry,
|
||||
encoding);
|
||||
|
||||
return text_get_extents_fontname_invoker (argv);
|
||||
}
|
||||
|
|
|
@ -376,7 +376,7 @@ bucket_fill_invoker (Argument *args)
|
|||
{
|
||||
gimage = drawable_gimage (GIMP_DRAWABLE (drawable));
|
||||
bucket_fill (gimage, drawable, fill_mode, paint_mode, opacity,
|
||||
threshold, sample_merged, x, y);
|
||||
threshold, sample_merged, x, y);
|
||||
}
|
||||
|
||||
return procedural_db_return_args (&bucket_fill_proc, success);
|
||||
|
@ -482,7 +482,7 @@ by_color_select_invoker (Argument *args)
|
|||
{
|
||||
gimage = drawable_gimage (GIMP_DRAWABLE (drawable));
|
||||
by_color_select (gimage, drawable, color, threshold, operation,
|
||||
antialias, feather, feather_radius, sample_merged);
|
||||
antialias, feather, feather_radius, sample_merged);
|
||||
}
|
||||
|
||||
return procedural_db_return_args (&by_color_select_proc, success);
|
||||
|
@ -586,7 +586,7 @@ clone_invoker (Argument *args)
|
|||
|
||||
if (success)
|
||||
success = clone_non_gui (drawable, src_drawable, clone_type, src_x, src_y,
|
||||
num_strokes, strokes);
|
||||
num_strokes, strokes);
|
||||
|
||||
return procedural_db_return_args (&clone_proc, success);
|
||||
}
|
||||
|
@ -689,8 +689,8 @@ color_picker_invoker (Argument *args)
|
|||
|
||||
if (success)
|
||||
success = pick_color (gimage, drawable, (int) x, (int) y,
|
||||
sample_merged, sample_average, average_radius,
|
||||
save_color);
|
||||
sample_merged, sample_average, average_radius,
|
||||
save_color);
|
||||
if (success)
|
||||
{
|
||||
color = g_new (guchar, 3);
|
||||
|
@ -896,7 +896,7 @@ crop_invoker (Argument *args)
|
|||
success = FALSE;
|
||||
else
|
||||
crop_image (gimage, offx, offy, offx + new_width, offy + new_height,
|
||||
FALSE, TRUE);
|
||||
FALSE, TRUE);
|
||||
}
|
||||
|
||||
return procedural_db_return_args (&crop_proc, success);
|
||||
|
@ -989,7 +989,7 @@ ellipse_select_invoker (Argument *args)
|
|||
|
||||
if (success)
|
||||
ellipse_select (gimage, (int) x, (int) y, (int) width, (int) height,
|
||||
operation, antialias, feather, feather_radius);
|
||||
operation, antialias, feather, feather_radius);
|
||||
|
||||
return procedural_db_return_args (&ellipse_select_proc, success);
|
||||
}
|
||||
|
@ -1282,7 +1282,7 @@ free_select_invoker (Argument *args)
|
|||
|
||||
if (success)
|
||||
free_select (gimage, num_segs, (FreeSelectPoint *) segs, operation,
|
||||
antialias, feather, feather_radius);
|
||||
antialias, feather, feather_radius);
|
||||
|
||||
return procedural_db_return_args (&free_select_proc, success);
|
||||
}
|
||||
|
@ -1387,7 +1387,7 @@ fuzzy_select_invoker (Argument *args)
|
|||
gimage = drawable_gimage (GIMP_DRAWABLE (drawable));
|
||||
|
||||
new = find_contiguous_region (gimage, drawable, antialias, threshold,
|
||||
x, y, sample_merged);
|
||||
x, y, sample_merged);
|
||||
old_fuzzy_mask = fuzzy_mask;
|
||||
fuzzy_mask = new;
|
||||
|
||||
|
@ -1503,7 +1503,7 @@ paintbrush_invoker (Argument *args)
|
|||
|
||||
if (success)
|
||||
success = paintbrush_non_gui (drawable, num_strokes, strokes, fade_out,
|
||||
method, gradient_length);
|
||||
method, gradient_length);
|
||||
|
||||
return procedural_db_return_args (&paintbrush_proc, success);
|
||||
}
|
||||
|
@ -1689,8 +1689,8 @@ perspective_invoker (Argument *args)
|
|||
|
||||
/* Perspective the buffer */
|
||||
new_tiles = perspective_tool_perspective (gimage, drawable, NULL,
|
||||
float_tiles, interpolation,
|
||||
matrix);
|
||||
float_tiles, interpolation,
|
||||
matrix);
|
||||
|
||||
/* Free the cut/copied buffer */
|
||||
tile_manager_destroy (float_tiles);
|
||||
|
@ -1834,7 +1834,7 @@ rect_select_invoker (Argument *args)
|
|||
|
||||
if (success)
|
||||
rect_select (gimage, (int) x, (int) y, (int) width, (int) height,
|
||||
operation, feather, feather_radius);
|
||||
operation, feather, feather_radius);
|
||||
|
||||
return procedural_db_return_args (&rect_select_proc, success);
|
||||
}
|
||||
|
@ -1943,7 +1943,7 @@ rotate_invoker (Argument *args)
|
|||
|
||||
/* Rotate the buffer */
|
||||
new_tiles = rotate_tool_rotate (gimage, drawable, NULL, angle,
|
||||
float_tiles, interpolation, matrix);
|
||||
float_tiles, interpolation, matrix);
|
||||
|
||||
/* Free the cut/copied buffer */
|
||||
tile_manager_destroy (float_tiles);
|
||||
|
@ -2057,10 +2057,10 @@ scale_invoker (Argument *args)
|
|||
scalex = scaley = 1.0;
|
||||
if (float_tiles->width)
|
||||
scalex = (trans_info[X1] - trans_info[X0]) /
|
||||
(double) float_tiles->width;
|
||||
(double) float_tiles->width;
|
||||
if (float_tiles->height)
|
||||
scaley = (trans_info[Y1] - trans_info[Y0]) /
|
||||
(double) float_tiles->height;
|
||||
(double) float_tiles->height;
|
||||
|
||||
/* Assemble the transformation matrix */
|
||||
gimp_matrix_identity (matrix);
|
||||
|
@ -2070,7 +2070,7 @@ scale_invoker (Argument *args)
|
|||
|
||||
/* Scale the buffer */
|
||||
new_tiles = scale_tool_scale (gimage, drawable, NULL, trans_info,
|
||||
float_tiles, interpolation, matrix);
|
||||
float_tiles, interpolation, matrix);
|
||||
|
||||
/* Free the cut/copied buffer */
|
||||
tile_manager_destroy (float_tiles);
|
||||
|
@ -2209,7 +2209,7 @@ shear_invoker (Argument *args)
|
|||
|
||||
/* Shear the buffer */
|
||||
new_tiles = shear_tool_shear (gimage, drawable, NULL, float_tiles,
|
||||
interpolation, matrix);
|
||||
interpolation, matrix);
|
||||
|
||||
/* Free the cut/copied buffer */
|
||||
tile_manager_destroy (float_tiles);
|
||||
|
|
|
@ -126,7 +126,7 @@ unit_new_invoker (Argument *args)
|
|||
|
||||
if (success)
|
||||
unit = gimp_unit_new (identifier, factor, digits, symbol, abbreviation,
|
||||
singular, plural);
|
||||
singular, plural);
|
||||
|
||||
return_args = procedural_db_return_args (&unit_new_proc, success);
|
||||
|
||||
|
|
|
@ -16,7 +16,8 @@ enum_headers = \
|
|||
../../app/lut_funcs.h \
|
||||
../../app/shear_tool.h \
|
||||
../../app/color_balance.h \
|
||||
../../app/hue_saturation.h
|
||||
../../app/hue_saturation.h \
|
||||
../../app/layerF.h
|
||||
|
||||
enums.pl: enumgen.pl $(enum_headers)
|
||||
cd $(srcdir) \
|
||||
|
|
|
@ -54,7 +54,7 @@ sub format_code_frag {
|
|||
else {
|
||||
$code =~ s/^/' ' x ($indent ? 4 : 2)/meg;
|
||||
}
|
||||
$code =~ s/^ {8}/\t/mg;
|
||||
while ($code =~ /^\t* {8}/m) { $code =~ s/^(\t*) {8}/$1\t/mg }
|
||||
$code .= "\n";
|
||||
|
||||
$code;
|
||||
|
|
|
@ -349,6 +349,17 @@ package Gimp::CodeGen::enums;
|
|||
CYAN_HUES => '4',
|
||||
BLUE_HUES => '5',
|
||||
MAGENTA_HUES => '6' }
|
||||
},
|
||||
AddMaskType =>
|
||||
{ contig => 1,
|
||||
header => 'layerF.h',
|
||||
symbols => [ qw(ADD_WHITE_MASK ADD_BLACK_MASK ADD_ALPHA_MASK) ],
|
||||
mapping => { ADD_WHITE_MASK => '0',
|
||||
ADD_BLACK_MASK => '1',
|
||||
ADD_ALPHA_MASK => '2' },
|
||||
nicks => { ADD_WHITE_MASK => 'WHITE_MASK',
|
||||
ADD_BLACK_MASK => 'BLACK_MASK',
|
||||
ADD_ALPHA_MASK => 'ALPHA_MASK' }
|
||||
}
|
||||
);
|
||||
|
||||
|
|
|
@ -19,4 +19,4 @@
|
|||
@groups = qw(gdisplay edit floating_sel undo palette gradient convert
|
||||
channel_ops gimprc drawable parasite paths gradient_select
|
||||
unit procedural_db brushes text_tool brush_select color
|
||||
misc tools channel patterns pattern_select);
|
||||
misc tools channel patterns pattern_select layer);
|
||||
|
|
|
@ -72,6 +72,10 @@ sub channel_set_prop_proc {
|
|||
desc => "The new channel $desc" }
|
||||
);
|
||||
|
||||
if ($type =~ /float/) {
|
||||
$inargs[1]->{desc} .= ' (%%desc%%)';
|
||||
}
|
||||
|
||||
$invoke{code} = $func ? "channel_set_$prop (channel, $prop);"
|
||||
: "channel->$prop = $prop;";
|
||||
|
||||
|
@ -162,10 +166,8 @@ HELP
|
|||
|
||||
&std_pdb_misc;
|
||||
|
||||
@inargs = (
|
||||
{ name => 'channel', type => 'channel',
|
||||
desc => 'The channel to copy' }
|
||||
);
|
||||
@inargs = ( &channel_arg );
|
||||
$inargs[0]->{desc} .= ' to copy';
|
||||
|
||||
@outargs = (
|
||||
{ name => 'channel_copy', type => 'channel', init => 1,
|
||||
|
@ -185,10 +187,8 @@ HELP
|
|||
|
||||
&std_pdb_misc;
|
||||
|
||||
@inargs = (
|
||||
{ name => 'channel', type => 'channel',
|
||||
desc => 'The channel to delete' }
|
||||
);
|
||||
@inargs = ( &channel_arg );
|
||||
$inargs[0]->{desc} .= ' to delete';
|
||||
|
||||
%invoke = ( code => 'channel_delete (channel);' );
|
||||
}
|
||||
|
|
|
@ -0,0 +1,557 @@
|
|||
# The GIMP -- an image manipulation program
|
||||
# Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
# "Perlized" from C source by Manish Singh <yosh@gimp.org>
|
||||
|
||||
sub layer_arg () {{
|
||||
name => 'layer',
|
||||
type => 'layer',
|
||||
desc => 'The layer'
|
||||
}}
|
||||
|
||||
sub layer_change_invoke {
|
||||
my ($undo, $code) = @_;
|
||||
my $indent = 6;
|
||||
|
||||
chomp $code;
|
||||
$code =~ s/\t/' ' x 8/eg;
|
||||
|
||||
if ($code =~ /^\s*{\s*\n.*\n\s*}\s*$/s) {
|
||||
$code =~ s/^\s*{\s*\n//s;
|
||||
$code =~ s/\n\s*}\s*$//s;
|
||||
$indent = 4;
|
||||
}
|
||||
|
||||
$code =~ s/^/' ' x $indent/meg;
|
||||
$code =~ s/^ {6}//s;
|
||||
while ($code =~ /^\t* {8}/m) { $code =~ s/^(\t*) {8}/$1\t/mg }
|
||||
|
||||
%invoke = (
|
||||
headers => [ qw("undo.h" "floating_sel.h") ],
|
||||
vars => [ 'GimpImage *gimage', 'Layer *floating_layer' ],
|
||||
code => <<CODE
|
||||
{
|
||||
if ((gimage = GIMP_DRAWABLE(layer)->gimage))
|
||||
{
|
||||
floating_layer = gimage_floating_sel (gimage);
|
||||
|
||||
undo_push_group_start (gimage, ${undo}_UNDO);
|
||||
|
||||
if (floating_layer)
|
||||
floating_sel_relax (floating_layer, TRUE);
|
||||
|
||||
$code
|
||||
|
||||
if (floating_layer)
|
||||
floating_sel_rigor (floating_layer, TRUE);
|
||||
|
||||
undo_push_group_end (gimage);
|
||||
}
|
||||
else
|
||||
success = FALSE;
|
||||
}
|
||||
CODE
|
||||
);
|
||||
}
|
||||
|
||||
sub layer_dim_proc {
|
||||
my ($op, $morehelp, @args) = @_;
|
||||
|
||||
$blurb = ucfirst($op) . ' the layer to the specified extents.';
|
||||
|
||||
my $ops = $op =~ /e$/ ? "${op}s" : "${op}es";
|
||||
$help = <<HELP;
|
||||
This procedure $ops the layer so that it's new width and height are equal to
|
||||
the supplied parameters. $morehelp This operation only works if the layer has
|
||||
been added to an image.
|
||||
HELP
|
||||
|
||||
&std_pdb_misc;
|
||||
|
||||
@inargs = (
|
||||
&layer_arg,
|
||||
{ name => 'new_width', type => '0 < int32',
|
||||
desc => 'New layer width: (%%desc%%)' },
|
||||
{ name => 'new_height', type => '0 < int32',
|
||||
desc => 'New layer height: (%%desc%%)' },
|
||||
);
|
||||
push @inargs, @args;
|
||||
|
||||
my $args = "";
|
||||
foreach (@args) {
|
||||
$args .= ', ' if $args;
|
||||
$args .= $_->{name};
|
||||
}
|
||||
|
||||
&layer_change_invoke("LAYER_@{[ uc($op) ]}",
|
||||
"layer_$op (layer, new_width, new_height, $args);");
|
||||
}
|
||||
|
||||
sub layer_get_prop_proc {
|
||||
my ($prop, $type, $desc, $func) = @_;
|
||||
|
||||
$blurb = "Get the $desc of the specified layer.";
|
||||
|
||||
$help = "This procedure returns the specified layer's $desc.";
|
||||
|
||||
&std_pdb_misc;
|
||||
|
||||
@inargs = ( &layer_arg );
|
||||
|
||||
@outargs = (
|
||||
{ name => $prop, type => $type,
|
||||
desc => "The layer $desc", no_declare => 1 }
|
||||
);
|
||||
|
||||
my $alias = $func ? "layer_get_$prop (layer)" : "layer->$prop";
|
||||
$alias = "g_strdup ($alias)" if $type eq 'string';
|
||||
$outargs[0]->{alias} .= "$alias";
|
||||
|
||||
if ($type eq 'color') {
|
||||
$outargs[0]->{init} = 1;
|
||||
delete @{$outargs[0]}{qw(alias no_declare)};
|
||||
|
||||
$invoke{headers} = [ qw("gimpimage.h") ];
|
||||
|
||||
$invoke{code} = "{\n color = g_new (guchar, 3);\n";
|
||||
foreach (map { "${_}_PIX" } qw(RED GREEN BLUE)) {
|
||||
$invoke{code} .= " $prop\[$_] = layer->col[$_];\n";
|
||||
}
|
||||
$invoke{code} .= "}\n";
|
||||
}
|
||||
}
|
||||
|
||||
sub layer_set_prop_proc {
|
||||
my ($prop, $type, $desc, $func) = @_;
|
||||
|
||||
$blurb = "Set the $desc of the specified layer.";
|
||||
|
||||
$help = "This procedure sets the specified layer's $desc.";
|
||||
|
||||
&std_pdb_misc;
|
||||
|
||||
@inargs = (
|
||||
&layer_arg,
|
||||
{ name => $prop, type => $type,
|
||||
desc => "The new layer $desc" }
|
||||
);
|
||||
|
||||
if ($type =~ /float/) {
|
||||
$inargs[1]->{desc} .= ' (%%desc%%)';
|
||||
}
|
||||
|
||||
$invoke{code} = $func ? "layer_set_$prop (layer, $prop);"
|
||||
: "layer->$prop = $prop;";
|
||||
|
||||
if ($type eq 'color') {
|
||||
%invoke = (
|
||||
vars => [ 'int i' ],
|
||||
code => <<CODE
|
||||
for (i = 0; i < 3; i++)
|
||||
layer->col[i] = $prop\[i];
|
||||
CODE
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
sub layer_accessors {
|
||||
my ($prop, $type, $desc, $func, $setting, $extra) = @_;
|
||||
my (@extra, %extra); my $once = 0;
|
||||
|
||||
my $change = "s/ ($desc)/'s \$1 setting/";
|
||||
(my $common = "\n; foreach (\$blurb, \$help) { $change }") =~ s/'s//;
|
||||
|
||||
my %modify = (
|
||||
get => "$common \$outargs[0]->{desc} =~ $change;",
|
||||
set => "$common \$inargs[1]->{desc} =~ $change;",
|
||||
);
|
||||
|
||||
ref($extra) ? (@extra = @$extra) : (@extra = ($extra, $extra));
|
||||
%extra = map { $once++ ? 'set' : 'get', $_ ? $_ : "" } @extra;
|
||||
|
||||
foreach (keys %extra) {
|
||||
my $proc = "layer_${_}_$prop";
|
||||
|
||||
push @procs, $proc;
|
||||
|
||||
eval <<SUB;
|
||||
sub @{[ scalar caller ]}::$proc {
|
||||
\&layer_${_}_prop_proc('$prop', '$type', '$desc', $func);
|
||||
$extra{$_}
|
||||
@{[ $setting ? $modify{$_} : "" ]}
|
||||
}
|
||||
SUB
|
||||
}
|
||||
}
|
||||
|
||||
sub layer_new {
|
||||
$blurb = 'Create a new layer.';
|
||||
|
||||
$help = <<'HELP';
|
||||
This procedure creates a new layer with the specified width, height, and type.
|
||||
Name, opacity, and mode are also supplied parameters. The new layer still needs
|
||||
to be added to the image, as this is not automatic. Add the new layer with the
|
||||
'gimp_image_add_layer' command. Other attributes such as layer mask modes, and
|
||||
offsets should be set with explicit procedure calls.
|
||||
HELP
|
||||
|
||||
&std_pdb_misc;
|
||||
|
||||
@inargs = (
|
||||
&std_image_arg,
|
||||
{ name => 'width', type => '0 < int32',
|
||||
desc => 'The layer width: (%%desc%%)' },
|
||||
{ name => 'height', type => '0 < int32',
|
||||
desc => 'The layer height: (%%desc%%)' },
|
||||
{ name => 'type', type => 'enum GimpImageType',
|
||||
desc => 'The layer type: { %%desc%% }' },
|
||||
{ name => 'name', type => 'string',
|
||||
desc => 'The layer name' },
|
||||
{ name => 'opacity', type => '0 <= float <= 100',
|
||||
desc => 'The layer opacity: (%%desc%%)', alias => 'opacity_arg' },
|
||||
{ name => 'mode', type => &std_layer_mode_enum,
|
||||
desc => 'The layer combination mode: { %%desc%% }' }
|
||||
);
|
||||
$inargs[0]->{desc} .= ' to which to add the layer';
|
||||
|
||||
@outargs = (
|
||||
{ name => 'layer', type => 'layer',
|
||||
desc => 'The newly created layer', init => 1 }
|
||||
);
|
||||
|
||||
%invoke = (
|
||||
vars => [ 'int opacity' ],
|
||||
code => <<'CODE'
|
||||
{
|
||||
opacity = (int) ((opacity_arg * 255) / 100);
|
||||
layer = layer_new (gimage, width, height, type, name, opacity, mode);
|
||||
success = layer != NULL;
|
||||
}
|
||||
CODE
|
||||
);
|
||||
}
|
||||
|
||||
sub layer_copy {
|
||||
$blurb = 'Copy a layer.';
|
||||
|
||||
$help = <<'HELP';
|
||||
This procedure copies the specified layer and returns the copy. The newly
|
||||
copied layer is for use within the original layer's image. It should not be
|
||||
subsequently added to any other image. The copied layer can optionally have an
|
||||
added alpha channel. This is useful if the background layer in an image is
|
||||
being copied and added to the same image.
|
||||
HELP
|
||||
|
||||
&std_pdb_misc;
|
||||
|
||||
@inargs = (
|
||||
&layer_arg,
|
||||
{ name => 'add_alpha', type => 'boolean',
|
||||
desc => 'Add an alpha channel to the copied layer' }
|
||||
);
|
||||
$inargs[0]->{desc} .= ' to copy';
|
||||
|
||||
@outargs = (
|
||||
{ name => 'layer_copy', type => 'layer', init => 1,
|
||||
desc => 'The newly copied layer', alias => 'copy' }
|
||||
);
|
||||
|
||||
%invoke = (
|
||||
code => 'success = (copy = layer_copy (layer, add_alpha)) != NULL;'
|
||||
);
|
||||
}
|
||||
|
||||
sub layer_create_mask {
|
||||
$blurb = 'Create a layer mask for the specified specified layer.';
|
||||
|
||||
$help = <<'HELP';
|
||||
This procedure creates a layer mask for the specified layer. Layer masks serve
|
||||
as an additional alpha channel for a layer. Three different types of masks are
|
||||
allowed initially: completely white masks (which will leave the layer fully
|
||||
visible), completely black masks (which will give the layer complete
|
||||
transparency, and the layer's already existing alpha channel (which will leave
|
||||
the layer fully visible, but which may be more useful than a white mask). The
|
||||
layer mask still needs to be added to the layer. This can be done with a call
|
||||
to 'gimage_add_layer_mask'.
|
||||
HELP
|
||||
|
||||
&std_pdb_misc;
|
||||
|
||||
@inargs = (
|
||||
&layer_arg,
|
||||
{ name => 'mask_type', type => 'enum AddMaskType',
|
||||
desc => 'The type of mask: { %%desc%% }' }
|
||||
);
|
||||
$inargs[0]->{desc} .= ' to which to add the mask';
|
||||
|
||||
@outargs = (
|
||||
{ name => 'mask', type => 'channel',
|
||||
desc => 'The newly created mask', init => 1 }
|
||||
);
|
||||
|
||||
%invoke = (
|
||||
code => <<'CODE'
|
||||
success = (mask = layer_create_mask (layer, mask_type)) != NULL;
|
||||
CODE
|
||||
);
|
||||
}
|
||||
|
||||
sub layer_scale {
|
||||
my $arg = { name => 'local_origin', type => 'boolean',
|
||||
desc => 'Use a local origin (as opposed to the image origin)' };
|
||||
|
||||
&layer_dim_proc('scale', <<'HELP', $arg);
|
||||
The "local_origin" parameter specifies whether to scale from the center of the
|
||||
layer, or from the image origin.
|
||||
HELP
|
||||
}
|
||||
|
||||
sub layer_resize {
|
||||
my @args;
|
||||
foreach (qw(x y)) {
|
||||
push @args, { name => "off$_", type => 'int32',
|
||||
desc => "$_ offset between upper left corner of old and
|
||||
new layers: (new - old)" }
|
||||
}
|
||||
|
||||
&layer_dim_proc('resize', <<'HELP', @args);
|
||||
Offsets are also provided which describe the position of the previous layer's
|
||||
content.
|
||||
HELP
|
||||
}
|
||||
|
||||
sub layer_delete {
|
||||
$blurb = 'Delete a layer.';
|
||||
|
||||
$help = <<'HELP';
|
||||
This procedure deletes the specified layer. This does not need to be done if
|
||||
a gimage containing this layer was already deleted.
|
||||
HELP
|
||||
|
||||
&std_pdb_misc;
|
||||
|
||||
@inargs = ( &layer_arg );
|
||||
$inargs[0]->{desc} .= ' to delete';
|
||||
|
||||
%invoke = ( code => 'layer_delete (layer);' );
|
||||
}
|
||||
|
||||
sub layer_translate {
|
||||
$blurb = 'Translate the layer by the specified offsets.';
|
||||
|
||||
$help = <<'HELP';
|
||||
This procedure translates the layer by the amounts specified in the x and y
|
||||
arguments. These can be negative, and are considered offsets from the current
|
||||
position. This command only works if the layer has been added to an image. All
|
||||
additional layers contained in the image which have the linked flag set to TRUE
|
||||
w ill also be translated by the specified offsets.
|
||||
HELP
|
||||
|
||||
&std_pdb_misc;
|
||||
|
||||
@inargs = ( &layer_arg );
|
||||
foreach (qw(x y)) {
|
||||
push @inargs, { name => "off$_", type => 'int32',
|
||||
desc => "Offset in $_ direction" }
|
||||
}
|
||||
|
||||
&layer_change_invoke('LINKED_LAYER', <<'CODE');
|
||||
{
|
||||
layer_list = gimage->layers;
|
||||
while (layer_list)
|
||||
{
|
||||
tmp_layer = (Layer *) layer_list->data;
|
||||
if ((tmp_layer == layer) || tmp_layer->linked)
|
||||
layer_translate (tmp_layer, offx, offy);
|
||||
layer_list = layer_list->next;
|
||||
}
|
||||
}
|
||||
CODE
|
||||
push @{$invoke{vars}}, 'Layer *tmp_layer', 'GSList *layer_list';
|
||||
}
|
||||
|
||||
sub layer_add_alpha {
|
||||
$blurb = <<'BLURB';
|
||||
Add an alpha channel to the layer if it doesn't already have one.
|
||||
BLURB
|
||||
|
||||
$help = <<'HELP';
|
||||
This procedure adds an additional component to the specified layer if it does
|
||||
not already possess an alpha channel. An alpha channel makes it possible to
|
||||
move a layer from the bottom of the layer stack and to clear and erase to
|
||||
transparency, instead of the background color. This transforms images of type
|
||||
RGB to RGBA, GRAY to GRAYA, and INDEXED to INDEXEDA.
|
||||
HELP
|
||||
|
||||
&std_pdb_misc;
|
||||
|
||||
@inargs = ( &layer_arg );
|
||||
|
||||
%invoke = ( code => 'layer_add_alpha (layer);' );
|
||||
}
|
||||
|
||||
sub layer_set_offsets {
|
||||
&layer_translate;
|
||||
|
||||
$blurb = 'Set the layer offsets.';
|
||||
|
||||
$help = <<'HELP';
|
||||
This procedure sets the offsets for the specified layer. The offsets are
|
||||
relative to the image origin and can be any values. This operation is valid
|
||||
only on layers which have been added to an image.
|
||||
HELP
|
||||
|
||||
foreach (qw(x y)) {
|
||||
$invoke{code} =~
|
||||
s/, (off$_)/,\n\t\t\t ($1 - GIMP_DRAWABLE (layer)->offset_$_)/;
|
||||
}
|
||||
}
|
||||
|
||||
sub layer_mask {
|
||||
$blurb = "Get the specified layer's mask if it exists.";
|
||||
|
||||
$help = <<'HELP';
|
||||
This procedure returns the specified layer's mask. If there is no layer mask,
|
||||
the procedure fails.
|
||||
HELP
|
||||
|
||||
&std_pdb_misc;
|
||||
|
||||
@inargs = ( &layer_arg );
|
||||
|
||||
@outargs = (
|
||||
{ name => 'mask', type => 'channel',
|
||||
desc => 'The layer mask',
|
||||
alias => 'layer->mask', no_declare => 1 }
|
||||
);
|
||||
|
||||
%invoke = ( code => 'success = layer->mask ? TRUE : FALSE;' );
|
||||
}
|
||||
|
||||
sub layer_is_floating_sel {
|
||||
$blurb = 'Is the specified layer a floating selection?';
|
||||
|
||||
$help = <<'HELP';
|
||||
This procedure returns whether the layer is a floating selection. Floating
|
||||
selections are special cases of layers which are attached to a specific
|
||||
drawable.
|
||||
HELP
|
||||
|
||||
&std_pdb_misc;
|
||||
|
||||
@inargs = ( &layer_arg );
|
||||
|
||||
@outargs = (
|
||||
{ name => 'is_floating_sel', type => 'boolean',
|
||||
desc => 'Non-zero if the layer is a floating selection',
|
||||
alias => 'layer_is_floating_sel (layer)', no_declare => 1 }
|
||||
);
|
||||
}
|
||||
|
||||
&layer_accessors('name', 'string', 'name', 1, 0,
|
||||
[ undef, '$inargs[1]->{no_success} = 1' ]);
|
||||
|
||||
&layer_accessors('visible', 'boolean', 'visibility', 0, 0,
|
||||
[ '$outargs[0]->{alias} =~ s/(layer)/GIMP_DRAWABLE ($1)/',
|
||||
'$invoke{code} =~ s/(layer)/GIMP_DRAWABLE ($1)/' ]);
|
||||
|
||||
&layer_accessors('preserve_trans', 'boolean', 'preserve transperancy', 0, 1);
|
||||
|
||||
&layer_accessors('apply_mask', 'boolean', 'apply mask', 0, 1,
|
||||
[ <<'CODE1', <<'CODE2' ]);
|
||||
$help .= <<'HELP';
|
||||
If the value is non-zero, then the layer mask for this layer is currently
|
||||
being composited with the layer's alpha channel.
|
||||
HELP
|
||||
CODE1
|
||||
$help .= <<'HELP';
|
||||
This controls whether the layer's mask is currently affecting the alpha
|
||||
channel. If there is no layer mask, this function will return an error.
|
||||
HELP
|
||||
CODE2
|
||||
|
||||
&layer_accessors('show_mask', 'boolean', 'show mask', 0, 1,
|
||||
[ <<'CODE1', <<'CODE2' ]);
|
||||
$help .= <<'HELP';
|
||||
If the value is non-zero, then the layer mask for this layer is currently
|
||||
being shown instead of the layer.
|
||||
HELP
|
||||
CODE1
|
||||
$help .= <<'HELP';
|
||||
This controls whether the layer or it's mask is visible. Non-zero values
|
||||
indicate that the mask should be visible. If the layer has no mask, then this
|
||||
function returns an error.
|
||||
HELP
|
||||
CODE2
|
||||
|
||||
&layer_accessors('edit_mask', 'boolean', 'show mask', 0, 1,
|
||||
[ <<'CODE1', <<'CODE2' ]);
|
||||
$help .= <<'HELP';
|
||||
If the value is non-zero, then the layer mask for this layer is currently
|
||||
active, and not the layer.
|
||||
HELP
|
||||
CODE1
|
||||
$help .= <<'HELP';
|
||||
This controls whether the layer or it's mask is currently active for editing.
|
||||
If the specified layer has no layer mask, then this procedure will return an
|
||||
error.
|
||||
HELP
|
||||
CODE2
|
||||
|
||||
&layer_accessors('opacity', '0 <= float <= 100', 'opacity', 0, 0,
|
||||
[ '$outargs[0]->{alias} =
|
||||
"(layer->opacity * 100.0) / 255.0"',
|
||||
'$invoke{code} =~
|
||||
s%(opacity);$%(int) (($1 * 255) / 100);%' ]);
|
||||
|
||||
&layer_accessors('mode', &std_layer_mode_enum, 'combination mode', 0, 0);
|
||||
|
||||
&layer_accessors('linked', 'int32', 'linked state', 0, 0,
|
||||
<<'CODE');
|
||||
$author = $copyright = 'Wolfgang Hofer';
|
||||
$date = '1998';
|
||||
|
||||
if (scalar @outargs) {
|
||||
$outargs[0]->{desc} .= ' (for moves)'
|
||||
}
|
||||
CODE
|
||||
|
||||
&layer_accessors('tattoo', 'tattoo', 'tattoo', 1, 0,
|
||||
<<'CODE');
|
||||
$blurb = 'Returns the tattoo associated with the specified layer.';
|
||||
|
||||
$help = <<'HELP';
|
||||
This procedure returns the tattoo associated with the specified layer. A tattoo
|
||||
is a unique and permanent identifier attached to a layer that can be used to
|
||||
uniquely identify a layer within an image even between sessions
|
||||
HELP
|
||||
|
||||
$author = $copyright = 'Jay Cox';
|
||||
$date = '1998';
|
||||
CODE
|
||||
|
||||
@headers = qw("layer.h" "layer_pvt.h");
|
||||
|
||||
$#procs--;
|
||||
unshift @procs, qw(layer_new layer_copy layer_create_mask layer_scale
|
||||
layer_resize layer_delete layer_translate layer_add_alpha
|
||||
layer_set_offsets layer_mask layer_is_floating_sel);
|
||||
%exports = (app => [@procs]);
|
||||
|
||||
$desc = 'Layer';
|
||||
|
||||
1;
|
|
@ -567,7 +567,7 @@ procedural_db_print_entry (gpointer key,
|
|||
g_string_free (buf, TRUE);
|
||||
}
|
||||
|
||||
/* This really doesn't belong here, but it depends on your generated type_str
|
||||
/* This really doesn't belong here, but it depends on our generated type_str
|
||||
* array.
|
||||
*/
|
||||
const char *
|
||||
|
|
Loading…
Reference in New Issue