1
<!DOCTYPE HTML PUBLIC "-//Norman Walsh//DTD DocBook HTML 1.0//EN">
5
>Gimp Module Procedures</TITLE
8
CONTENT="Modular DocBook HTML Stylesheet"><LINK
10
TITLE="Gimp Python Documentation"
11
HREF="pygimp.html"><LINK
13
TITLE="The Procedural Database"
14
HREF="procedural-database.html"><LINK
17
HREF="gimp-objects.html"></HEAD
30
>Gimp Python Documentation</TH
38
HREF="procedural-database.html"
51
HREF="gimp-objects.html"
64
NAME="GIMP-MODULE-PROCEDURES"
65
>Gimp Module Procedures</A
71
> module contains a number of
72
procedures and functions, as well as the definitions of many gimp
73
types such as images, and the procedural database. This section
74
explains the base level procedures.</P
80
NAME="CONSTRUCTORS-AND-DESTRUCTORS"
81
>Constructors and Object Deletion</A
84
>There are a number of functions in the
88
> module that are used to create the objects
89
used to make up an image in Gimp. Here is a set of descriptions
90
of these constructors:</P
120
>This procedure creates an image with the given
121
dimensions and type (type is one of
182
>Create a new layer called
188
>, with the given dimensions and
202
> (float between 0 and 100) and
210
> constants). The layer can
211
then be added to the image with the
262
>Create a new channel object with the given
278
> constants). This channel can
279
then be added to an image.</P
295
>Create a new display window for the given image.
296
The window will not be displayed until a call to
300
>gimp.displays_flush</B
308
>gimp.parasite(name, flags, data)</B
313
>Create a new parasite. The parasite can then be
314
attached to gimp, an image or a drawable. This is only
315
available in gimp >= 1.1</P
319
>When any of these objects get removed from memory (such as
320
when their name goes out of range), the gimp thing it represents
321
does not get deleted with it (otherwise when your plugin
322
finished running, it would delete all its work). In order to
323
delete the thing the Python object represents, you should use
329
> procedure. It deletes the
330
gimp thing associated with the Python object given as a
331
parameter. If the object is not an image, layer, channel,
332
drawable or display <TT
345
NAME="CONFIGURATION-INFORMATION"
346
>Configuration Information</A
349
>There are a number of functions that can be used to gather
350
information about the environment the plugin is running in:</P
369
>Returns the current colour cube.</P
380
>Returns the current gamma correction.</P
386
>gimp.install_cmap</B
391
>Returns non-zero if a colour map has been
403
>Returns non-zero if Gimp is using X shared
415
>Returns the file name of the GTK configuration
425
NAME="PALETTE-OPERATIONS"
426
>Palette Operations</A
429
>These functions alter the currently selected foreground
438
>gimp.get_background</B
443
>Returns a 3-tuple containing the current background
444
colour in RGB form.</P
450
>gimp.get_foreground</B
455
>Returns a 3-tuple containing the current foreground
456
colour in RGB form.</P
462
>gimp.set_background</B
483
>Sets the current background colour. The three
484
arguments can be replaced by a single 3-tuple like that
488
>gimp.get_background</B
496
>gimp.set_foreground</B
517
>Sets the current foreground colour. Like
521
>gimp.set_background</B
524
be replaced by a 3-tuple.</P
533
NAME="GRADIENT-OPERATIONS"
534
>Gradient Operations</A
537
>These functions perform operations on gradients:</P
545
>gimp.gradients_get_active</B
550
>Returns the name of the active gradient.</P
556
>gimp.gradients_set_active</B
566
>Sets the active gradient.</P
572
>gimp.gradients_get_list</B
577
>Returns a list of the names of the available
584
>gimp.gradients_sample_uniform</B
594
>Returns a list of <TT
600
samples, where samples consist of 4-tuples of floats
601
representing the red, green, blue and alpha values for the
608
>gimp.gradients_sample_custom</B
622
>gimp.gradients_sample_uniform</B
625
the samples are taken at the positions given in the list
631
> instead of uniformly
632
through the gradient.</P
641
NAME="PDB-REGISTRATION-FUNCTIONS"
642
>PDB Registration Functions</A
645
>These functions either install procedures into the PDB or
646
alert gimp to their special use (eg as file handlers).</P
648
>For simple plugins, you will usually only need to use
662
>gimp.install_procedure</B
730
>This procedure is used to install a procedure into
731
the PDB. The first eight parameters are strings,
741
> constants, and the last two
742
parameters are sequences describing the parameters and
743
return values. Their format is the same as the param and
744
ret_vals methods or PDB procedures.</P
750
>gimp.install_temp_proc</B
812
>This procedure is used to install a procedure into
813
the PDB temporarily. That is, it must be added again
814
every time gimp is run. This procedure will be called the
815
same way as all other procedures for a plugin.</P
821
>gimp.uninstall_temp_proc</B
831
>This removes a temporary procedure from the
838
>gimp.register_magic_load_handle</B
866
>This procedure tells Gimp that the PDB procedure
872
> can load files with
884
> (eg http:) with magic
896
>gimp.register_load_handler</B
918
>This procedure tells Gimp that the PDB procedure
924
> can load files with
942
>gimp.register_save_handler</B
964
>This procedure tells Gimp that the PDB procedure
970
> can save files with
991
NAME="OTHER-FUNCTIONS"
995
>These are the other functions in the
1035
>This function is the one that controls the execution
1036
of a Gimp-Python plugin. It is better to not use this
1037
directly but rather subclass the plugin class, defined in
1039
HREF="support-modules.html#GIMPPLUGIN-MODULE"
1040
>the section called <I
1041
>The gimpplugin Module</I
1054
>The procedural database object.</P
1060
>gimp.progress_init</B
1070
>(Re)Initialise the progress meter with
1076
> (or the plugin name) as a
1077
label in the window.</P
1083
>gimp.progress_update</B
1093
>Set the progress meter to
1105
>gimp.query_images</B
1110
>Returns a list of all the image objects.</P
1121
>Stops execution imediately and exits.</P
1127
>gimp.displays_flush</B
1132
>Update all the display windows.</P
1143
>The maximum width of a tile.</P
1149
>gimp.tile_height</B
1154
>The maximum height of a tile.</P
1160
>gimp.tile_cache_size</B
1170
>Set the size of the tile cache in kilobytes.</P
1176
>gimp.tile_cache_ntiles</B
1186
>Set the size of the tile cache in tiles.</P
1202
>Get the information associated with
1208
>. The data will be a string.
1209
This function should probably be used through the <A
1210
HREF="support-modules.html#GIMPSHELF-MODULE"
1211
>the section called <I
1212
>The gimpshelf Module</I
1236
>Set the information in the string
1248
>. The data will persist for the
1249
whole gimp session. Rather than directly accessing this
1250
function, it is better to go through the <A
1251
HREF="support-modules.html#GIMPSHELF-MODULE"
1252
>the section called <I
1253
>The gimpshelf Module</I
1261
>gimp.extension_ack</B
1266
>Tells gimp that the plugin has finished its work,
1267
while keeping the plugin connection open. This is used by
1268
an extension plugin to tell gimp it can continue, while
1269
leaving the plugin connection open. This is what the
1270
script-fu plugin does so that only one scheme interpretter
1277
>gimp.extension_process</B
1287
>Makes the plugin check for messages from gimp.
1288
generally this is not needed, as messages are checked
1289
during most calls in the gimp module.</P
1302
>In gimp >= 1.1, it is possible to attach arbitrary data to
1303
an image through the use of parasites. Parasites are simply
1304
wrappers for the data, containing its name and some flags.
1305
Parasites have the following parameters:</P
1313
>The data for the parasite -- a string</P
1319
>The flags for the parasite</P
1325
>True if this parasite is persistent</P
1331
>True if this parasite is undoable</P
1337
>The name of the parasite</P
1341
>Parasites also have the methods <TT
1360
>There is a set of four functions that are used to
1361
manipulate parasites. They exist as functions in the
1365
> module, and methods for image and
1366
drawable objects. They are:</P
1384
>find a parasite by its name.</P
1400
>Attach a parasite to this object.</P
1406
>attach_new_parasite</B
1426
>Create a new parasite and attach it.</P
1442
>Detach the named parasite</P
1462
HREF="procedural-database.html"
1478
HREF="gimp-objects.html"
1487
>The Procedural Database</TD
b'\\ No newline at end of file'