Gimp - 2.4 Guía Del Usuario

Descargar
Página de 653
GNU Image Manipulation Program
151 / 653
If your script is intended to work on an image being edited, you’ll want to insert it in the menu that appears when you right-
click on an open image. The rest of the path points to the menu lists, menus and sub-menus. Thus, we registered our Text Box
script in the Text menu of the Script-Fu menu of the Xtns menu of the toolbox ( Xtns → Script-Fu → Text → Text Box ).
If you notice, the Text sub-menu in the Script-Fu menu wasn’t there when we began -- GIMP automatically creates any menus
not already existing.
• A description of your script, to be displayed in the Procedure Browser.
• Your name (the author of the script).
• Copyright information.
• The date the script was made, or the last revision of the script.
• The types of images the script works on. This may be any of the following: RGB, RGBA, GRAY, GRAYA, INDEXED,
INDEXEDA. Or it may be none at all -- in our case, we’re creating an image, and thus don’t need to define the type of image
on which we work.
11.3.4.7
Registering The Script’s Parameters
Once we have listed the required parameters, we then need to list the parameters that correspond to the parameters our script
needs. When we list these params, we give hints as to what their types are. This is for the dialog which pops up when the user
selects our script. We also provide a default value.
This section of the registration process has the following format:
Param Type
Description
Example
SF-VALUE
Accepts numbers and strings. Note that quotes must
be escaped for default text, so better use SF-STRING.
42
SF-STRING
Accepts strings.
"Some text"
SF-COLOR
Indicates that a color is requested in this parameter.
’(0 102 255)
SF-TOGGLE
A checkbox is displayed, to get a Boolean value.
TRUE or FALSE
SF-IMAGE
If your script operates on an open image, this should
be the first parameter after the required parameters.
GIMP will pass in a reference to the image in this
parameter.
3
SF-DRAWABLE
If your script operates on an open image, this should
be the second parameter after the SF-IMAGE param.
It refers to the active layer. GIMP will pass in a
reference to the active layer in this parameter.
17
11.3.5
Giving Our Script Some Guts
Let us continue with our training and add some functionality to our script.
11.3.5.1
Creating A New Image
In the previous lesson, we created an empty function and registered it with GIMP. In this lesson, we want to provide functionality
to our script -- we want to create a new image, add the user’s text to it and resize the image to fit the text exactly.
Once you know how to set variables, define functions and access list members, the rest is all downhill -- all you need to do is
familiarize yourself with the functions available in GIMP’s procedural database and call those functions directly. So fire up the