Next: Script-Fu Logos
Up: Script-Fu: Graphic Art for
Previous: Example Scripts
A computer application is generally a stand-alone program, whose
source code contains everything necessary for full functionality. In
this common case, adding additional features to the application
requires that the original source code be modified, recompiled, and
finally redistributed to its users. This process of introducing new
features is highly prone to programmer error, often resulting in a
host of new problems, sometimes even with pre-existing features. A
superior method for extending the functionality of an application is
through extension modules: independent applications which implement
additional features and then make them available to the main
application.
The GIMP and its extensions communicate by invoking commands from a
database of procedures. Procedures are pieces of functionality
provided by GIMP, its plug-ins, and its extensions. Procedures take
as input a list of arguments, execute based on the values of those
arguments, and finally return a list of values. There are procedures
for every piece of internal functionality in the GIMP as well as for
every plug-in written to date. In total, there are over 275
procedures stored in GIMP's ``procedural database''. The following are
examples of procedures called by the simple script from Appendix A:
- gimp_image_new width, height, type
Creates a new image, undisplayed with the specified extents and type.
A layer should be created and added before this image is displayed, or
subsequent calls to 'gimp_display_new' with this image as an argument
will fail. Layers can be created using the 'gimp_layer_new' commands.
They can be added to an image using the 'gimp_image_add_layer'
command.
Inputs
- width (PDB_INT32)-The width of the image
- height (PDB_INT32)-The height of the image
- type (PDB_INT32)-The type of image: { RGB (0), GRAY (1), INDEXED (2) }
Outputs
- image (PDB_IMAGE)-The ID of the newly created image
- gimp_text image, drawable, x, y, text, border, antialias, size, size_type, foundry, family, weight, slant, set_width, spacing
This tool requires font information in the form of seven parameters:
{size, foundry, family, weight, slant, set_width, spacing}. The
font size can either be specified in units of pixels or points, and
the appropriate metric is specified using the size_type argument. The
x and y parameters together control the placement of the new text by
specifying the upper left corner of the text bounding box. If the
antialias parameter is non-zero, the generated text will blend more
smoothly with underlying layers. This option requires more time and
memory to compute than non-antialiased text; the resulting floating
selection or layer, however, will require the same amount of memory
with or without antialiasing. If the specified drawable parameter is
valid, the text will be created as a floating selection attached to
the drawable. If the drawable parameter is not valid (-1), the text
will appear as a new layer. Finally, a border can be specified around
the final rendered text. The border is measured in pixels.
Inputs
- image (PDB_IMAGE)-The image
- drawable (PDB_DRAWABLE)-The affected drawable: (-1 for a new text layer)
- x (PDB_FLOAT)-The x coordinate for the left side of text bounding box
- y (PDB_FLOAT)-The y coordinate for the top of text bounding box
- text (PDB_STRING)-The text to generate
- border (PDB_INT32)-The size of the border: border >= 0
- antialias (PDB_INT32)-Generate antialiased text
- size (PDB_FLOAT)-The size of text in either pixels or points
- size_type (PDB_INT32)-The units of the specified size: { PIXELS (0), POINTS (1) }
- foundry (PDB_STRING)-The font foundry, "*" for any
- family (PDB_STRING)-The font family, "*" for any
- weight (PDB_STRING)-The font weight, "*" for any
- slant (PDB_STRING)-The font slant, "*" for any
- set_width (PDB_STRING)-The font set-width parameter, "*" for any
- spacing (PDB_STRING)-The font spacing, "*" for any
Outputs
- text_layer (PDB_LAYER)-The new text layer
- gimp_blend image, drawable, blend_mode, paint_mode, gradient_type, opacity, offset, repeat, x1, y1, x2, y2
This tool requires information on the paint application mode, the
blend mode, and the gradient type. It creates the specified variety
of blend using the starting and ending coordinates as defined for each
gradient type.
Inputs
- image (PDB_IMAGE)-The image
- drawable (PDB_DRAWABLE)-The affected drawable
- blend_mode (PDB_INT32)-The type of blend: { FG-BG-RGB (0), FG-BG-HSV (1), FG-TRANS (2), CUSTOM (3) }
- paint_mode (PDB_INT32)-The paint application mode: { NORMAL (0), DISSOLVE (1), BEHIND (2), MULTIPLY (3), SCREEN (4), OVERLAY (5) DIFFERENCE (6), ADDITION (7), SUBTRACT (8), DARKEN-ONLY (9), LIGHTEN-ONLY (10), HUE (11), SATURATION (12), COLOR (13), VALUE (14) }
- gradient_type (PDB_INT32)-The type of gradient: { LINEAR (0), BILINEAR (1), RADIAL (2), SQUARE (3), CONICAL-SYMMETRIC (4), CONICAL-ASYMMETRIC (5), SHAPEBURST-ANGULAR (6), SHAPEBURST-SPHERICAL (7), SHAPEBURST-DIMPLED (8) }
- opacity (PDB_FLOAT)-The opacity of the final blend (0 <= opacity <= 100)
- offset (PDB_FLOAT)-Offset relates to the starting and ending coordinates specified for the blend. This parameter is mode depndent (0 <= offset)
- repeat (PDB_INT32)-Repeat the gradient indefinitely along the direction vector
- x1 (PDB_FLOAT)-The x coordinate of this blend's starting point
- y1 (PDB_FLOAT)-The y coordinate of this blend's starting point
- x2 (PDB_FLOAT)-The x coordinate of this blend's ending point
- y2 (PDB_FLOAT)-The y coordinate of this blend's ending point
Next: Script-Fu Logos
Up: Script-Fu: Graphic Art for
Previous: Example Scripts
Spencer Kimball
Wed May 28 22:14:48 PDT 1997