1
# The GIMP -- an image manipulation program
1
# GIMP - The GNU Image Manipulation Program
2
2
# Copyright (C) 1995 Spencer Kimball and Peter Mattis
4
4
# This program is free software; you can redistribute it and/or modify
41
if (gimp->current_plug_in && gimp->current_plug_in->open)
43
success = plug_in_context_push (gimp->current_plug_in);
41
GimpPlugIn *plug_in = gimp->plug_in_manager->current_plug_in;
43
if (plug_in && plug_in->open)
44
success = gimp_plug_in_context_push (plug_in);
55
53
$blurb = 'Pops the topmost context from the plug-in\'s context stack.';
58
This procedure creates a new context and makes it the current context for the
56
This procedure removes the topmost context from the plug-in's context
57
stack. The context that was active before the corresponding call to
58
gimp_context_push() becomes the new current context of the plug-in.
67
if (gimp->current_plug_in && gimp->current_plug_in->open)
69
success = plug_in_context_pop (gimp->current_plug_in);
66
GimpPlugIn *plug_in = gimp->plug_in_manager->current_plug_in;
68
if (plug_in && plug_in->open)
69
success = gimp_plug_in_context_pop (plug_in);
77
sub context_get_paint_method {
78
$blurb = 'Retrieve the currently active paint method.';
81
This procedure returns the name of the currently active paint method.
84
&mitch_pdb_misc('2005', '2.4');
87
{ name => 'name', type => 'string',
88
desc => 'The name of the active paint method' }
94
GimpPaintInfo *paint_info = gimp_context_get_paint_info (context);
97
name = g_strdup (gimp_object_get_name (GIMP_OBJECT (paint_info)));
105
sub context_set_paint_method {
106
$blurb = 'Set the specified paint method as the active paint method.';
109
This procedure allows the active paint method to be set by specifying
110
its name. The name is simply a string which corresponds to one of the
111
names of the available paint methods. If there is no matching method
112
found, this procedure will return an error. Otherwise, the specified
113
method becomes active and will be used in all subsequent paint
117
&mitch_pdb_misc('2005', '2.4');
120
{ name => 'name', type => 'string',
121
desc => 'The name of the paint method' }
127
GimpPaintInfo *paint_info = (GimpPaintInfo *)
128
gimp_container_get_child_by_name (gimp->paint_info_list, name);
131
gimp_context_set_paint_info (context, paint_info);
92
151
{ name => 'foreground', type => 'color',
93
desc => "The foreground color", alias => 'color',
152
desc => 'The foreground color', void_ret => 1 }
97
%invoke = ( code => 'gimp_context_get_foreground (context, &color);' );
158
gimp_context_get_foreground (context, &foreground);
159
gimp_rgb_set_alpha (&foreground, 1.0);
100
165
sub context_set_foreground {
112
177
{ name => 'foreground', type => 'color',
113
desc => "The foreground color", alias => 'color',
178
desc => 'The foreground color', void_ret => 1 }
120
gimp_rgb_set_alpha (&color, 1.0);
121
gimp_context_set_foreground (context, &color);
184
gimp_rgb_set_alpha (&foreground, 1.0);
185
gimp_context_set_foreground (context, &foreground);
139
203
{ name => 'background', type => 'color',
140
desc => "The background color", alias => 'color',
204
desc => 'The background color', void_ret => 1 }
144
%invoke = ( code => 'gimp_context_get_background (context, &color);' );
210
gimp_context_get_background (context, &background);
211
gimp_rgb_set_alpha (&background, 1.0);
147
217
sub context_set_background {
159
229
{ name => 'background', type => 'color',
160
desc => "The background color", alias => 'color',
230
desc => 'The background color', void_ret => 1 }
167
gimp_rgb_set_alpha (&color, 1.0);
168
gimp_context_set_background (context, &color);
236
gimp_rgb_set_alpha (&background, 1.0);
237
gimp_context_set_background (context, &background);
213
294
{ name => 'opacity', type => '0 <= float <= 100',
214
desc => 'The opacity: %%desc%%',
215
alias => 'gimp_context_get_opacity (context) * 100.0',
295
desc => 'The opacity' }
301
opacity = gimp_context_get_opacity (context) * 100.0;
231
318
{ name => 'opacity', type => '0 <= float <= 100',
232
desc => 'The opacity: %%desc%%' }
319
desc => 'The opacity' }
235
%invoke = ( code => 'gimp_context_set_opacity (context, opacity / 100.0);' );
325
gimp_context_set_opacity (context, opacity / 100.0);
238
331
sub context_get_paint_mode {
250
343
{ name => 'paint_mode', type => 'enum GimpLayerModeEffects',
251
desc => 'The paint mode: { %%desc%% }',
252
alias => 'gimp_context_get_paint_mode (context)',
344
desc => 'The paint mode' }
350
paint_mode = gimp_context_get_paint_mode (context);
267
366
{ name => 'paint_mode', type => 'enum GimpLayerModeEffects',
268
desc => 'The paint mode: { %%desc%% }' }
367
desc => 'The paint mode' }
271
%invoke = ( code => 'gimp_context_set_paint_mode (context, paint_mode);' );
373
gimp_context_set_paint_mode (context, paint_mode);
274
379
sub context_get_brush {
275
380
$blurb = 'Retrieve the currently active brush.';
277
382
$help = <<'HELP';
278
This procedure returns the nme of the currently active brush.
383
This procedure returns the name of the currently active brush.
279
384
All paint operations and stroke operations use this brush to control
280
385
the application of paint to the image.
286
391
{ name => 'name', type => 'string',
287
desc => 'The name of the active brush',
288
alias => 'g_strdup (gimp_object_get_name (GIMP_OBJECT (brush)))',
392
desc => 'The name of the active brush' }
293
vars => [ 'GimpBrush *brush' ],
294
code => 'success = (brush = gimp_context_get_brush (context)) != NULL;'
398
GimpBrush *brush = gimp_context_get_brush (context);
401
name = g_strdup (gimp_object_get_name (GIMP_OBJECT (brush)));
312
423
{ name => 'name', type => 'string',
313
desc => 'The name o the brush' }
424
desc => 'The name of the brush' }
317
vars => [ 'GimpBrush *brush' ],
320
brush = (GimpBrush *)
430
GimpBrush *brush = (GimpBrush *)
321
431
gimp_container_get_child_by_name (gimp->brush_factory->container, name);
344
454
{ name => 'name', type => 'string',
345
desc => 'The name of the active pattern',
346
alias => 'g_strdup (gimp_object_get_name (GIMP_OBJECT (pattern)))',
455
desc => 'The name of the active pattern' }
351
vars => [ 'GimpPattern *pattern' ],
352
code => 'success = (pattern = gimp_context_get_pattern (context)) != NULL;'
461
GimpPattern *pattern = gimp_context_get_pattern (context);
464
name = g_strdup (gimp_object_get_name (GIMP_OBJECT (pattern)));
375
vars => [ 'GimpPattern *pattern' ],
378
pattern = (GimpPattern *)
493
GimpPattern *pattern = (GimpPattern *)
379
494
gimp_container_get_child_by_name (gimp->pattern_factory->container, name);
400
515
{ name => 'name', type => 'string',
401
desc => 'The name of the active gradient',
402
alias => 'g_strdup (gimp_object_get_name (GIMP_OBJECT (gradient)))',
516
desc => 'The name of the active gradient' }
407
vars => [ 'GimpGradient *gradient' ],
408
code => 'success = (gradient = gimp_context_get_gradient (context)) != NULL;'
522
GimpGradient *gradient = gimp_context_get_gradient (context);
525
name = g_strdup (gimp_object_get_name (GIMP_OBJECT (gradient)));
431
vars => [ 'GimpGradient *gradient' ],
434
gradient = (GimpGradient *)
554
GimpGradient *gradient = (GimpGradient *)
435
555
gimp_container_get_child_by_name (gimp->gradient_factory->container, name);
456
576
{ name => 'name', type => 'string',
457
desc => 'The name of the active palette',
458
alias => 'g_strdup (gimp_object_get_name (GIMP_OBJECT (palette)))',
577
desc => 'The name of the active palette' }
463
vars => [ 'GimpPalette *palette' ],
464
code => 'success = (palette = gimp_context_get_palette (context)) != NULL;'
583
GimpPalette *palette = gimp_context_get_palette (context);
586
name = g_strdup (gimp_object_get_name (GIMP_OBJECT (palette)));
487
vars => [ 'GimpPalette *palette' ],
490
palette = (GimpPalette *)
615
GimpPalette *palette = (GimpPalette *)
491
616
gimp_container_get_child_by_name (gimp->palette_factory->container, name);
512
637
{ name => 'name', type => 'string',
513
desc => 'The name of the active font',
514
alias => 'g_strdup (gimp_object_get_name (GIMP_OBJECT (font)))',
638
desc => 'The name of the active font' }
519
vars => [ 'GimpFont *font' ],
520
code => 'success = (font = gimp_context_get_font (context)) != NULL;'
644
GimpFont *font = gimp_context_get_font (context);
647
name = g_strdup (gimp_object_get_name (GIMP_OBJECT (font)));
558
@headers = qw("core/gimp.h" "core/gimpcontainer.h" "core/gimpcontext.h"
689
@headers = qw("core/gimp.h"
690
"core/gimpcontainer.h"
559
692
"core/gimpdatafactory.h"
560
"plug-in/plug-in.h" "plug-in/plug-in-context.h");
693
"plug-in/gimpplugin.h"
694
"plug-in/gimpplugin-context.h"
695
"plug-in/gimppluginmanager.h");
562
697
@procs = qw(context_push context_pop
698
context_get_paint_method context_set_paint_method
563
699
context_get_foreground context_set_foreground
564
700
context_get_background context_set_background
565
701
context_set_default_colors context_swap_colors
570
706
context_get_gradient context_set_gradient
571
707
context_get_palette context_set_palette
572
708
context_get_font context_set_font);
573
710
%exports = (app => [@procs], lib => [@procs]);
575
712
$desc = 'Context';