~ubuntu-branches/ubuntu/jaunty/gimp/jaunty-security

« back to all changes in this revision

Viewing changes to plug-ins/pygimp/doc/pygimp.html

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Holbach
  • Date: 2007-05-02 16:33:03 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20070502163303-bvzhjzbpw8qglc4y
Tags: 2.3.16-1ubuntu1
* Resynchronized with Debian, remaining Ubuntu changes:
  - debian/rules: i18n magic.
* debian/control.in:
  - Maintainer: Ubuntu Core Developers <ubuntu-devel@lists.ubuntu.com>
* debian/patches/02_help-message.patch,
  debian/patches/03_gimp.desktop.in.in.patch,
  debian/patches/10_dont_show_wizard.patch: updated.
* debian/patches/04_composite-signedness.patch,
  debian/patches/05_add-letter-spacing.patch: dropped, used upstream.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2
 
<HTML
3
 
><HEAD
4
 
><TITLE
5
 
>Gimp Python Documentation</TITLE
6
 
><META
7
 
NAME="GENERATOR"
8
 
CONTENT="Modular DocBook HTML Stylesheet Version 1.77+"></HEAD
9
 
><BODY
10
 
CLASS="ARTICLE"
11
 
BGCOLOR="#FFFFFF"
12
 
TEXT="#000000"
13
 
LINK="#0000FF"
14
 
VLINK="#840084"
15
 
ALINK="#0000FF"
16
 
><DIV
17
 
CLASS="ARTICLE"
18
 
><DIV
19
 
CLASS="TITLEPAGE"
20
 
><H1
21
 
CLASS="TITLE"
22
 
><A
23
 
NAME="AEN2"
24
 
></A
25
 
>Gimp Python Documentation</H1
26
 
><H3
27
 
CLASS="AUTHOR"
28
 
><A
29
 
NAME="AEN4"
30
 
>James Henstridge</A
31
 
></H3
32
 
><DIV
33
 
CLASS="AFFILIATION"
34
 
><DIV
35
 
CLASS="ADDRESS"
36
 
><P
37
 
CLASS="ADDRESS"
38
 
>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<TT
39
 
CLASS="EMAIL"
40
 
>&#60;<A
41
 
HREF="mailto:james@daa.com.au"
42
 
>james@daa.com.au</A
43
 
>&#62;</TT
44
 
><br>
45
 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</P
46
 
></DIV
47
 
></DIV
48
 
><P
49
 
CLASS="PUBDATE"
50
 
>v0.4, 5 July 1999<BR></P
51
 
><DIV
52
 
><DIV
53
 
CLASS="ABSTRACT"
54
 
><A
55
 
NAME="AEN11"
56
 
></A
57
 
><P
58
 
></P
59
 
><P
60
 
>This document outlines the interfaces to Gimp-Python,
61
 
      which is a set of Python modules that act as a wrapper to
62
 
      <TT
63
 
CLASS="FILENAME"
64
 
>libgimp</TT
65
 
> allowing the writing of
66
 
      plug-ins for Gimp.  In this way, Gimp-Python is similar to
67
 
      Script-Fu, except that you can use the full set of Python
68
 
      extension modules from the plug-in.</P
69
 
><P
70
 
></P
71
 
></DIV
72
 
></DIV
73
 
><HR></DIV
74
 
><DIV
75
 
CLASS="TOC"
76
 
><DL
77
 
><DT
78
 
><B
79
 
>Table of Contents</B
80
 
></DT
81
 
><DT
82
 
>1. <A
83
 
HREF="#INTRODUCTION"
84
 
>Introduction</A
85
 
></DT
86
 
><DD
87
 
><DL
88
 
><DT
89
 
>1.1. <A
90
 
HREF="#WHAT-IS-IT"
91
 
>What is it?</A
92
 
></DT
93
 
><DT
94
 
>1.2. <A
95
 
HREF="#INSTALLATION"
96
 
>Installation</A
97
 
></DT
98
 
></DL
99
 
></DD
100
 
><DT
101
 
>2. <A
102
 
HREF="#STRUCTURE-OF-PLUGIN"
103
 
>The Structure Of A Plugin</A
104
 
></DT
105
 
><DD
106
 
><DL
107
 
><DT
108
 
>2.1. <A
109
 
HREF="#EXAMPLE-PLUGIN"
110
 
>An Example Plugin</A
111
 
></DT
112
 
><DT
113
 
>2.2. <A
114
 
HREF="#IMPORTANT-MODULES"
115
 
>Import Modules</A
116
 
></DT
117
 
><DT
118
 
>2.3. <A
119
 
HREF="#PLUGIN-FRAMEWORK"
120
 
>Plugin Framework</A
121
 
></DT
122
 
></DL
123
 
></DD
124
 
><DT
125
 
>3. <A
126
 
HREF="#PROCEDURAL-DATABASE"
127
 
>The Procedural Database</A
128
 
></DT
129
 
><DD
130
 
><DL
131
 
><DT
132
 
>3.1. <A
133
 
HREF="#GIMP-PYTHON-MODEL"
134
 
>The Gimp-Python Model</A
135
 
></DT
136
 
><DT
137
 
>3.2. <A
138
 
HREF="#PDB-PROCEDURES"
139
 
>Procedural Database Procedures</A
140
 
></DT
141
 
><DT
142
 
>3.3. <A
143
 
HREF="#MORE-INFORMATION"
144
 
>More Information</A
145
 
></DT
146
 
></DL
147
 
></DD
148
 
><DT
149
 
>4. <A
150
 
HREF="#GIMP-MODULE-PROCEDURES"
151
 
>Gimp Module Procedures</A
152
 
></DT
153
 
><DD
154
 
><DL
155
 
><DT
156
 
>4.1. <A
157
 
HREF="#CONSTRUCTORS-AND-DESTRUCTORS"
158
 
>Constructors and Object Deletion</A
159
 
></DT
160
 
><DT
161
 
>4.2. <A
162
 
HREF="#CONFIGURATION-INFORMATION"
163
 
>Configuration Information</A
164
 
></DT
165
 
><DT
166
 
>4.3. <A
167
 
HREF="#PALETTE-OPERATIONS"
168
 
>Palette Operations</A
169
 
></DT
170
 
><DT
171
 
>4.4. <A
172
 
HREF="#GRADIENT-OPERATIONS"
173
 
>Gradient Operations</A
174
 
></DT
175
 
><DT
176
 
>4.5. <A
177
 
HREF="#PDB-REGISTRATION-FUNCTIONS"
178
 
>PDB Registration Functions</A
179
 
></DT
180
 
><DT
181
 
>4.6. <A
182
 
HREF="#OTHER-FUNCTIONS"
183
 
>Other Functions</A
184
 
></DT
185
 
><DT
186
 
>4.7. <A
187
 
HREF="#PARASITES"
188
 
>Parasites</A
189
 
></DT
190
 
></DL
191
 
></DD
192
 
><DT
193
 
>5. <A
194
 
HREF="#GIMP-OBJECTS"
195
 
>Gimp Objects</A
196
 
></DT
197
 
><DD
198
 
><DL
199
 
><DT
200
 
>5.1. <A
201
 
HREF="#IMAGE-OBJECT"
202
 
>Image Object</A
203
 
></DT
204
 
><DD
205
 
><DL
206
 
><DT
207
 
>5.1.1. <A
208
 
HREF="#IMAGE-OBJECT-MEMBERS"
209
 
>Image Members</A
210
 
></DT
211
 
><DT
212
 
>5.1.2. <A
213
 
HREF="#IMAGE-OBJECT-METHODS"
214
 
>Image Methods</A
215
 
></DT
216
 
></DL
217
 
></DD
218
 
><DT
219
 
>5.2. <A
220
 
HREF="#CHANNEL-OBJECT"
221
 
>Channel Objects</A
222
 
></DT
223
 
><DD
224
 
><DL
225
 
><DT
226
 
>5.2.1. <A
227
 
HREF="#CHANNEL-OBJECT-MEMBERS"
228
 
>Channel Members</A
229
 
></DT
230
 
><DT
231
 
>5.2.2. <A
232
 
HREF="#CHANNEL-OBJECT-METHODS"
233
 
>Channel Methods</A
234
 
></DT
235
 
></DL
236
 
></DD
237
 
><DT
238
 
>5.3. <A
239
 
HREF="#LAYER-OBJECT"
240
 
>Layer Objects</A
241
 
></DT
242
 
><DD
243
 
><DL
244
 
><DT
245
 
>5.3.1. <A
246
 
HREF="#LAYER-OBJECT-MEMBERS"
247
 
>Layer Members</A
248
 
></DT
249
 
><DT
250
 
>5.3.2. <A
251
 
HREF="#LAYER-OBJECT-METHODS"
252
 
>Layer Methods</A
253
 
></DT
254
 
></DL
255
 
></DD
256
 
><DT
257
 
>5.4. <A
258
 
HREF="#DRAWABLE-OBJECT"
259
 
>Drawable Objects</A
260
 
></DT
261
 
><DD
262
 
><DL
263
 
><DT
264
 
>5.4.1. <A
265
 
HREF="#DRAWABLE-OBJECT-MEMBERS"
266
 
>Drawable Members</A
267
 
></DT
268
 
><DT
269
 
>5.4.2. <A
270
 
HREF="#DRAWABLE-OBJECT-METHODS"
271
 
>Drawable Methods</A
272
 
></DT
273
 
></DL
274
 
></DD
275
 
><DT
276
 
>5.5. <A
277
 
HREF="#TILE-OBJECT"
278
 
>Tile Objects</A
279
 
></DT
280
 
><DD
281
 
><DL
282
 
><DT
283
 
>5.5.1. <A
284
 
HREF="#TILE-OBJECT-MEMBERS"
285
 
>Tile Members</A
286
 
></DT
287
 
><DT
288
 
>5.5.2. <A
289
 
HREF="#TILE-OBJECT-METHODS"
290
 
>Tile Methods</A
291
 
></DT
292
 
><DT
293
 
>5.5.3. <A
294
 
HREF="#TILE-OBJECT-MAPPING"
295
 
>Tile Mapping Behaviour</A
296
 
></DT
297
 
></DL
298
 
></DD
299
 
><DT
300
 
>5.6. <A
301
 
HREF="#PREGION-OBJECT"
302
 
>Pixel Regions</A
303
 
></DT
304
 
><DD
305
 
><DL
306
 
><DT
307
 
>5.6.1. <A
308
 
HREF="#PREGION-OBJECT-MEMBERS"
309
 
>Pixel Region Members</A
310
 
></DT
311
 
><DT
312
 
>5.6.2. <A
313
 
HREF="#PREGION-OBJECT-METHODS"
314
 
>Pixel Region Methods</A
315
 
></DT
316
 
><DT
317
 
>5.6.3. <A
318
 
HREF="#PREGION-OBJECT-MAPPING"
319
 
>Pixel Region Mapping Behaviour</A
320
 
></DT
321
 
></DL
322
 
></DD
323
 
></DL
324
 
></DD
325
 
><DT
326
 
>6. <A
327
 
HREF="#SUPPORT-MODULES"
328
 
>Support Modules</A
329
 
></DT
330
 
><DD
331
 
><DL
332
 
><DT
333
 
>6.1. <A
334
 
HREF="#GIMPENUMS-MODULE"
335
 
>The gimpenums Module</A
336
 
></DT
337
 
><DT
338
 
>6.2. <A
339
 
HREF="#AEN1468"
340
 
>The gimpfu Module</A
341
 
></DT
342
 
><DT
343
 
>6.3. <A
344
 
HREF="#GIMPPLUGIN-MODULE"
345
 
>The gimpplugin Module</A
346
 
></DT
347
 
><DT
348
 
>6.4. <A
349
 
HREF="#GIMPSHELF-MODULE"
350
 
>The gimpshelf Module</A
351
 
></DT
352
 
></DL
353
 
></DD
354
 
><DT
355
 
>7. <A
356
 
HREF="#END-NOTE"
357
 
>End Note</A
358
 
></DT
359
 
></DL
360
 
></DIV
361
 
><DIV
362
 
CLASS="SECT1"
363
 
><H2
364
 
CLASS="SECT1"
365
 
><A
366
 
NAME="INTRODUCTION"
367
 
></A
368
 
>1. Introduction</H2
369
 
><DIV
370
 
CLASS="SECT2"
371
 
><H3
372
 
CLASS="SECT2"
373
 
><A
374
 
NAME="WHAT-IS-IT"
375
 
></A
376
 
>1.1. What is it?</H3
377
 
><P
378
 
>Gimp-Python is a scripting extension for Gimp, similar to
379
 
      Script-Fu.  The main difference is in what is called first.  In
380
 
      Script-Fu, the script-fu plugin executes the script, while in
381
 
      Gimp-Python the script is in control.</P
382
 
><P
383
 
>In fact, you will find that the Gimp-Python scripts start
384
 
      with the line <TT
385
 
CLASS="LITERAL"
386
 
>&num;!/usr/bin/python</TT
387
 
>.  The
388
 
      gimp extension is loaded with the familiar
389
 
      <TT
390
 
CLASS="LITERAL"
391
 
>import</TT
392
 
> command.</P
393
 
><P
394
 
>Another point of difference between Gimp-Python and
395
 
      Script-Fu is that Gimp-Python stores images, layers, channels
396
 
      and other types as objects rather than just storing their ID.
397
 
      This allows better type checking that is missing from Script-Fu,
398
 
      and allows those types to act as objects, complete with
399
 
      attributes and methods.</P
400
 
><P
401
 
>Also, Gimp-Python is not limited to just calling
402
 
      procedures from the PDB.  It also implements the rest of
403
 
      <TT
404
 
CLASS="FILENAME"
405
 
>libgimp</TT
406
 
>, including tiles and pixel regions,
407
 
      and access to other lower level functions.</P
408
 
></DIV
409
 
><DIV
410
 
CLASS="SECT2"
411
 
><HR><H3
412
 
CLASS="SECT2"
413
 
><A
414
 
NAME="INSTALLATION"
415
 
></A
416
 
>1.2. Installation</H3
417
 
><P
418
 
>Gimp-python consists of a Python module written in C and
419
 
      some native python support modules.  You can build pygimp with
420
 
      the commands:</P
421
 
><PRE
422
 
CLASS="PROGRAMLISTING"
423
 
>./configure
424
 
make
425
 
make install</PRE
426
 
><P
427
 
>This will build and install gimpmodule and its supporting
428
 
      modules, and install the sample plugins in gimp's plugin
429
 
      directory.</P
430
 
></DIV
431
 
></DIV
432
 
><DIV
433
 
CLASS="SECT1"
434
 
><HR><H2
435
 
CLASS="SECT1"
436
 
><A
437
 
NAME="STRUCTURE-OF-PLUGIN"
438
 
></A
439
 
>2. The Structure Of A Plugin</H2
440
 
><P
441
 
>The majority of code in this package resides in
442
 
    <TT
443
 
CLASS="FILENAME"
444
 
>gimpmodule.c</TT
445
 
>, but this provides a poor
446
 
    interface for implementing some portions of a plugin.  For this
447
 
    reason, there is a python module called
448
 
    <TT
449
 
CLASS="FILENAME"
450
 
>plugin.py</TT
451
 
> that sets out a structure for
452
 
    plugins and implements some things that were either too dificult
453
 
    or impossible to do in C.</P
454
 
><P
455
 
>The main purpose of <TT
456
 
CLASS="FILENAME"
457
 
>plugin.py</TT
458
 
> was to
459
 
    implement an object oriented structure for plug-ins.  As well as
460
 
    this, it handles tracebacks, which are otherwise ignored by
461
 
    <TT
462
 
CLASS="FILENAME"
463
 
>libgimp</TT
464
 
>, and gives a method to call
465
 
    other Gimp-Python plug-ins without going through the procedural
466
 
    database.</P
467
 
><DIV
468
 
CLASS="SECT2"
469
 
><HR><H3
470
 
CLASS="SECT2"
471
 
><A
472
 
NAME="EXAMPLE-PLUGIN"
473
 
></A
474
 
>2.1. An Example Plugin</H3
475
 
><P
476
 
>As in a lot of manuals, the first thing you examine is an
477
 
      example, so here is an example.  I have included it before
478
 
      explaining what it does to allow more advanced programmers to
479
 
      see the structure up front.  It is a translation of the clothify
480
 
      Script-Fu extension:</P
481
 
><DIV
482
 
CLASS="EXAMPLE"
483
 
><A
484
 
NAME="AEN41"
485
 
></A
486
 
><P
487
 
><B
488
 
>Example 1. A sample python plugin</B
489
 
></P
490
 
><PRE
491
 
CLASS="PROGRAMLISTING"
492
 
>#!/usr/bin/python
493
 
import math
494
 
from gimpfu import *
495
 
 
496
 
have_gimp11 = gimp.major_version &#62; 1 or \
497
 
              gimp.major_version == 1 and gimp.minor_version &#62;= 1
498
 
 
499
 
def python_clothify(timg, tdrawable, bx=9, by=9,
500
 
                    azimuth=135, elevation=45, depth=3):
501
 
        bx = 9 ; by = 9 ; azimuth = 135 ; elevation = 45 ; depth = 3
502
 
        width = tdrawable.width
503
 
        height = tdrawable.height
504
 
        img = gimp.image(width, height, RGB)
505
 
        layer_one = gimp.layer(img, "X Dots", width, height, RGB_IMAGE,
506
 
                               100, NORMAL_MODE)
507
 
        img.disable_undo()
508
 
        if have_gimp11:
509
 
                pdb.gimp_edit_fill(layer_one)
510
 
        else:
511
 
                pdb.gimp_edit_fill(img, layer_one)
512
 
        img.add_layer(layer_one, 0)
513
 
        pdb.plug_in_noisify(img, layer_one, 0, 0.7, 0.7, 0.7, 0.7)
514
 
        layer_two = layer_one.copy()
515
 
        layer_two.mode = MULTIPLY_MODE
516
 
        layer_two.name = "Y Dots"
517
 
        img.add_layer(layer_two, 0)
518
 
        pdb.plug_in_gauss_rle(img, layer_one, bx, 1, 0)
519
 
        pdb.plug_in_gauss_rle(img, layer_two, by, 0, 1)
520
 
        img.flatten()
521
 
        bump_layer = img.active_layer
522
 
        pdb.plug_in_c_astretch(img, bump_layer)
523
 
        pdb.plug_in_noisify(img, bump_layer, 0, 0.2, 0.2, 0.2, 0.2)
524
 
        pdb.plug_in_bump_map(img, tdrawable, bump_layer, azimuth,
525
 
                             elevation, depth, 0, 0, 0, 0, TRUE, FALSE, 0)
526
 
        gimp.delete(img)
527
 
 
528
 
register(
529
 
        "python_fu_clothify",
530
 
        "Make the specified layer look like it is printed on cloth",
531
 
        "Make the specified layer look like it is printed on cloth",
532
 
        "James Henstridge",
533
 
        "James Henstridge",
534
 
        "1997-1999",
535
 
        "&#60;Image&#62;/Python-Fu/Alchemy/Clothify",
536
 
        "RGB*, GRAY*",
537
 
        [
538
 
                (PF_INT, "x_blur", "X Blur", 9),
539
 
                (PF_INT, "y_blur", "Y Blur", 9),
540
 
                (PF_INT, "azimuth", "Azimuth", 135),
541
 
                (PF_INT, "elevation", "elevation", 45),
542
 
                (PF_INT, "depth", "Depth", 3)
543
 
        ],
544
 
        [],
545
 
        python_clothify)
546
 
 
547
 
main()</PRE
548
 
></DIV
549
 
></DIV
550
 
><DIV
551
 
CLASS="SECT2"
552
 
><HR><H3
553
 
CLASS="SECT2"
554
 
><A
555
 
NAME="IMPORTANT-MODULES"
556
 
></A
557
 
>2.2. Import Modules</H3
558
 
><P
559
 
>In this plugin, a number of modules are imported.  The
560
 
      important ones are:</P
561
 
><P
562
 
></P
563
 
><UL
564
 
><LI
565
 
><P
566
 
><TT
567
 
CLASS="FILENAME"
568
 
>gimpfu</TT
569
 
>: this module provides a
570
 
          simple interface for writing plugins, similar to what
571
 
          script-fu provides.  It provides the GUI for entering in
572
 
          parameters in interactive mode and performs some sanity
573
 
          checks when registering the plugin.</P
574
 
><P
575
 
>By using "from gimpfu import *", this module also
576
 
          provides an easy way to get all the commonly used symbols
577
 
          into the plugin's namespace.</P
578
 
></LI
579
 
><LI
580
 
><P
581
 
><TT
582
 
CLASS="FILENAME"
583
 
>gimp</TT
584
 
>: the main part of the gimp
585
 
          extension.  This is imported with gimpfu.</P
586
 
></LI
587
 
><LI
588
 
><P
589
 
><TT
590
 
CLASS="FILENAME"
591
 
>gimpenums</TT
592
 
>: a number of useful
593
 
          constants.  This is also automatically imported with
594
 
          gimpfu.</P
595
 
></LI
596
 
></UL
597
 
><P
598
 
>The pdb variable is a variable for accessing the
599
 
      procedural database.  It is imported into the plugin's namespace
600
 
      with gimpfu for convenience.</P
601
 
></DIV
602
 
><DIV
603
 
CLASS="SECT2"
604
 
><HR><H3
605
 
CLASS="SECT2"
606
 
><A
607
 
NAME="PLUGIN-FRAMEWORK"
608
 
></A
609
 
>2.3. Plugin Framework</H3
610
 
><P
611
 
>With pygimp-0.4, the gimpfu module was introduced.  It
612
 
      simplifies writing plugins a lot.  It handles the run mode
613
 
      (interactive, non interactive or run with last values),
614
 
      providing a GUI for interactive mode and saving the last used
615
 
      settings.</P
616
 
><P
617
 
>Using the gimpfu plugin, all you need to do is write the
618
 
      function that should be run, make a call to
619
 
      <TT
620
 
CLASS="FUNCTION"
621
 
>register</TT
622
 
>, and finally a call to
623
 
      <TT
624
 
CLASS="FUNCTION"
625
 
>main</TT
626
 
> to get the plugin started.</P
627
 
><P
628
 
>If the plugin is to be run on an image, the first
629
 
      parameter to the plugin function should be the image, and the
630
 
      second should be the current drawable (do not worry about the
631
 
      run_mode parameter).  Plugins that do not act on an existing
632
 
      image (and hence go in the toolbox's menus) do not need these
633
 
      parameters.  Any other parameters are specific to the
634
 
      plugin.</P
635
 
><P
636
 
>After defining the plugin function, you need to call
637
 
      <TT
638
 
CLASS="FUNCTION"
639
 
>register</TT
640
 
> to register the plugin with gimp
641
 
      (When the plugin is run to query it, this information is passed
642
 
      to gimp.  When it is run interactively, this information is used
643
 
      to construct the GUI).  The parameters to
644
 
      <TT
645
 
CLASS="FUNCTION"
646
 
>register</TT
647
 
> are:</P
648
 
><P
649
 
></P
650
 
><TABLE
651
 
BORDER="0"
652
 
><TBODY
653
 
><TR
654
 
><TD
655
 
>name</TD
656
 
></TR
657
 
><TR
658
 
><TD
659
 
>blurb</TD
660
 
></TR
661
 
><TR
662
 
><TD
663
 
>help</TD
664
 
></TR
665
 
><TR
666
 
><TD
667
 
>author</TD
668
 
></TR
669
 
><TR
670
 
><TD
671
 
>copyright</TD
672
 
></TR
673
 
><TR
674
 
><TD
675
 
>date</TD
676
 
></TR
677
 
><TR
678
 
><TD
679
 
>menupath</TD
680
 
></TR
681
 
><TR
682
 
><TD
683
 
>imagetypes</TD
684
 
></TR
685
 
><TR
686
 
><TD
687
 
>params</TD
688
 
></TR
689
 
><TR
690
 
><TD
691
 
>results</TD
692
 
></TR
693
 
><TR
694
 
><TD
695
 
>function</TD
696
 
></TR
697
 
></TBODY
698
 
></TABLE
699
 
><P
700
 
></P
701
 
><P
702
 
>Most of these parameters are quite self explanatory.  The
703
 
      menupath option should start with &#60;Image%gt;/ for image
704
 
      plugins and &#60;Toolbox&#62;/ for toolbox plugins.  The remainder
705
 
      of the menupath is a slash separated path to its menu item.</P
706
 
><P
707
 
>The params parameter holds a list parameters for the
708
 
      function.  It is a list of tuples.  Note that you do not have to
709
 
      specify the run_type, image or drawable parameters, as gimpfu
710
 
      will add these automatically for you.  The tuple format is
711
 
      (type, name, description, default [, extra]).  The allowed type
712
 
      codes are:</P
713
 
><P
714
 
></P
715
 
><TABLE
716
 
BORDER="0"
717
 
><TBODY
718
 
><TR
719
 
><TD
720
 
>PF_INT8</TD
721
 
></TR
722
 
><TR
723
 
><TD
724
 
>PF_INT16</TD
725
 
></TR
726
 
><TR
727
 
><TD
728
 
>PF_INT32</TD
729
 
></TR
730
 
><TR
731
 
><TD
732
 
>PF_INT</TD
733
 
></TR
734
 
><TR
735
 
><TD
736
 
>PF_FLOAT</TD
737
 
></TR
738
 
><TR
739
 
><TD
740
 
>PF_STRING</TD
741
 
></TR
742
 
><TR
743
 
><TD
744
 
>PF_VALUE</TD
745
 
></TR
746
 
><TR
747
 
><TD
748
 
>PF_INT8ARRAY</TD
749
 
></TR
750
 
><TR
751
 
><TD
752
 
>PF_INT16ARRAY</TD
753
 
></TR
754
 
><TR
755
 
><TD
756
 
>PF_INT32ARRAY</TD
757
 
></TR
758
 
><TR
759
 
><TD
760
 
>PF_INTARRAY</TD
761
 
></TR
762
 
><TR
763
 
><TD
764
 
>PF_FLOATARRAY</TD
765
 
></TR
766
 
><TR
767
 
><TD
768
 
>PF_STRINGARRAY</TD
769
 
></TR
770
 
><TR
771
 
><TD
772
 
>PF_COLOR</TD
773
 
></TR
774
 
><TR
775
 
><TD
776
 
>PF_COLOUR</TD
777
 
></TR
778
 
><TR
779
 
><TD
780
 
>PF_REGION</TD
781
 
></TR
782
 
><TR
783
 
><TD
784
 
>PF_IMAGE</TD
785
 
></TR
786
 
><TR
787
 
><TD
788
 
>PF_LAYER</TD
789
 
></TR
790
 
><TR
791
 
><TD
792
 
>PF_CHANNEL</TD
793
 
></TR
794
 
><TR
795
 
><TD
796
 
>PF_DRAWABLE</TD
797
 
></TR
798
 
><TR
799
 
><TD
800
 
>PF_TOGGLE</TD
801
 
></TR
802
 
><TR
803
 
><TD
804
 
>PF_BOOL</TD
805
 
></TR
806
 
><TR
807
 
><TD
808
 
>PF_SLIDER</TD
809
 
></TR
810
 
><TR
811
 
><TD
812
 
>PF_SPINNER</TD
813
 
></TR
814
 
><TR
815
 
><TD
816
 
>PF_ADJUSTMENT</TD
817
 
></TR
818
 
><TR
819
 
><TD
820
 
>PF_FONT</TD
821
 
></TR
822
 
><TR
823
 
><TD
824
 
>PF_FILE</TD
825
 
></TR
826
 
><TR
827
 
><TD
828
 
>PF_BRUSH</TD
829
 
></TR
830
 
><TR
831
 
><TD
832
 
>PF_PATTERN</TD
833
 
></TR
834
 
><TR
835
 
><TD
836
 
>PF_GRADIENT</TD
837
 
></TR
838
 
></TBODY
839
 
></TABLE
840
 
><P
841
 
></P
842
 
><P
843
 
>These values map onto the standard PARAM_* constants.  The
844
 
      reason to use the extra constants is that they give gimpfu more
845
 
      information, so it can produce a better interface (for instance,
846
 
      the PF_FONT type is equivalent to PARAM_STRING, but in the GUI
847
 
      you get a small button that will bring up a font selection
848
 
      dialog).</P
849
 
><P
850
 
>The PF_SLIDER, PF_SPINNER and PF_ADJUSTMENT types require
851
 
      the extra parameter.  It is of the form (min, max, step), and
852
 
      gives the limits for the spin button or slider.</P
853
 
><P
854
 
>The results parameter is a list of 3-tuples of the form
855
 
      (type, name, description).  It defines the return values for the
856
 
      function.  If there is only a single return value, the plugin
857
 
      function should return just that value.  If there is more than
858
 
      one, the plugin function should return a tuple of results.</P
859
 
><P
860
 
>The final parameter to <TT
861
 
CLASS="FUNCTION"
862
 
>register</TT
863
 
> is
864
 
      the plugin function itself.</P
865
 
><P
866
 
>After registering one or more plugin functions, you must
867
 
      call the <TT
868
 
CLASS="FUNCTION"
869
 
>main</TT
870
 
> function.  This will cause
871
 
      the plugin to start running.  A GUI will be displayed when
872
 
      needed, and your plugin function will be called at the
873
 
      appropriate times.</P
874
 
></DIV
875
 
></DIV
876
 
><DIV
877
 
CLASS="SECT1"
878
 
><HR><H2
879
 
CLASS="SECT1"
880
 
><A
881
 
NAME="PROCEDURAL-DATABASE"
882
 
></A
883
 
>3. The Procedural Database</H2
884
 
><P
885
 
>The procedural database is a registry of things gimp and its
886
 
    plugins can do.  When you install a procedure for your plugin, you
887
 
    are extending the procedural database.</P
888
 
><P
889
 
>The procedural database is self documenting, in that when
890
 
    you install a procedure in it, you also add documentation for it,
891
 
    its parameters and return values.</P
892
 
><DIV
893
 
CLASS="SECT2"
894
 
><HR><H3
895
 
CLASS="SECT2"
896
 
><A
897
 
NAME="GIMP-PYTHON-MODEL"
898
 
></A
899
 
>3.1. The Gimp-Python Model</H3
900
 
><P
901
 
>In Gimp-Python, the procedural database is represented by
902
 
      the object <TT
903
 
CLASS="PARAMETER"
904
 
><I
905
 
>gimp.pdb</I
906
 
></TT
907
 
>.  In most of my
908
 
      plugins, I make an assignment from <TT
909
 
CLASS="PARAMETER"
910
 
><I
911
 
>gimp.pdb</I
912
 
></TT
913
 
>
914
 
      to <TT
915
 
CLASS="PARAMETER"
916
 
><I
917
 
>pdb</I
918
 
></TT
919
 
> for convenience.</P
920
 
><P
921
 
>You can query the procedural database with
922
 
      <TT
923
 
CLASS="PARAMETER"
924
 
><I
925
 
>pdb</I
926
 
></TT
927
 
>'s method <TT
928
 
CLASS="FUNCTION"
929
 
>query</TT
930
 
>.  Its
931
 
      specification is:</P
932
 
><PRE
933
 
CLASS="SCREEN"
934
 
>pdb.query(name, [blurb, [help, [author, [copyright, [date, [type]]]]]])</PRE
935
 
><P
936
 
>Each parameter is a regular expression that is checked
937
 
      against the corresponding field in the procedural database.  The
938
 
      method returns a list of the names of matching procedures.  If
939
 
      <TT
940
 
CLASS="FUNCTION"
941
 
>query</TT
942
 
> is called without any arguments, it will
943
 
      return every procedure in the database.</P
944
 
></DIV
945
 
><DIV
946
 
CLASS="SECT2"
947
 
><HR><H3
948
 
CLASS="SECT2"
949
 
><A
950
 
NAME="PDB-PROCEDURES"
951
 
></A
952
 
>3.2. Procedural Database Procedures</H3
953
 
><P
954
 
>Procedures can be accessed as procedures, or by treating
955
 
      <TT
956
 
CLASS="PARAMETER"
957
 
><I
958
 
>pdb</I
959
 
></TT
960
 
> as a mapping objest.  As an example,
961
 
      the probedure <TT
962
 
CLASS="FUNCTION"
963
 
>gimp_edit_fill</TT
964
 
> can be
965
 
      accessed as either <TT
966
 
CLASS="FUNCTION"
967
 
>pdb.gimp_edit_fill</TT
968
 
> or
969
 
      <TT
970
 
CLASS="FUNCTION"
971
 
>pdb['gimp_edit_fill']</TT
972
 
>.  The second form is
973
 
      mainly for procedures whose names are not valid Python names (eg
974
 
      in script-fu-..., the dashes are interpreted as minuses).</P
975
 
><P
976
 
>These procedure objects have a number of attribute:</P
977
 
><P
978
 
></P
979
 
><DIV
980
 
CLASS="VARIABLELIST"
981
 
><DL
982
 
><DT
983
 
>proc_name</DT
984
 
><DD
985
 
><P
986
 
>The name of the procedure.</P
987
 
></DD
988
 
><DT
989
 
>proc_blurb</DT
990
 
><DD
991
 
><P
992
 
>A short peice of information about the procedure.</P
993
 
></DD
994
 
><DT
995
 
>proc_help</DT
996
 
><DD
997
 
><P
998
 
>More detailed information about the procedure.</P
999
 
></DD
1000
 
><DT
1001
 
>proc_author</DT
1002
 
><DD
1003
 
><P
1004
 
>The author of the procedure.</P
1005
 
></DD
1006
 
><DT
1007
 
>proc_copyright</DT
1008
 
><DD
1009
 
><P
1010
 
>The copyright holder for the procedure (usually the
1011
 
            same as the author).</P
1012
 
></DD
1013
 
><DT
1014
 
>proc_date</DT
1015
 
><DD
1016
 
><P
1017
 
>The date when the procedure was written.</P
1018
 
></DD
1019
 
><DT
1020
 
>proc_type</DT
1021
 
><DD
1022
 
><P
1023
 
>The type of procedure.  This will be one of
1024
 
            PROC_PLUG_IN, PROC_EXTENSION or PROC_TEMPORARY.</P
1025
 
></DD
1026
 
><DT
1027
 
>nparams</DT
1028
 
><DD
1029
 
><P
1030
 
>The number of parameters the procedure takes.</P
1031
 
></DD
1032
 
><DT
1033
 
>nreturn_vals</DT
1034
 
><DD
1035
 
><P
1036
 
>The number of return values the procedure gives.</P
1037
 
></DD
1038
 
><DT
1039
 
>params</DT
1040
 
><DD
1041
 
><P
1042
 
>A description of parameters of the procedure.  It
1043
 
            takes the form of a tuple of 3-tuples, where each 3-tuple
1044
 
            describes a parameter.  The items in the 3-tuple are a
1045
 
            parameter type (one of the PARAM_* constants), a
1046
 
            name for the parameter, and a description of the
1047
 
            parameter.</P
1048
 
></DD
1049
 
><DT
1050
 
>return_vals</DT
1051
 
><DD
1052
 
><P
1053
 
>A description of the return values.  It takes the
1054
 
            same form as the <TT
1055
 
CLASS="LITERAL"
1056
 
>params</TT
1057
 
>
1058
 
            attribute.</P
1059
 
></DD
1060
 
></DL
1061
 
></DIV
1062
 
><P
1063
 
>A procedure object may also be called.  At this point,
1064
 
      Gimp-Python doesn't support keyword arguments for PDB
1065
 
      procedures.  Arguments are passed to the procedure in the normal
1066
 
      method.  The return depends on the number of return values:</P
1067
 
><P
1068
 
></P
1069
 
><UL
1070
 
><LI
1071
 
><P
1072
 
>If there are zero return values,
1073
 
          <TT
1074
 
CLASS="LITERAL"
1075
 
>None</TT
1076
 
> is returned.</P
1077
 
></LI
1078
 
><LI
1079
 
><P
1080
 
>If there is only a single return value, it is
1081
 
          returned.</P
1082
 
></LI
1083
 
><LI
1084
 
><P
1085
 
>If there are more return values, then they are
1086
 
          returned as a tuple.</P
1087
 
></LI
1088
 
></UL
1089
 
></DIV
1090
 
><DIV
1091
 
CLASS="SECT2"
1092
 
><HR><H3
1093
 
CLASS="SECT2"
1094
 
><A
1095
 
NAME="MORE-INFORMATION"
1096
 
></A
1097
 
>3.3. More Information</H3
1098
 
><P
1099
 
>For more information on invoking PDB procedures, please
1100
 
      see the example plugins.  For information on individual
1101
 
      procedures, please see the PDB Browser plugin (in the Xtns
1102
 
      menu).  It alows you to peruse to the database
1103
 
      interactively.</P
1104
 
></DIV
1105
 
></DIV
1106
 
><DIV
1107
 
CLASS="SECT1"
1108
 
><HR><H2
1109
 
CLASS="SECT1"
1110
 
><A
1111
 
NAME="GIMP-MODULE-PROCEDURES"
1112
 
></A
1113
 
>4. Gimp Module Procedures</H2
1114
 
><P
1115
 
>The <TT
1116
 
CLASS="FILENAME"
1117
 
>gimp</TT
1118
 
> module contains a number of
1119
 
    procedures and functions, as well as the definitions of many gimp
1120
 
    types such as images, and the procedural database.  This section
1121
 
    explains the base level procedures.</P
1122
 
><DIV
1123
 
CLASS="SECT2"
1124
 
><HR><H3
1125
 
CLASS="SECT2"
1126
 
><A
1127
 
NAME="CONSTRUCTORS-AND-DESTRUCTORS"
1128
 
></A
1129
 
>4.1. Constructors and Object Deletion</H3
1130
 
><P
1131
 
>There are a number of functions in the
1132
 
      <TT
1133
 
CLASS="FILENAME"
1134
 
>gimp</TT
1135
 
> module that are used to create the objects
1136
 
      used to make up an image in Gimp.  Here is a set of descriptions
1137
 
      of these constructors:</P
1138
 
><P
1139
 
></P
1140
 
><DIV
1141
 
CLASS="VARIABLELIST"
1142
 
><DL
1143
 
><DT
1144
 
><TT
1145
 
CLASS="FUNCTION"
1146
 
>gimp.image</TT
1147
 
>(<TT
1148
 
CLASS="PARAMETER"
1149
 
><I
1150
 
>width</I
1151
 
></TT
1152
 
>,
1153
 
          <TT
1154
 
CLASS="PARAMETER"
1155
 
><I
1156
 
>height</I
1157
 
></TT
1158
 
>,
1159
 
          <TT
1160
 
CLASS="PARAMETER"
1161
 
><I
1162
 
>type</I
1163
 
></TT
1164
 
>)</DT
1165
 
><DD
1166
 
><P
1167
 
>This procedure creates an image with the given
1168
 
            dimensions and type (type is one of
1169
 
            <TT
1170
 
CLASS="LITERAL"
1171
 
>RGB</TT
1172
 
>, <TT
1173
 
CLASS="LITERAL"
1174
 
>GRAY</TT
1175
 
> or
1176
 
            <TT
1177
 
CLASS="LITERAL"
1178
 
>INDEXED</TT
1179
 
>).</P
1180
 
></DD
1181
 
><DT
1182
 
><TT
1183
 
CLASS="FUNCTION"
1184
 
>gimp.layer</TT
1185
 
>(<TT
1186
 
CLASS="PARAMETER"
1187
 
><I
1188
 
>img</I
1189
 
></TT
1190
 
>,
1191
 
          <TT
1192
 
CLASS="PARAMETER"
1193
 
><I
1194
 
>name</I
1195
 
></TT
1196
 
>, <TT
1197
 
CLASS="PARAMETER"
1198
 
><I
1199
 
>width</I
1200
 
></TT
1201
 
>,
1202
 
          <TT
1203
 
CLASS="PARAMETER"
1204
 
><I
1205
 
>height</I
1206
 
></TT
1207
 
>, <TT
1208
 
CLASS="PARAMETER"
1209
 
><I
1210
 
>type</I
1211
 
></TT
1212
 
>,
1213
 
          <TT
1214
 
CLASS="PARAMETER"
1215
 
><I
1216
 
>opacity</I
1217
 
></TT
1218
 
>,
1219
 
          <TT
1220
 
CLASS="PARAMETER"
1221
 
><I
1222
 
>mode</I
1223
 
></TT
1224
 
>)</DT
1225
 
><DD
1226
 
><P
1227
 
>Create a new layer called
1228
 
            <TT
1229
 
CLASS="PARAMETER"
1230
 
><I
1231
 
>name</I
1232
 
></TT
1233
 
>, with the given dimensions and
1234
 
            <TT
1235
 
CLASS="PARAMETER"
1236
 
><I
1237
 
>type</I
1238
 
></TT
1239
 
> (one of the
1240
 
            <TT
1241
 
CLASS="LITERAL"
1242
 
>*_IMAGE</TT
1243
 
> constants),
1244
 
            <TT
1245
 
CLASS="LITERAL"
1246
 
>opacity</TT
1247
 
> (float between 0 and 100) and
1248
 
            a <TT
1249
 
CLASS="LITERAL"
1250
 
>mode</TT
1251
 
> (one of the
1252
 
            <TT
1253
 
CLASS="LITERAL"
1254
 
>*_MODE</TT
1255
 
> constants).  The layer can
1256
 
            then be added to the image with the
1257
 
            <TT
1258
 
CLASS="FUNCTION"
1259
 
>img.add_layer</TT
1260
 
> method.</P
1261
 
></DD
1262
 
><DT
1263
 
><TT
1264
 
CLASS="FUNCTION"
1265
 
>gimp.channel</TT
1266
 
>(<TT
1267
 
CLASS="PARAMETER"
1268
 
><I
1269
 
>img</I
1270
 
></TT
1271
 
>,
1272
 
          <TT
1273
 
CLASS="PARAMETER"
1274
 
><I
1275
 
>name</I
1276
 
></TT
1277
 
>, <TT
1278
 
CLASS="PARAMETER"
1279
 
><I
1280
 
>width</I
1281
 
></TT
1282
 
>,
1283
 
          <TT
1284
 
CLASS="PARAMETER"
1285
 
><I
1286
 
>height</I
1287
 
></TT
1288
 
>,
1289
 
          <TT
1290
 
CLASS="PARAMETER"
1291
 
><I
1292
 
>opacity</I
1293
 
></TT
1294
 
>,
1295
 
          <TT
1296
 
CLASS="PARAMETER"
1297
 
><I
1298
 
>colour</I
1299
 
></TT
1300
 
>)</DT
1301
 
><DD
1302
 
><P
1303
 
>Create a new channel object with the given
1304
 
            dimensions, <TT
1305
 
CLASS="PARAMETER"
1306
 
><I
1307
 
>opacity</I
1308
 
></TT
1309
 
> and
1310
 
            <TT
1311
 
CLASS="PARAMETER"
1312
 
><I
1313
 
>colour</I
1314
 
></TT
1315
 
> (one of the
1316
 
            <TT
1317
 
CLASS="LITERAL"
1318
 
>*_CHANNEL</TT
1319
 
> constants).  This channel can
1320
 
            then be added to an image.</P
1321
 
></DD
1322
 
><DT
1323
 
><TT
1324
 
CLASS="FUNCTION"
1325
 
>gimp.display</TT
1326
 
>(<TT
1327
 
CLASS="PARAMETER"
1328
 
><I
1329
 
>img</I
1330
 
></TT
1331
 
>)</DT
1332
 
><DD
1333
 
><P
1334
 
>Create a new display window for the given image.
1335
 
            The window will not be displayed until a call to
1336
 
            <TT
1337
 
CLASS="FUNCTION"
1338
 
>gimp.displays_flush</TT
1339
 
> is made.</P
1340
 
></DD
1341
 
><DT
1342
 
><TT
1343
 
CLASS="FUNCTION"
1344
 
>gimp.parasite(name, flags, data)</TT
1345
 
></DT
1346
 
><DD
1347
 
><P
1348
 
>Create a new parasite.  The parasite can then be
1349
 
            attached to gimp, an image or a drawable.  This is only
1350
 
            available in gimp &#62;= 1.1</P
1351
 
></DD
1352
 
></DL
1353
 
></DIV
1354
 
><P
1355
 
>When any of these objects get removed from memory (such as
1356
 
      when their name goes out of range), the gimp thing it represents
1357
 
      does not get deleted with it (otherwise when your plugin
1358
 
      finished running, it would delete all its work).  In order to
1359
 
      delete the thing the Python object represents, you should use
1360
 
      the <TT
1361
 
CLASS="FUNCTION"
1362
 
>gimp.delete</TT
1363
 
> procedure.  It deletes the
1364
 
      gimp thing associated with the Python object given as a
1365
 
      parameter.  If the object is not an image, layer, channel,
1366
 
      drawable or display <TT
1367
 
CLASS="FUNCTION"
1368
 
>gimp.delete</TT
1369
 
> does
1370
 
      nothing.</P
1371
 
></DIV
1372
 
><DIV
1373
 
CLASS="SECT2"
1374
 
><HR><H3
1375
 
CLASS="SECT2"
1376
 
><A
1377
 
NAME="CONFIGURATION-INFORMATION"
1378
 
></A
1379
 
>4.2. Configuration Information</H3
1380
 
><P
1381
 
>There are a number of functions that can be used to gather
1382
 
      information about the environment the plugin is running in:</P
1383
 
><P
1384
 
></P
1385
 
><DIV
1386
 
CLASS="VARIABLELIST"
1387
 
><DL
1388
 
><DT
1389
 
><TT
1390
 
CLASS="FUNCTION"
1391
 
>gimp.color_cube</TT
1392
 
>() or
1393
 
          <TT
1394
 
CLASS="FUNCTION"
1395
 
>gimp.colour_cube</TT
1396
 
>()</DT
1397
 
><DD
1398
 
><P
1399
 
>Returns the current colour cube.</P
1400
 
></DD
1401
 
><DT
1402
 
><TT
1403
 
CLASS="FUNCTION"
1404
 
>gimp.gamma</TT
1405
 
>()</DT
1406
 
><DD
1407
 
><P
1408
 
>Returns the current gamma correction.</P
1409
 
></DD
1410
 
><DT
1411
 
><TT
1412
 
CLASS="FUNCTION"
1413
 
>gimp.install_cmap</TT
1414
 
>()</DT
1415
 
><DD
1416
 
><P
1417
 
>Returns non-zero if a colour map has been
1418
 
            installed.</P
1419
 
></DD
1420
 
><DT
1421
 
><TT
1422
 
CLASS="FUNCTION"
1423
 
>gimp.use_xshm</TT
1424
 
>()</DT
1425
 
><DD
1426
 
><P
1427
 
>Returns non-zero if Gimp is using X shared
1428
 
            memory.</P
1429
 
></DD
1430
 
><DT
1431
 
><TT
1432
 
CLASS="FUNCTION"
1433
 
>gimp.gtkrc</TT
1434
 
>()</DT
1435
 
><DD
1436
 
><P
1437
 
>Returns the file name of the GTK configuration
1438
 
            file.</P
1439
 
></DD
1440
 
></DL
1441
 
></DIV
1442
 
></DIV
1443
 
><DIV
1444
 
CLASS="SECT2"
1445
 
><HR><H3
1446
 
CLASS="SECT2"
1447
 
><A
1448
 
NAME="PALETTE-OPERATIONS"
1449
 
></A
1450
 
>4.3. Palette Operations</H3
1451
 
><P
1452
 
>These functions alter the currently selected foreground
1453
 
      and background.</P
1454
 
><P
1455
 
></P
1456
 
><DIV
1457
 
CLASS="VARIABLELIST"
1458
 
><DL
1459
 
><DT
1460
 
><TT
1461
 
CLASS="FUNCTION"
1462
 
>gimp.get_background</TT
1463
 
>()</DT
1464
 
><DD
1465
 
><P
1466
 
>Returns a 3-tuple containing the current background
1467
 
            colour in RGB form.</P
1468
 
></DD
1469
 
><DT
1470
 
><TT
1471
 
CLASS="FUNCTION"
1472
 
>gimp.get_foreground</TT
1473
 
>()</DT
1474
 
><DD
1475
 
><P
1476
 
>Returns a 3-tuple containing the current foreground
1477
 
            colour in RGB form.</P
1478
 
></DD
1479
 
><DT
1480
 
><TT
1481
 
CLASS="FUNCTION"
1482
 
>gimp.set_background</TT
1483
 
>(<TT
1484
 
CLASS="PARAMETER"
1485
 
><I
1486
 
>r</I
1487
 
></TT
1488
 
>,
1489
 
          <TT
1490
 
CLASS="PARAMETER"
1491
 
><I
1492
 
>g</I
1493
 
></TT
1494
 
>, <TT
1495
 
CLASS="PARAMETER"
1496
 
><I
1497
 
>b</I
1498
 
></TT
1499
 
>)</DT
1500
 
><DD
1501
 
><P
1502
 
>Sets the current background colour.  The three
1503
 
            arguments can be replaced by a single 3-tuple like that
1504
 
            returned by <TT
1505
 
CLASS="FUNCTION"
1506
 
>gimp.get_background</TT
1507
 
>.</P
1508
 
></DD
1509
 
><DT
1510
 
><TT
1511
 
CLASS="FUNCTION"
1512
 
>gimp.set_foreground</TT
1513
 
>(<TT
1514
 
CLASS="PARAMETER"
1515
 
><I
1516
 
>r</I
1517
 
></TT
1518
 
>,
1519
 
          <TT
1520
 
CLASS="PARAMETER"
1521
 
><I
1522
 
>g</I
1523
 
></TT
1524
 
>, <TT
1525
 
CLASS="PARAMETER"
1526
 
><I
1527
 
>b</I
1528
 
></TT
1529
 
>)</DT
1530
 
><DD
1531
 
><P
1532
 
>Sets the current foreground colour.  Like
1533
 
            <TT
1534
 
CLASS="FUNCTION"
1535
 
>gimp.set_background</TT
1536
 
>, the arguments may
1537
 
            be replaced by a 3-tuple.</P
1538
 
></DD
1539
 
></DL
1540
 
></DIV
1541
 
></DIV
1542
 
><DIV
1543
 
CLASS="SECT2"
1544
 
><HR><H3
1545
 
CLASS="SECT2"
1546
 
><A
1547
 
NAME="GRADIENT-OPERATIONS"
1548
 
></A
1549
 
>4.4. Gradient Operations</H3
1550
 
><P
1551
 
>These functions perform operations on gradients:</P
1552
 
><P
1553
 
></P
1554
 
><DIV
1555
 
CLASS="VARIABLELIST"
1556
 
><DL
1557
 
><DT
1558
 
><TT
1559
 
CLASS="FUNCTION"
1560
 
>gimp.gradients_get_active</TT
1561
 
>()</DT
1562
 
><DD
1563
 
><P
1564
 
>Returns the name of the active gradient.</P
1565
 
></DD
1566
 
><DT
1567
 
><TT
1568
 
CLASS="FUNCTION"
1569
 
>gimp.gradients_set_active</TT
1570
 
>(<TT
1571
 
CLASS="PARAMETER"
1572
 
><I
1573
 
>name</I
1574
 
></TT
1575
 
>)</DT
1576
 
><DD
1577
 
><P
1578
 
>Sets the active gradient.</P
1579
 
></DD
1580
 
><DT
1581
 
><TT
1582
 
CLASS="FUNCTION"
1583
 
>gimp.gradients_get_list</TT
1584
 
>()</DT
1585
 
><DD
1586
 
><P
1587
 
>Returns a list of the names of the available
1588
 
            gradients.</P
1589
 
></DD
1590
 
><DT
1591
 
><TT
1592
 
CLASS="FUNCTION"
1593
 
>gimp.gradients_sample_uniform</TT
1594
 
>(<TT
1595
 
CLASS="PARAMETER"
1596
 
><I
1597
 
>num</I
1598
 
></TT
1599
 
>)</DT
1600
 
><DD
1601
 
><P
1602
 
>Returns a list of <TT
1603
 
CLASS="PARAMETER"
1604
 
><I
1605
 
>num</I
1606
 
></TT
1607
 
>
1608
 
            samples, where samples consist of 4-tuples of floats
1609
 
            representing the red, green, blue and alpha values for the
1610
 
            sample.</P
1611
 
></DD
1612
 
><DT
1613
 
><TT
1614
 
CLASS="FUNCTION"
1615
 
>gimp.gradients_sample_custom</TT
1616
 
>(<TT
1617
 
CLASS="PARAMETER"
1618
 
><I
1619
 
>pos</I
1620
 
></TT
1621
 
>)</DT
1622
 
><DD
1623
 
><P
1624
 
>Similar to
1625
 
            <TT
1626
 
CLASS="FUNCTION"
1627
 
>gimp.gradients_sample_uniform</TT
1628
 
>, except
1629
 
            the samples are taken at the positions given in the list
1630
 
            of floats <TT
1631
 
CLASS="PARAMETER"
1632
 
><I
1633
 
>pos</I
1634
 
></TT
1635
 
> instead of uniformly
1636
 
            through the gradient.</P
1637
 
></DD
1638
 
></DL
1639
 
></DIV
1640
 
></DIV
1641
 
><DIV
1642
 
CLASS="SECT2"
1643
 
><HR><H3
1644
 
CLASS="SECT2"
1645
 
><A
1646
 
NAME="PDB-REGISTRATION-FUNCTIONS"
1647
 
></A
1648
 
>4.5. PDB Registration Functions</H3
1649
 
><P
1650
 
>These functions either install procedures into the PDB or
1651
 
      alert gimp to their special use (eg as file handlers).</P
1652
 
><P
1653
 
>For simple plugins, you will usually only need to use
1654
 
      <TT
1655
 
CLASS="FUNCTION"
1656
 
>register</TT
1657
 
> from gimpfu.</P
1658
 
><P
1659
 
></P
1660
 
><DIV
1661
 
CLASS="VARIABLELIST"
1662
 
><DL
1663
 
><DT
1664
 
><TT
1665
 
CLASS="FUNCTION"
1666
 
>gimp.install_procedure</TT
1667
 
>(<TT
1668
 
CLASS="PARAMETER"
1669
 
><I
1670
 
>name</I
1671
 
></TT
1672
 
>,
1673
 
          <TT
1674
 
CLASS="PARAMETER"
1675
 
><I
1676
 
>blurb</I
1677
 
></TT
1678
 
>, <TT
1679
 
CLASS="PARAMETER"
1680
 
><I
1681
 
>help</I
1682
 
></TT
1683
 
>,
1684
 
          <TT
1685
 
CLASS="PARAMETER"
1686
 
><I
1687
 
>author</I
1688
 
></TT
1689
 
>,
1690
 
          <TT
1691
 
CLASS="PARAMETER"
1692
 
><I
1693
 
>copyright</I
1694
 
></TT
1695
 
>,
1696
 
          <TT
1697
 
CLASS="PARAMETER"
1698
 
><I
1699
 
>date</I
1700
 
></TT
1701
 
>,
1702
 
          <TT
1703
 
CLASS="PARAMETER"
1704
 
><I
1705
 
>menu_path</I
1706
 
></TT
1707
 
>,
1708
 
          <TT
1709
 
CLASS="PARAMETER"
1710
 
><I
1711
 
>image_types</I
1712
 
></TT
1713
 
>,
1714
 
          <TT
1715
 
CLASS="PARAMETER"
1716
 
><I
1717
 
>type</I
1718
 
></TT
1719
 
>, <TT
1720
 
CLASS="PARAMETER"
1721
 
><I
1722
 
>params</I
1723
 
></TT
1724
 
>,
1725
 
          <TT
1726
 
CLASS="PARAMETER"
1727
 
><I
1728
 
>ret_vals</I
1729
 
></TT
1730
 
>)</DT
1731
 
><DD
1732
 
><P
1733
 
>This procedure is used to install a procedure into
1734
 
            the PDB.  The first eight parameters are strings,
1735
 
            <TT
1736
 
CLASS="PARAMETER"
1737
 
><I
1738
 
>type</I
1739
 
></TT
1740
 
> is a one of the
1741
 
            <TT
1742
 
CLASS="LITERAL"
1743
 
>PROC_*</TT
1744
 
> constants, and the last two
1745
 
            parameters are sequences describing the parameters and
1746
 
            return values.  Their format is the same as the param and
1747
 
            ret_vals methods or PDB procedures.</P
1748
 
></DD
1749
 
><DT
1750
 
><TT
1751
 
CLASS="FUNCTION"
1752
 
>gimp.install_temp_proc</TT
1753
 
>(<TT
1754
 
CLASS="PARAMETER"
1755
 
><I
1756
 
>name</I
1757
 
></TT
1758
 
>,
1759
 
          <TT
1760
 
CLASS="PARAMETER"
1761
 
><I
1762
 
>blurb</I
1763
 
></TT
1764
 
>, <TT
1765
 
CLASS="PARAMETER"
1766
 
><I
1767
 
>help</I
1768
 
></TT
1769
 
>,
1770
 
          <TT
1771
 
CLASS="PARAMETER"
1772
 
><I
1773
 
>author</I
1774
 
></TT
1775
 
>,
1776
 
          <TT
1777
 
CLASS="PARAMETER"
1778
 
><I
1779
 
>copyright</I
1780
 
></TT
1781
 
>,
1782
 
          <TT
1783
 
CLASS="PARAMETER"
1784
 
><I
1785
 
>date</I
1786
 
></TT
1787
 
>,
1788
 
          <TT
1789
 
CLASS="PARAMETER"
1790
 
><I
1791
 
>menu_path</I
1792
 
></TT
1793
 
>,
1794
 
          <TT
1795
 
CLASS="PARAMETER"
1796
 
><I
1797
 
>image_types</I
1798
 
></TT
1799
 
>, <TT
1800
 
CLASS="PARAMETER"
1801
 
><I
1802
 
>type,
1803
 
          params</I
1804
 
></TT
1805
 
>, <TT
1806
 
CLASS="PARAMETER"
1807
 
><I
1808
 
>ret_vals</I
1809
 
></TT
1810
 
>)</DT
1811
 
><DD
1812
 
><P
1813
 
>This procedure is used to install a procedure into
1814
 
            the PDB temporarily.  That is, it must be added again
1815
 
            every time gimp is run.  This procedure will be called the
1816
 
            same way as all other procedures for a plugin.</P
1817
 
></DD
1818
 
><DT
1819
 
><TT
1820
 
CLASS="FUNCTION"
1821
 
>gimp.uninstall_temp_proc</TT
1822
 
>(<TT
1823
 
CLASS="PARAMETER"
1824
 
><I
1825
 
>name</I
1826
 
></TT
1827
 
>)</DT
1828
 
><DD
1829
 
><P
1830
 
>This removes a temporary procedure from the
1831
 
            PDB.</P
1832
 
></DD
1833
 
><DT
1834
 
><TT
1835
 
CLASS="FUNCTION"
1836
 
>gimp.register_magic_load_handle</TT
1837
 
>r(<TT
1838
 
CLASS="PARAMETER"
1839
 
><I
1840
 
>name</I
1841
 
></TT
1842
 
>,
1843
 
          <TT
1844
 
CLASS="PARAMETER"
1845
 
><I
1846
 
>extensions</I
1847
 
></TT
1848
 
>,
1849
 
          <TT
1850
 
CLASS="PARAMETER"
1851
 
><I
1852
 
>prefixes</I
1853
 
></TT
1854
 
>,
1855
 
          <TT
1856
 
CLASS="PARAMETER"
1857
 
><I
1858
 
>magics</I
1859
 
></TT
1860
 
>)</DT
1861
 
><DD
1862
 
><P
1863
 
>This procedure tells Gimp that the PDB procedure
1864
 
            <TT
1865
 
CLASS="PARAMETER"
1866
 
><I
1867
 
>name</I
1868
 
></TT
1869
 
> can load files with
1870
 
            <TT
1871
 
CLASS="PARAMETER"
1872
 
><I
1873
 
>extensions</I
1874
 
></TT
1875
 
> and
1876
 
            <TT
1877
 
CLASS="PARAMETER"
1878
 
><I
1879
 
>prefixes</I
1880
 
></TT
1881
 
> (eg http:) with magic
1882
 
            information <TT
1883
 
CLASS="PARAMETER"
1884
 
><I
1885
 
>magics</I
1886
 
></TT
1887
 
>.</P
1888
 
></DD
1889
 
><DT
1890
 
><TT
1891
 
CLASS="FUNCTION"
1892
 
>gimp.register_load_handler</TT
1893
 
>(<TT
1894
 
CLASS="PARAMETER"
1895
 
><I
1896
 
>name</I
1897
 
></TT
1898
 
>,
1899
 
          <TT
1900
 
CLASS="PARAMETER"
1901
 
><I
1902
 
>extensions</I
1903
 
></TT
1904
 
>,
1905
 
          <TT
1906
 
CLASS="PARAMETER"
1907
 
><I
1908
 
>prefixes</I
1909
 
></TT
1910
 
>)</DT
1911
 
><DD
1912
 
><P
1913
 
>This procedure tells Gimp that the PDB procedure
1914
 
            <TT
1915
 
CLASS="PARAMETER"
1916
 
><I
1917
 
>name</I
1918
 
></TT
1919
 
> can load files with
1920
 
            <TT
1921
 
CLASS="PARAMETER"
1922
 
><I
1923
 
>extensions</I
1924
 
></TT
1925
 
> and
1926
 
            <TT
1927
 
CLASS="PARAMETER"
1928
 
><I
1929
 
>prefixes</I
1930
 
></TT
1931
 
> (eg http:).</P
1932
 
></DD
1933
 
><DT
1934
 
><TT
1935
 
CLASS="FUNCTION"
1936
 
>gimp.register_save_handler</TT
1937
 
>(<TT
1938
 
CLASS="PARAMETER"
1939
 
><I
1940
 
>name</I
1941
 
></TT
1942
 
>,
1943
 
          <TT
1944
 
CLASS="PARAMETER"
1945
 
><I
1946
 
>extensions</I
1947
 
></TT
1948
 
>,
1949
 
          <TT
1950
 
CLASS="PARAMETER"
1951
 
><I
1952
 
>prefixes</I
1953
 
></TT
1954
 
>)</DT
1955
 
><DD
1956
 
><P
1957
 
>This procedure tells Gimp that the PDB procedure
1958
 
            <TT
1959
 
CLASS="PARAMETER"
1960
 
><I
1961
 
>name</I
1962
 
></TT
1963
 
> can save files with
1964
 
            <TT
1965
 
CLASS="PARAMETER"
1966
 
><I
1967
 
>extensions</I
1968
 
></TT
1969
 
> and
1970
 
            <TT
1971
 
CLASS="PARAMETER"
1972
 
><I
1973
 
>prefixes</I
1974
 
></TT
1975
 
> (eg http:).</P
1976
 
></DD
1977
 
></DL
1978
 
></DIV
1979
 
></DIV
1980
 
><DIV
1981
 
CLASS="SECT2"
1982
 
><HR><H3
1983
 
CLASS="SECT2"
1984
 
><A
1985
 
NAME="OTHER-FUNCTIONS"
1986
 
></A
1987
 
>4.6. Other Functions</H3
1988
 
><P
1989
 
>These are the other functions in the
1990
 
      <TT
1991
 
CLASS="FILENAME"
1992
 
>gimp</TT
1993
 
> module.</P
1994
 
><P
1995
 
></P
1996
 
><DIV
1997
 
CLASS="VARIABLELIST"
1998
 
><DL
1999
 
><DT
2000
 
><TT
2001
 
CLASS="FUNCTION"
2002
 
>gimp.main</TT
2003
 
>(<TT
2004
 
CLASS="PARAMETER"
2005
 
><I
2006
 
>init_func</I
2007
 
></TT
2008
 
>,
2009
 
          <TT
2010
 
CLASS="PARAMETER"
2011
 
><I
2012
 
>quit_func</I
2013
 
></TT
2014
 
>,
2015
 
          <TT
2016
 
CLASS="PARAMETER"
2017
 
><I
2018
 
>query_func</I
2019
 
></TT
2020
 
>,
2021
 
          <TT
2022
 
CLASS="PARAMETER"
2023
 
><I
2024
 
>run_func</I
2025
 
></TT
2026
 
>)</DT
2027
 
><DD
2028
 
><P
2029
 
>This function is the one that controls the execution
2030
 
            of a Gimp-Python plugin.  It is better to not use this
2031
 
            directly but rather subclass the plugin class, defined in
2032
 
            the <A
2033
 
HREF="#GIMPPLUGIN-MODULE"
2034
 
>Section 6.3</A
2035
 
>.</P
2036
 
></DD
2037
 
><DT
2038
 
><TT
2039
 
CLASS="PARAMETER"
2040
 
><I
2041
 
>gimp.pdb</I
2042
 
></TT
2043
 
></DT
2044
 
><DD
2045
 
><P
2046
 
>The procedural database object.</P
2047
 
></DD
2048
 
><DT
2049
 
><TT
2050
 
CLASS="FUNCTION"
2051
 
>gimp.progress_init</TT
2052
 
>(<TT
2053
 
CLASS="PARAMETER"
2054
 
><I
2055
 
>[label]</I
2056
 
></TT
2057
 
>)</DT
2058
 
><DD
2059
 
><P
2060
 
>(Re)Initialise the progress meter with
2061
 
            <TT
2062
 
CLASS="PARAMETER"
2063
 
><I
2064
 
>label</I
2065
 
></TT
2066
 
> (or the plugin name) as a
2067
 
            label in the window.</P
2068
 
></DD
2069
 
><DT
2070
 
><TT
2071
 
CLASS="FUNCTION"
2072
 
>gimp.progress_update</TT
2073
 
>(<TT
2074
 
CLASS="PARAMETER"
2075
 
><I
2076
 
>percnt</I
2077
 
></TT
2078
 
>)</DT
2079
 
><DD
2080
 
><P
2081
 
>Set the progress meter to
2082
 
            <TT
2083
 
CLASS="PARAMETER"
2084
 
><I
2085
 
>percnt</I
2086
 
></TT
2087
 
> done.</P
2088
 
></DD
2089
 
><DT
2090
 
><TT
2091
 
CLASS="FUNCTION"
2092
 
>gimp.query_images</TT
2093
 
>()</DT
2094
 
><DD
2095
 
><P
2096
 
>Returns a list of all the image objects.</P
2097
 
></DD
2098
 
><DT
2099
 
><TT
2100
 
CLASS="FUNCTION"
2101
 
>gimp.quit</TT
2102
 
>()</DT
2103
 
><DD
2104
 
><P
2105
 
>Stops execution imediately and exits.</P
2106
 
></DD
2107
 
><DT
2108
 
><TT
2109
 
CLASS="FUNCTION"
2110
 
>gimp.displays_flush</TT
2111
 
>()</DT
2112
 
><DD
2113
 
><P
2114
 
>Update all the display windows.</P
2115
 
></DD
2116
 
><DT
2117
 
><TT
2118
 
CLASS="FUNCTION"
2119
 
>gimp.tile_width</TT
2120
 
>()</DT
2121
 
><DD
2122
 
><P
2123
 
>The maximum width of a tile.</P
2124
 
></DD
2125
 
><DT
2126
 
><TT
2127
 
CLASS="FUNCTION"
2128
 
>gimp.tile_height</TT
2129
 
>()</DT
2130
 
><DD
2131
 
><P
2132
 
>The maximum height of a tile.</P
2133
 
></DD
2134
 
><DT
2135
 
><TT
2136
 
CLASS="FUNCTION"
2137
 
>gimp.tile_cache_size</TT
2138
 
>(<TT
2139
 
CLASS="PARAMETER"
2140
 
><I
2141
 
>kb</I
2142
 
></TT
2143
 
>)</DT
2144
 
><DD
2145
 
><P
2146
 
>Set the size of the tile cache in kilobytes.</P
2147
 
></DD
2148
 
><DT
2149
 
><TT
2150
 
CLASS="FUNCTION"
2151
 
>gimp.tile_cache_ntiles</TT
2152
 
>(<TT
2153
 
CLASS="PARAMETER"
2154
 
><I
2155
 
>n</I
2156
 
></TT
2157
 
>)</DT
2158
 
><DD
2159
 
><P
2160
 
>Set the size of the tile cache in tiles.</P
2161
 
></DD
2162
 
><DT
2163
 
><TT
2164
 
CLASS="FUNCTION"
2165
 
>gimp.get_data</TT
2166
 
>(<TT
2167
 
CLASS="PARAMETER"
2168
 
><I
2169
 
>key</I
2170
 
></TT
2171
 
>)</DT
2172
 
><DD
2173
 
><P
2174
 
>Get the information associated with
2175
 
            <TT
2176
 
CLASS="PARAMETER"
2177
 
><I
2178
 
>key</I
2179
 
></TT
2180
 
>.  The data will be a string.
2181
 
            This function should probably be used through the <A
2182
 
HREF="#GIMPSHELF-MODULE"
2183
 
>Section 6.4</A
2184
 
>.</P
2185
 
></DD
2186
 
><DT
2187
 
><TT
2188
 
CLASS="FUNCTION"
2189
 
>gimp.set_data</TT
2190
 
>(<TT
2191
 
CLASS="PARAMETER"
2192
 
><I
2193
 
>key</I
2194
 
></TT
2195
 
>,
2196
 
          <TT
2197
 
CLASS="PARAMETER"
2198
 
><I
2199
 
>data</I
2200
 
></TT
2201
 
>)</DT
2202
 
><DD
2203
 
><P
2204
 
>Set the information in the string
2205
 
            <TT
2206
 
CLASS="PARAMETER"
2207
 
><I
2208
 
>data</I
2209
 
></TT
2210
 
> with
2211
 
            <TT
2212
 
CLASS="PARAMETER"
2213
 
><I
2214
 
>key</I
2215
 
></TT
2216
 
>.  The data will persist for the
2217
 
            whole gimp session.  Rather than directly accessing this
2218
 
            function, it is better to go through the <A
2219
 
HREF="#GIMPSHELF-MODULE"
2220
 
>Section 6.4</A
2221
 
>.</P
2222
 
></DD
2223
 
><DT
2224
 
><TT
2225
 
CLASS="FUNCTION"
2226
 
>gimp.extension_ack</TT
2227
 
>()</DT
2228
 
><DD
2229
 
><P
2230
 
>Tells gimp that the plugin has finished its work,
2231
 
            while keeping the plugin connection open.  This is used by
2232
 
            an extension plugin to tell gimp it can continue, while
2233
 
            leaving the plugin connection open.  This is what the
2234
 
            script-fu plugin does so that only one scheme interpretter
2235
 
            is needed.</P
2236
 
></DD
2237
 
><DT
2238
 
><TT
2239
 
CLASS="FUNCTION"
2240
 
>gimp.extension_process</TT
2241
 
>(<TT
2242
 
CLASS="PARAMETER"
2243
 
><I
2244
 
>timeout</I
2245
 
></TT
2246
 
>)</DT
2247
 
><DD
2248
 
><P
2249
 
>Makes the plugin check for messages from gimp.
2250
 
            generally this is not needed, as messages are checked
2251
 
            during most calls in the gimp module.</P
2252
 
></DD
2253
 
></DL
2254
 
></DIV
2255
 
></DIV
2256
 
><DIV
2257
 
CLASS="SECT2"
2258
 
><HR><H3
2259
 
CLASS="SECT2"
2260
 
><A
2261
 
NAME="PARASITES"
2262
 
></A
2263
 
>4.7. Parasites</H3
2264
 
><P
2265
 
>In gimp &#62;= 1.1, it is possible to attach arbitrary data to
2266
 
      an image through the use of parasites.  Parasites are simply
2267
 
      wrappers for the data, containing its name and some flags.
2268
 
      Parasites have the following parameters:</P
2269
 
><P
2270
 
></P
2271
 
><DIV
2272
 
CLASS="VARIABLELIST"
2273
 
><DL
2274
 
><DT
2275
 
>data</DT
2276
 
><DD
2277
 
><P
2278
 
>The data for the parasite -- a string</P
2279
 
></DD
2280
 
><DT
2281
 
>flags</DT
2282
 
><DD
2283
 
><P
2284
 
>The flags for the parasite</P
2285
 
></DD
2286
 
><DT
2287
 
>is_persistent</DT
2288
 
><DD
2289
 
><P
2290
 
>True if this parasite is persistent</P
2291
 
></DD
2292
 
><DT
2293
 
>is_undoable</DT
2294
 
><DD
2295
 
><P
2296
 
>True if this parasite is undoable</P
2297
 
></DD
2298
 
><DT
2299
 
>name</DT
2300
 
><DD
2301
 
><P
2302
 
>The name of the parasite</P
2303
 
></DD
2304
 
></DL
2305
 
></DIV
2306
 
><P
2307
 
>Parasites also have the methods <TT
2308
 
CLASS="FUNCTION"
2309
 
>copy</TT
2310
 
>,
2311
 
      <TT
2312
 
CLASS="FUNCTION"
2313
 
>is_type</TT
2314
 
> and
2315
 
      <TT
2316
 
CLASS="FUNCTION"
2317
 
>has_flag</TT
2318
 
>.</P
2319
 
><P
2320
 
>There is a set of four functions that are used to
2321
 
      manipulate parasites.  They exist as functions in the
2322
 
      <TT
2323
 
CLASS="FILENAME"
2324
 
>gimp</TT
2325
 
> module, and methods for image and
2326
 
      drawable objects.  They are:</P
2327
 
><P
2328
 
></P
2329
 
><DIV
2330
 
CLASS="VARIABLELIST"
2331
 
><DL
2332
 
><DT
2333
 
><TT
2334
 
CLASS="FUNCTION"
2335
 
>parasite_find</TT
2336
 
>(<TT
2337
 
CLASS="PARAMETER"
2338
 
><I
2339
 
>name</I
2340
 
></TT
2341
 
>)</DT
2342
 
><DD
2343
 
><P
2344
 
>find a parasite by its name.</P
2345
 
></DD
2346
 
><DT
2347
 
><TT
2348
 
CLASS="FUNCTION"
2349
 
>parasite_attach</TT
2350
 
>(<TT
2351
 
CLASS="PARAMETER"
2352
 
><I
2353
 
>parasite</I
2354
 
></TT
2355
 
>)</DT
2356
 
><DD
2357
 
><P
2358
 
>Attach a parasite to this object.</P
2359
 
></DD
2360
 
><DT
2361
 
><TT
2362
 
CLASS="FUNCTION"
2363
 
>attach_new_parasite</TT
2364
 
>(<TT
2365
 
CLASS="PARAMETER"
2366
 
><I
2367
 
>name</I
2368
 
></TT
2369
 
>, <TT
2370
 
CLASS="PARAMETER"
2371
 
><I
2372
 
>flags</I
2373
 
></TT
2374
 
>, <TT
2375
 
CLASS="PARAMETER"
2376
 
><I
2377
 
>data</I
2378
 
></TT
2379
 
>)</DT
2380
 
><DD
2381
 
><P
2382
 
>Create a new parasite and attach it.</P
2383
 
></DD
2384
 
><DT
2385
 
><TT
2386
 
CLASS="FUNCTION"
2387
 
>parasite_detach</TT
2388
 
>(<TT
2389
 
CLASS="PARAMETER"
2390
 
><I
2391
 
>name</I
2392
 
></TT
2393
 
>)</DT
2394
 
><DD
2395
 
><P
2396
 
>Detach the named parasite</P
2397
 
></DD
2398
 
></DL
2399
 
></DIV
2400
 
></DIV
2401
 
></DIV
2402
 
><DIV
2403
 
CLASS="SECT1"
2404
 
><HR><H2
2405
 
CLASS="SECT1"
2406
 
><A
2407
 
NAME="GIMP-OBJECTS"
2408
 
></A
2409
 
>5. Gimp Objects</H2
2410
 
><P
2411
 
>Gimp-Python implements a number of special object types that
2412
 
    represent the different types of parameters you can pass to a PDB
2413
 
    procedure.  Rather than just making these place holders, I have
2414
 
    added a number of members and methods to them that allow a lot of
2415
 
    configurability without directly calling PDB procedures.</P
2416
 
><P
2417
 
>There are also a couple of extra objects that allow low
2418
 
    level manipulation of images.  These are tile objects (working)
2419
 
    and pixel regions (not quite finished).</P
2420
 
><DIV
2421
 
CLASS="SECT2"
2422
 
><HR><H3
2423
 
CLASS="SECT2"
2424
 
><A
2425
 
NAME="IMAGE-OBJECT"
2426
 
></A
2427
 
>5.1. Image Object</H3
2428
 
><P
2429
 
>This is the object that represents an open image.  In this
2430
 
      section, <TT
2431
 
CLASS="REPLACEABLE"
2432
 
><I
2433
 
>image</I
2434
 
></TT
2435
 
> represents a generic
2436
 
      image object.</P
2437
 
><DIV
2438
 
CLASS="SECT3"
2439
 
><HR><H4
2440
 
CLASS="SECT3"
2441
 
><A
2442
 
NAME="IMAGE-OBJECT-MEMBERS"
2443
 
></A
2444
 
>5.1.1. Image Members</H4
2445
 
><P
2446
 
></P
2447
 
><P
2448
 
></P
2449
 
><DIV
2450
 
CLASS="VARIABLELIST"
2451
 
><DL
2452
 
><DT
2453
 
><TT
2454
 
CLASS="REPLACEABLE"
2455
 
><I
2456
 
>image</I
2457
 
></TT
2458
 
>.<TT
2459
 
CLASS="PARAMETER"
2460
 
><I
2461
 
>active_channel</I
2462
 
></TT
2463
 
></DT
2464
 
><DD
2465
 
><P
2466
 
>This is the active channel of the image.  You can
2467
 
              also assign to this member, or
2468
 
              <TT
2469
 
CLASS="PARAMETER"
2470
 
><I
2471
 
>None</I
2472
 
></TT
2473
 
> if there is no active
2474
 
              channel.</P
2475
 
></DD
2476
 
><DT
2477
 
><TT
2478
 
CLASS="REPLACEABLE"
2479
 
><I
2480
 
>image</I
2481
 
></TT
2482
 
>.<TT
2483
 
CLASS="PARAMETER"
2484
 
><I
2485
 
>active_layer</I
2486
 
></TT
2487
 
></DT
2488
 
><DD
2489
 
><P
2490
 
>This is the active layer of the image.  You can
2491
 
              also assign to this member, or
2492
 
              <TT
2493
 
CLASS="PARAMETER"
2494
 
><I
2495
 
>None</I
2496
 
></TT
2497
 
> if there is no active
2498
 
              layer.</P
2499
 
></DD
2500
 
><DT
2501
 
><TT
2502
 
CLASS="REPLACEABLE"
2503
 
><I
2504
 
>image</I
2505
 
></TT
2506
 
>.<TT
2507
 
CLASS="PARAMETER"
2508
 
><I
2509
 
>base_type</I
2510
 
></TT
2511
 
></DT
2512
 
><DD
2513
 
><P
2514
 
>This is the type of the image (eg RGB, INDEXED).</P
2515
 
></DD
2516
 
><DT
2517
 
><TT
2518
 
CLASS="REPLACEABLE"
2519
 
><I
2520
 
>image</I
2521
 
></TT
2522
 
>.<TT
2523
 
CLASS="PARAMETER"
2524
 
><I
2525
 
>channels</I
2526
 
></TT
2527
 
></DT
2528
 
><DD
2529
 
><P
2530
 
>This is a list of the channels of the image.
2531
 
              Altering this list has no effect, and you can not assign
2532
 
              to this member.</P
2533
 
></DD
2534
 
><DT
2535
 
><TT
2536
 
CLASS="REPLACEABLE"
2537
 
><I
2538
 
>image</I
2539
 
></TT
2540
 
>.<TT
2541
 
CLASS="PARAMETER"
2542
 
><I
2543
 
>cmap</I
2544
 
></TT
2545
 
></DT
2546
 
><DD
2547
 
><P
2548
 
>This is the colour map for the image.</P
2549
 
></DD
2550
 
><DT
2551
 
><TT
2552
 
CLASS="REPLACEABLE"
2553
 
><I
2554
 
>image</I
2555
 
></TT
2556
 
>.<TT
2557
 
CLASS="PARAMETER"
2558
 
><I
2559
 
>filename</I
2560
 
></TT
2561
 
></DT
2562
 
><DD
2563
 
><P
2564
 
>This is the filename for the image.  A file load
2565
 
              or save handler might assign to this.</P
2566
 
></DD
2567
 
><DT
2568
 
><TT
2569
 
CLASS="REPLACEABLE"
2570
 
><I
2571
 
>image</I
2572
 
></TT
2573
 
>.<TT
2574
 
CLASS="PARAMETER"
2575
 
><I
2576
 
>height</I
2577
 
></TT
2578
 
></DT
2579
 
><DD
2580
 
><P
2581
 
>This is the height of the image.  You can't assign
2582
 
              to this member.</P
2583
 
></DD
2584
 
><DT
2585
 
><TT
2586
 
CLASS="REPLACEABLE"
2587
 
><I
2588
 
>image</I
2589
 
></TT
2590
 
>.<TT
2591
 
CLASS="PARAMETER"
2592
 
><I
2593
 
>floating_selection</I
2594
 
></TT
2595
 
></DT
2596
 
><DD
2597
 
><P
2598
 
>The floating selection layer, or
2599
 
              <TT
2600
 
CLASS="PARAMETER"
2601
 
><I
2602
 
>None</I
2603
 
></TT
2604
 
> if there is no floating
2605
 
              selection.</P
2606
 
></DD
2607
 
><DT
2608
 
><TT
2609
 
CLASS="REPLACEABLE"
2610
 
><I
2611
 
>image</I
2612
 
></TT
2613
 
>.<TT
2614
 
CLASS="PARAMETER"
2615
 
><I
2616
 
>layers</I
2617
 
></TT
2618
 
></DT
2619
 
><DD
2620
 
><P
2621
 
>This is a list of the layers of the image.</P
2622
 
></DD
2623
 
><DT
2624
 
><TT
2625
 
CLASS="REPLACEABLE"
2626
 
><I
2627
 
>image</I
2628
 
></TT
2629
 
>.<TT
2630
 
CLASS="PARAMETER"
2631
 
><I
2632
 
>selection</I
2633
 
></TT
2634
 
></DT
2635
 
><DD
2636
 
><P
2637
 
>The selection mask for the image.</P
2638
 
></DD
2639
 
><DT
2640
 
><TT
2641
 
CLASS="REPLACEABLE"
2642
 
><I
2643
 
>image</I
2644
 
></TT
2645
 
>.<TT
2646
 
CLASS="PARAMETER"
2647
 
><I
2648
 
>width</I
2649
 
></TT
2650
 
></DT
2651
 
><DD
2652
 
><P
2653
 
>This is the width of the image.  You can't assign
2654
 
              to this member.</P
2655
 
></DD
2656
 
></DL
2657
 
></DIV
2658
 
></DIV
2659
 
><DIV
2660
 
CLASS="SECT3"
2661
 
><HR><H4
2662
 
CLASS="SECT3"
2663
 
><A
2664
 
NAME="IMAGE-OBJECT-METHODS"
2665
 
></A
2666
 
>5.1.2. Image Methods</H4
2667
 
><P
2668
 
></P
2669
 
><P
2670
 
></P
2671
 
><DIV
2672
 
CLASS="VARIABLELIST"
2673
 
><DL
2674
 
><DT
2675
 
><TT
2676
 
CLASS="REPLACEABLE"
2677
 
><I
2678
 
>image</I
2679
 
></TT
2680
 
>.<TT
2681
 
CLASS="FUNCTION"
2682
 
>add_channel</TT
2683
 
>(<TT
2684
 
CLASS="PARAMETER"
2685
 
><I
2686
 
>channel</I
2687
 
></TT
2688
 
>,
2689
 
            <TT
2690
 
CLASS="PARAMETER"
2691
 
><I
2692
 
>position</I
2693
 
></TT
2694
 
>)</DT
2695
 
><DD
2696
 
><P
2697
 
>Adds <TT
2698
 
CLASS="PARAMETER"
2699
 
><I
2700
 
>channel</I
2701
 
></TT
2702
 
> to
2703
 
              <TT
2704
 
CLASS="REPLACEABLE"
2705
 
><I
2706
 
>image</I
2707
 
></TT
2708
 
> in position
2709
 
              <TT
2710
 
CLASS="PARAMETER"
2711
 
><I
2712
 
>position</I
2713
 
></TT
2714
 
>.</P
2715
 
></DD
2716
 
><DT
2717
 
><TT
2718
 
CLASS="REPLACEABLE"
2719
 
><I
2720
 
>image</I
2721
 
></TT
2722
 
>.<TT
2723
 
CLASS="FUNCTION"
2724
 
>add_layer</TT
2725
 
>(<TT
2726
 
CLASS="PARAMETER"
2727
 
><I
2728
 
>layer</I
2729
 
></TT
2730
 
>,
2731
 
            <TT
2732
 
CLASS="PARAMETER"
2733
 
><I
2734
 
>position</I
2735
 
></TT
2736
 
>)</DT
2737
 
><DD
2738
 
><P
2739
 
>Adds <TT
2740
 
CLASS="PARAMETER"
2741
 
><I
2742
 
>layer</I
2743
 
></TT
2744
 
> to
2745
 
              <TT
2746
 
CLASS="REPLACEABLE"
2747
 
><I
2748
 
>image</I
2749
 
></TT
2750
 
> in position
2751
 
              <TT
2752
 
CLASS="PARAMETER"
2753
 
><I
2754
 
>position</I
2755
 
></TT
2756
 
>.</P
2757
 
></DD
2758
 
><DT
2759
 
><TT
2760
 
CLASS="REPLACEABLE"
2761
 
><I
2762
 
>image</I
2763
 
></TT
2764
 
>.<TT
2765
 
CLASS="FUNCTION"
2766
 
>add_layer_mask</TT
2767
 
>(<TT
2768
 
CLASS="PARAMETER"
2769
 
><I
2770
 
>layer</I
2771
 
></TT
2772
 
>,
2773
 
            <TT
2774
 
CLASS="PARAMETER"
2775
 
><I
2776
 
>mask</I
2777
 
></TT
2778
 
>)</DT
2779
 
><DD
2780
 
><P
2781
 
>Adds the mask <TT
2782
 
CLASS="PARAMETER"
2783
 
><I
2784
 
>mask</I
2785
 
></TT
2786
 
> to
2787
 
              <TT
2788
 
CLASS="PARAMETER"
2789
 
><I
2790
 
>layer</I
2791
 
></TT
2792
 
>.</P
2793
 
></DD
2794
 
><DT
2795
 
><TT
2796
 
CLASS="REPLACEABLE"
2797
 
><I
2798
 
>image</I
2799
 
></TT
2800
 
>.<TT
2801
 
CLASS="FUNCTION"
2802
 
>clean_all</TT
2803
 
>()</DT
2804
 
><DD
2805
 
><P
2806
 
>Unsets the dirty flag on the image.</P
2807
 
></DD
2808
 
><DT
2809
 
><TT
2810
 
CLASS="REPLACEABLE"
2811
 
><I
2812
 
>image</I
2813
 
></TT
2814
 
>.<TT
2815
 
CLASS="FUNCTION"
2816
 
>disable_undo</TT
2817
 
>()</DT
2818
 
><DD
2819
 
><P
2820
 
>Disables undo for
2821
 
              <TT
2822
 
CLASS="REPLACEABLE"
2823
 
><I
2824
 
>image</I
2825
 
></TT
2826
 
>.</P
2827
 
></DD
2828
 
><DT
2829
 
><TT
2830
 
CLASS="REPLACEABLE"
2831
 
><I
2832
 
>image</I
2833
 
></TT
2834
 
>.<TT
2835
 
CLASS="FUNCTION"
2836
 
>enable_undo</TT
2837
 
>()</DT
2838
 
><DD
2839
 
><P
2840
 
>Enables undo for <TT
2841
 
CLASS="REPLACEABLE"
2842
 
><I
2843
 
>image</I
2844
 
></TT
2845
 
>.
2846
 
              You might use these commands round a plugin, so that the
2847
 
              plugin's actions can be undone in a single step.</P
2848
 
></DD
2849
 
><DT
2850
 
><TT
2851
 
CLASS="REPLACEABLE"
2852
 
><I
2853
 
>image</I
2854
 
></TT
2855
 
>.<TT
2856
 
CLASS="FUNCTION"
2857
 
>flatten</TT
2858
 
>()</DT
2859
 
><DD
2860
 
><P
2861
 
>Returns the resulting layer after merging all the
2862
 
              visible layers, discarding non visible ones and
2863
 
              stripping the alpha channel.</P
2864
 
></DD
2865
 
><DT
2866
 
><TT
2867
 
CLASS="REPLACEABLE"
2868
 
><I
2869
 
>image</I
2870
 
></TT
2871
 
>.<TT
2872
 
CLASS="FUNCTION"
2873
 
>get_component_active</TT
2874
 
>(<TT
2875
 
CLASS="PARAMETER"
2876
 
><I
2877
 
>component</I
2878
 
></TT
2879
 
>)</DT
2880
 
><DD
2881
 
><P
2882
 
>Returns true if <TT
2883
 
CLASS="PARAMETER"
2884
 
><I
2885
 
>component</I
2886
 
></TT
2887
 
>
2888
 
              (one of the <TT
2889
 
CLASS="LITERAL"
2890
 
>*_CHANNEL</TT
2891
 
> constants) is
2892
 
              active.</P
2893
 
></DD
2894
 
><DT
2895
 
><TT
2896
 
CLASS="REPLACEABLE"
2897
 
><I
2898
 
>image</I
2899
 
></TT
2900
 
>.<TT
2901
 
CLASS="FUNCTION"
2902
 
>get_component_visible</TT
2903
 
>(<TT
2904
 
CLASS="PARAMETER"
2905
 
><I
2906
 
>component</I
2907
 
></TT
2908
 
>)</DT
2909
 
><DD
2910
 
><P
2911
 
>Returns true if <TT
2912
 
CLASS="PARAMETER"
2913
 
><I
2914
 
>component</I
2915
 
></TT
2916
 
>
2917
 
              is visible.</P
2918
 
></DD
2919
 
><DT
2920
 
><TT
2921
 
CLASS="REPLACEABLE"
2922
 
><I
2923
 
>image</I
2924
 
></TT
2925
 
>.<TT
2926
 
CLASS="FUNCTION"
2927
 
>set_component_active</TT
2928
 
>(<TT
2929
 
CLASS="PARAMETER"
2930
 
><I
2931
 
>component</I
2932
 
></TT
2933
 
>,
2934
 
            <TT
2935
 
CLASS="PARAMETER"
2936
 
><I
2937
 
>active</I
2938
 
></TT
2939
 
>)</DT
2940
 
><DD
2941
 
><P
2942
 
>Sets the activeness of
2943
 
              <TT
2944
 
CLASS="PARAMETER"
2945
 
><I
2946
 
>component</I
2947
 
></TT
2948
 
>.</P
2949
 
></DD
2950
 
><DT
2951
 
><TT
2952
 
CLASS="REPLACEABLE"
2953
 
><I
2954
 
>image</I
2955
 
></TT
2956
 
>.<TT
2957
 
CLASS="FUNCTION"
2958
 
>set_component_visible</TT
2959
 
>(<TT
2960
 
CLASS="PARAMETER"
2961
 
><I
2962
 
>component</I
2963
 
></TT
2964
 
>,
2965
 
            <TT
2966
 
CLASS="PARAMETER"
2967
 
><I
2968
 
>active</I
2969
 
></TT
2970
 
>)</DT
2971
 
><DD
2972
 
><P
2973
 
>Sets the visibility of
2974
 
              <TT
2975
 
CLASS="PARAMETER"
2976
 
><I
2977
 
>component</I
2978
 
></TT
2979
 
>.</P
2980
 
></DD
2981
 
><DT
2982
 
><TT
2983
 
CLASS="REPLACEABLE"
2984
 
><I
2985
 
>image</I
2986
 
></TT
2987
 
>.<TT
2988
 
CLASS="FUNCTION"
2989
 
>lower_channel</TT
2990
 
>(<TT
2991
 
CLASS="PARAMETER"
2992
 
><I
2993
 
>channel</I
2994
 
></TT
2995
 
>)</DT
2996
 
><DD
2997
 
><P
2998
 
>Lowers <TT
2999
 
CLASS="PARAMETER"
3000
 
><I
3001
 
>channel</I
3002
 
></TT
3003
 
>.</P
3004
 
></DD
3005
 
><DT
3006
 
><TT
3007
 
CLASS="REPLACEABLE"
3008
 
><I
3009
 
>image</I
3010
 
></TT
3011
 
>.<TT
3012
 
CLASS="FUNCTION"
3013
 
>lower_layer</TT
3014
 
>(<TT
3015
 
CLASS="PARAMETER"
3016
 
><I
3017
 
>layer</I
3018
 
></TT
3019
 
>)</DT
3020
 
><DD
3021
 
><P
3022
 
>Lowers <TT
3023
 
CLASS="PARAMETER"
3024
 
><I
3025
 
>layer</I
3026
 
></TT
3027
 
>.</P
3028
 
></DD
3029
 
><DT
3030
 
><TT
3031
 
CLASS="REPLACEABLE"
3032
 
><I
3033
 
>image</I
3034
 
></TT
3035
 
>.<TT
3036
 
CLASS="FUNCTION"
3037
 
>merge_visible_layers</TT
3038
 
>(<TT
3039
 
CLASS="PARAMETER"
3040
 
><I
3041
 
>type</I
3042
 
></TT
3043
 
>)</DT
3044
 
><DD
3045
 
><P
3046
 
>Merges the visible layers of
3047
 
              <TT
3048
 
CLASS="REPLACEABLE"
3049
 
><I
3050
 
>image</I
3051
 
></TT
3052
 
> using the given merge
3053
 
              type.</P
3054
 
></DD
3055
 
><DT
3056
 
><TT
3057
 
CLASS="REPLACEABLE"
3058
 
><I
3059
 
>image</I
3060
 
></TT
3061
 
>.<TT
3062
 
CLASS="FUNCTION"
3063
 
>pick_correlate_layer</TT
3064
 
>(<TT
3065
 
CLASS="PARAMETER"
3066
 
><I
3067
 
>x</I
3068
 
></TT
3069
 
>,
3070
 
            <TT
3071
 
CLASS="PARAMETER"
3072
 
><I
3073
 
>y</I
3074
 
></TT
3075
 
>)</DT
3076
 
><DD
3077
 
><P
3078
 
>Returns the layer that is visible at the point
3079
 
              <TT
3080
 
CLASS="PARAMETER"
3081
 
><I
3082
 
>(x,y)</I
3083
 
></TT
3084
 
>, or
3085
 
              <TT
3086
 
CLASS="PARAMETER"
3087
 
><I
3088
 
>None</I
3089
 
></TT
3090
 
> if no layer matches.</P
3091
 
></DD
3092
 
><DT
3093
 
><TT
3094
 
CLASS="REPLACEABLE"
3095
 
><I
3096
 
>image</I
3097
 
></TT
3098
 
>.<TT
3099
 
CLASS="FUNCTION"
3100
 
>raise_channel</TT
3101
 
>(<TT
3102
 
CLASS="PARAMETER"
3103
 
><I
3104
 
>channel</I
3105
 
></TT
3106
 
>)</DT
3107
 
><DD
3108
 
><P
3109
 
>Raises <TT
3110
 
CLASS="PARAMETER"
3111
 
><I
3112
 
>channel</I
3113
 
></TT
3114
 
>.</P
3115
 
></DD
3116
 
><DT
3117
 
><TT
3118
 
CLASS="REPLACEABLE"
3119
 
><I
3120
 
>image</I
3121
 
></TT
3122
 
>.<TT
3123
 
CLASS="FUNCTION"
3124
 
>raise_layer</TT
3125
 
>(<TT
3126
 
CLASS="PARAMETER"
3127
 
><I
3128
 
>layer</I
3129
 
></TT
3130
 
>)</DT
3131
 
><DD
3132
 
><P
3133
 
>Raises <TT
3134
 
CLASS="PARAMETER"
3135
 
><I
3136
 
>layer</I
3137
 
></TT
3138
 
>.</P
3139
 
></DD
3140
 
><DT
3141
 
><TT
3142
 
CLASS="REPLACEABLE"
3143
 
><I
3144
 
>image</I
3145
 
></TT
3146
 
>.<TT
3147
 
CLASS="FUNCTION"
3148
 
>remove_channel</TT
3149
 
>(<TT
3150
 
CLASS="PARAMETER"
3151
 
><I
3152
 
>channel</I
3153
 
></TT
3154
 
>)</DT
3155
 
><DD
3156
 
><P
3157
 
>Removes <TT
3158
 
CLASS="PARAMETER"
3159
 
><I
3160
 
>channel</I
3161
 
></TT
3162
 
> from
3163
 
              <TT
3164
 
CLASS="REPLACEABLE"
3165
 
><I
3166
 
>image</I
3167
 
></TT
3168
 
>.</P
3169
 
></DD
3170
 
><DT
3171
 
><TT
3172
 
CLASS="REPLACEABLE"
3173
 
><I
3174
 
>image</I
3175
 
></TT
3176
 
>.<TT
3177
 
CLASS="FUNCTION"
3178
 
>remove_layer</TT
3179
 
>(<TT
3180
 
CLASS="PARAMETER"
3181
 
><I
3182
 
>layer</I
3183
 
></TT
3184
 
>)</DT
3185
 
><DD
3186
 
><P
3187
 
>Removes <TT
3188
 
CLASS="PARAMETER"
3189
 
><I
3190
 
>layer</I
3191
 
></TT
3192
 
> from
3193
 
              <TT
3194
 
CLASS="REPLACEABLE"
3195
 
><I
3196
 
>image</I
3197
 
></TT
3198
 
>.</P
3199
 
></DD
3200
 
><DT
3201
 
><TT
3202
 
CLASS="REPLACEABLE"
3203
 
><I
3204
 
>image</I
3205
 
></TT
3206
 
>.<TT
3207
 
CLASS="FUNCTION"
3208
 
>remove_layer_mask</TT
3209
 
>(<TT
3210
 
CLASS="PARAMETER"
3211
 
><I
3212
 
>layer</I
3213
 
></TT
3214
 
>,
3215
 
            <TT
3216
 
CLASS="PARAMETER"
3217
 
><I
3218
 
>mode</I
3219
 
></TT
3220
 
>)</DT
3221
 
><DD
3222
 
><P
3223
 
>Removes the mask from
3224
 
              <TT
3225
 
CLASS="PARAMETER"
3226
 
><I
3227
 
>layer</I
3228
 
></TT
3229
 
>, with the given
3230
 
              <TT
3231
 
CLASS="PARAMETER"
3232
 
><I
3233
 
>mode</I
3234
 
></TT
3235
 
> (either APPLY or
3236
 
              DISCARD).</P
3237
 
></DD
3238
 
><DT
3239
 
><TT
3240
 
CLASS="REPLACEABLE"
3241
 
><I
3242
 
>image</I
3243
 
></TT
3244
 
>.<TT
3245
 
CLASS="FUNCTION"
3246
 
>resize</TT
3247
 
>(<TT
3248
 
CLASS="PARAMETER"
3249
 
><I
3250
 
>width</I
3251
 
></TT
3252
 
>,
3253
 
            <TT
3254
 
CLASS="PARAMETER"
3255
 
><I
3256
 
>height</I
3257
 
></TT
3258
 
>, <TT
3259
 
CLASS="PARAMETER"
3260
 
><I
3261
 
>x</I
3262
 
></TT
3263
 
>,
3264
 
            <TT
3265
 
CLASS="PARAMETER"
3266
 
><I
3267
 
>y</I
3268
 
></TT
3269
 
>)</DT
3270
 
><DD
3271
 
><P
3272
 
>Resizes the image to size <TT
3273
 
CLASS="PARAMETER"
3274
 
><I
3275
 
>(width,
3276
 
              height)</I
3277
 
></TT
3278
 
> and places the old contents at
3279
 
              position <TT
3280
 
CLASS="PARAMETER"
3281
 
><I
3282
 
>(x,y)</I
3283
 
></TT
3284
 
>.</P
3285
 
></DD
3286
 
></DL
3287
 
></DIV
3288
 
></DIV
3289
 
></DIV
3290
 
><DIV
3291
 
CLASS="SECT2"
3292
 
><HR><H3
3293
 
CLASS="SECT2"
3294
 
><A
3295
 
NAME="CHANNEL-OBJECT"
3296
 
></A
3297
 
>5.2. Channel Objects</H3
3298
 
><P
3299
 
>These objects represent a Gimp Image's colour channels.
3300
 
      In this section, <TT
3301
 
CLASS="REPLACEABLE"
3302
 
><I
3303
 
>channel</I
3304
 
></TT
3305
 
> will refer
3306
 
      to a generic channel object.</P
3307
 
><DIV
3308
 
CLASS="SECT3"
3309
 
><HR><H4
3310
 
CLASS="SECT3"
3311
 
><A
3312
 
NAME="CHANNEL-OBJECT-MEMBERS"
3313
 
></A
3314
 
>5.2.1. Channel Members</H4
3315
 
><P
3316
 
></P
3317
 
><P
3318
 
></P
3319
 
><DIV
3320
 
CLASS="VARIABLELIST"
3321
 
><DL
3322
 
><DT
3323
 
><TT
3324
 
CLASS="REPLACEABLE"
3325
 
><I
3326
 
>channel</I
3327
 
></TT
3328
 
>.<TT
3329
 
CLASS="PARAMETER"
3330
 
><I
3331
 
>colour</I
3332
 
></TT
3333
 
>
3334
 
            or
3335
 
            <TT
3336
 
CLASS="REPLACEABLE"
3337
 
><I
3338
 
>channel</I
3339
 
></TT
3340
 
>.<TT
3341
 
CLASS="PARAMETER"
3342
 
><I
3343
 
>color</I
3344
 
></TT
3345
 
></DT
3346
 
><DD
3347
 
><P
3348
 
>The colour of the channel.</P
3349
 
></DD
3350
 
><DT
3351
 
><TT
3352
 
CLASS="REPLACEABLE"
3353
 
><I
3354
 
>channel</I
3355
 
></TT
3356
 
>.<TT
3357
 
CLASS="PARAMETER"
3358
 
><I
3359
 
>height</I
3360
 
></TT
3361
 
></DT
3362
 
><DD
3363
 
><P
3364
 
>The height of the channel.</P
3365
 
></DD
3366
 
><DT
3367
 
><TT
3368
 
CLASS="REPLACEABLE"
3369
 
><I
3370
 
>channel</I
3371
 
></TT
3372
 
>.<TT
3373
 
CLASS="PARAMETER"
3374
 
><I
3375
 
>width</I
3376
 
></TT
3377
 
></DT
3378
 
><DD
3379
 
><P
3380
 
>The width of the channel.</P
3381
 
></DD
3382
 
><DT
3383
 
><TT
3384
 
CLASS="REPLACEABLE"
3385
 
><I
3386
 
>channel</I
3387
 
></TT
3388
 
>.<TT
3389
 
CLASS="PARAMETER"
3390
 
><I
3391
 
>image</I
3392
 
></TT
3393
 
></DT
3394
 
><DD
3395
 
><P
3396
 
>The image the channel belongs to, or
3397
 
              <TT
3398
 
CLASS="PARAMETER"
3399
 
><I
3400
 
>None</I
3401
 
></TT
3402
 
> if it isn't attached
3403
 
              yet.</P
3404
 
></DD
3405
 
><DT
3406
 
><TT
3407
 
CLASS="REPLACEABLE"
3408
 
><I
3409
 
>channel</I
3410
 
></TT
3411
 
>.<TT
3412
 
CLASS="PARAMETER"
3413
 
><I
3414
 
>layer</I
3415
 
></TT
3416
 
></DT
3417
 
><DD
3418
 
><P
3419
 
>The channel's layer (??) or
3420
 
              <TT
3421
 
CLASS="PARAMETER"
3422
 
><I
3423
 
>None</I
3424
 
></TT
3425
 
> if one doesn't exist.</P
3426
 
></DD
3427
 
><DT
3428
 
><TT
3429
 
CLASS="REPLACEABLE"
3430
 
><I
3431
 
>channel</I
3432
 
></TT
3433
 
>.<TT
3434
 
CLASS="PARAMETER"
3435
 
><I
3436
 
>layer_mask</I
3437
 
></TT
3438
 
></DT
3439
 
><DD
3440
 
><P
3441
 
>Non zero if the channel is a layer mask.</P
3442
 
></DD
3443
 
><DT
3444
 
><TT
3445
 
CLASS="REPLACEABLE"
3446
 
><I
3447
 
>channel</I
3448
 
></TT
3449
 
>.<TT
3450
 
CLASS="PARAMETER"
3451
 
><I
3452
 
>name</I
3453
 
></TT
3454
 
></DT
3455
 
><DD
3456
 
><P
3457
 
>The name of the channel.</P
3458
 
></DD
3459
 
><DT
3460
 
><TT
3461
 
CLASS="REPLACEABLE"
3462
 
><I
3463
 
>channel</I
3464
 
></TT
3465
 
>.<TT
3466
 
CLASS="PARAMETER"
3467
 
><I
3468
 
>opacity</I
3469
 
></TT
3470
 
></DT
3471
 
><DD
3472
 
><P
3473
 
>The opacity of the channel.</P
3474
 
></DD
3475
 
><DT
3476
 
><TT
3477
 
CLASS="REPLACEABLE"
3478
 
><I
3479
 
>channel</I
3480
 
></TT
3481
 
>.<TT
3482
 
CLASS="PARAMETER"
3483
 
><I
3484
 
>show_masked</I
3485
 
></TT
3486
 
></DT
3487
 
><DD
3488
 
><P
3489
 
>The show_masked value of the channel.</P
3490
 
></DD
3491
 
><DT
3492
 
><TT
3493
 
CLASS="REPLACEABLE"
3494
 
><I
3495
 
>channel</I
3496
 
></TT
3497
 
>.<TT
3498
 
CLASS="PARAMETER"
3499
 
><I
3500
 
>visible</I
3501
 
></TT
3502
 
></DT
3503
 
><DD
3504
 
><P
3505
 
>Non-zero if the channel is visible.</P
3506
 
></DD
3507
 
></DL
3508
 
></DIV
3509
 
></DIV
3510
 
><DIV
3511
 
CLASS="SECT3"
3512
 
><HR><H4
3513
 
CLASS="SECT3"
3514
 
><A
3515
 
NAME="CHANNEL-OBJECT-METHODS"
3516
 
></A
3517
 
>5.2.2. Channel Methods</H4
3518
 
><P
3519
 
></P
3520
 
><P
3521
 
></P
3522
 
><DIV
3523
 
CLASS="VARIABLELIST"
3524
 
><DL
3525
 
><DT
3526
 
><TT
3527
 
CLASS="REPLACEABLE"
3528
 
><I
3529
 
>channel</I
3530
 
></TT
3531
 
>.<TT
3532
 
CLASS="FUNCTION"
3533
 
>copy</TT
3534
 
>()</DT
3535
 
><DD
3536
 
><P
3537
 
>returns a copy of the channel.</P
3538
 
></DD
3539
 
></DL
3540
 
></DIV
3541
 
></DIV
3542
 
></DIV
3543
 
><DIV
3544
 
CLASS="SECT2"
3545
 
><HR><H3
3546
 
CLASS="SECT2"
3547
 
><A
3548
 
NAME="LAYER-OBJECT"
3549
 
></A
3550
 
>5.3. Layer Objects</H3
3551
 
><P
3552
 
>Layer objects represent the layers of a Gimp image.  In
3553
 
      this section I will refer to a generic layer called
3554
 
      <TT
3555
 
CLASS="REPLACEABLE"
3556
 
><I
3557
 
>layer</I
3558
 
></TT
3559
 
>.</P
3560
 
><DIV
3561
 
CLASS="SECT3"
3562
 
><HR><H4
3563
 
CLASS="SECT3"
3564
 
><A
3565
 
NAME="LAYER-OBJECT-MEMBERS"
3566
 
></A
3567
 
>5.3.1. Layer Members</H4
3568
 
><P
3569
 
></P
3570
 
><P
3571
 
></P
3572
 
><DIV
3573
 
CLASS="VARIABLELIST"
3574
 
><DL
3575
 
><DT
3576
 
><TT
3577
 
CLASS="REPLACEABLE"
3578
 
><I
3579
 
>layer</I
3580
 
></TT
3581
 
>.<TT
3582
 
CLASS="PARAMETER"
3583
 
><I
3584
 
>apply_mask</I
3585
 
></TT
3586
 
></DT
3587
 
><DD
3588
 
><P
3589
 
>The apply mask setting. (non zero if the layer
3590
 
              mask is being composited with the layer's alpha
3591
 
              channel).</P
3592
 
></DD
3593
 
><DT
3594
 
><TT
3595
 
CLASS="REPLACEABLE"
3596
 
><I
3597
 
>layer</I
3598
 
></TT
3599
 
>.<TT
3600
 
CLASS="PARAMETER"
3601
 
><I
3602
 
>bpp</I
3603
 
></TT
3604
 
></DT
3605
 
><DD
3606
 
><P
3607
 
>The number of bytes per pixel.</P
3608
 
></DD
3609
 
><DT
3610
 
><TT
3611
 
CLASS="REPLACEABLE"
3612
 
><I
3613
 
>layer</I
3614
 
></TT
3615
 
>.<TT
3616
 
CLASS="PARAMETER"
3617
 
><I
3618
 
>edit_mask</I
3619
 
></TT
3620
 
></DT
3621
 
><DD
3622
 
><P
3623
 
>The edit mask setting.  (non zero if the mask is
3624
 
              active, rather than the layer).</P
3625
 
></DD
3626
 
><DT
3627
 
><TT
3628
 
CLASS="REPLACEABLE"
3629
 
><I
3630
 
>layer</I
3631
 
></TT
3632
 
>.<TT
3633
 
CLASS="PARAMETER"
3634
 
><I
3635
 
>height</I
3636
 
></TT
3637
 
></DT
3638
 
><DD
3639
 
><P
3640
 
>The height of the layer.</P
3641
 
></DD
3642
 
><DT
3643
 
><TT
3644
 
CLASS="REPLACEABLE"
3645
 
><I
3646
 
>layer</I
3647
 
></TT
3648
 
>.<TT
3649
 
CLASS="PARAMETER"
3650
 
><I
3651
 
>image</I
3652
 
></TT
3653
 
></DT
3654
 
><DD
3655
 
><P
3656
 
>The image the layer is part of, or
3657
 
              <TT
3658
 
CLASS="PARAMETER"
3659
 
><I
3660
 
>None</I
3661
 
></TT
3662
 
> if the layer isn't
3663
 
              attached.</P
3664
 
></DD
3665
 
><DT
3666
 
><TT
3667
 
CLASS="REPLACEABLE"
3668
 
><I
3669
 
>layer</I
3670
 
></TT
3671
 
>.<TT
3672
 
CLASS="PARAMETER"
3673
 
><I
3674
 
>is_floating_selection</I
3675
 
></TT
3676
 
></DT
3677
 
><DD
3678
 
><P
3679
 
>Non zero if this layer is the image's floating
3680
 
              selection.</P
3681
 
></DD
3682
 
><DT
3683
 
><TT
3684
 
CLASS="REPLACEABLE"
3685
 
><I
3686
 
>layer</I
3687
 
></TT
3688
 
>.<TT
3689
 
CLASS="PARAMETER"
3690
 
><I
3691
 
>mask</I
3692
 
></TT
3693
 
></DT
3694
 
><DD
3695
 
><P
3696
 
>The layer's mask, or <TT
3697
 
CLASS="PARAMETER"
3698
 
><I
3699
 
>None</I
3700
 
></TT
3701
 
>
3702
 
              if it doesn't have one.</P
3703
 
></DD
3704
 
><DT
3705
 
><TT
3706
 
CLASS="REPLACEABLE"
3707
 
><I
3708
 
>layer</I
3709
 
></TT
3710
 
>.<TT
3711
 
CLASS="PARAMETER"
3712
 
><I
3713
 
>mode</I
3714
 
></TT
3715
 
></DT
3716
 
><DD
3717
 
><P
3718
 
>The mode of the layer.</P
3719
 
></DD
3720
 
><DT
3721
 
><TT
3722
 
CLASS="REPLACEABLE"
3723
 
><I
3724
 
>layer</I
3725
 
></TT
3726
 
>.<TT
3727
 
CLASS="PARAMETER"
3728
 
><I
3729
 
>name</I
3730
 
></TT
3731
 
></DT
3732
 
><DD
3733
 
><P
3734
 
>The name of the layer.</P
3735
 
></DD
3736
 
><DT
3737
 
><TT
3738
 
CLASS="REPLACEABLE"
3739
 
><I
3740
 
>layer</I
3741
 
></TT
3742
 
>.<TT
3743
 
CLASS="PARAMETER"
3744
 
><I
3745
 
>opacity</I
3746
 
></TT
3747
 
></DT
3748
 
><DD
3749
 
><P
3750
 
>The opacity of the layer.</P
3751
 
></DD
3752
 
><DT
3753
 
><TT
3754
 
CLASS="REPLACEABLE"
3755
 
><I
3756
 
>layer</I
3757
 
></TT
3758
 
>.<TT
3759
 
CLASS="PARAMETER"
3760
 
><I
3761
 
>preserve_transparency</I
3762
 
></TT
3763
 
></DT
3764
 
><DD
3765
 
><P
3766
 
>The layer's preserve transparency setting.</P
3767
 
></DD
3768
 
></DL
3769
 
></DIV
3770
 
></DIV
3771
 
><DIV
3772
 
CLASS="SECT3"
3773
 
><HR><H4
3774
 
CLASS="SECT3"
3775
 
><A
3776
 
NAME="LAYER-OBJECT-METHODS"
3777
 
></A
3778
 
>5.3.2. Layer Methods</H4
3779
 
><P
3780
 
></P
3781
 
><P
3782
 
></P
3783
 
><DIV
3784
 
CLASS="VARIABLELIST"
3785
 
><DL
3786
 
><DT
3787
 
><TT
3788
 
CLASS="REPLACEABLE"
3789
 
><I
3790
 
>layer</I
3791
 
></TT
3792
 
>.<TT
3793
 
CLASS="FUNCTION"
3794
 
>add_alpha</TT
3795
 
>()</DT
3796
 
><DD
3797
 
><P
3798
 
>Adds an alpha component to the layer.</P
3799
 
></DD
3800
 
><DT
3801
 
><TT
3802
 
CLASS="REPLACEABLE"
3803
 
><I
3804
 
>layer</I
3805
 
></TT
3806
 
>.<TT
3807
 
CLASS="FUNCTION"
3808
 
>copy</TT
3809
 
>(<TT
3810
 
CLASS="PARAMETER"
3811
 
><I
3812
 
>[alpha]</I
3813
 
></TT
3814
 
>)</DT
3815
 
><DD
3816
 
><P
3817
 
>Creates a copy of the layer, optionally with an
3818
 
              alpha layer.</P
3819
 
></DD
3820
 
><DT
3821
 
><TT
3822
 
CLASS="REPLACEABLE"
3823
 
><I
3824
 
>layer</I
3825
 
></TT
3826
 
>.<TT
3827
 
CLASS="FUNCTION"
3828
 
>create_mask</TT
3829
 
>(<TT
3830
 
CLASS="PARAMETER"
3831
 
><I
3832
 
>type</I
3833
 
></TT
3834
 
>)</DT
3835
 
><DD
3836
 
><P
3837
 
>Creates a layer mask of type
3838
 
              <TT
3839
 
CLASS="PARAMETER"
3840
 
><I
3841
 
>type</I
3842
 
></TT
3843
 
>.</P
3844
 
></DD
3845
 
><DT
3846
 
><TT
3847
 
CLASS="REPLACEABLE"
3848
 
><I
3849
 
>layer</I
3850
 
></TT
3851
 
>.<TT
3852
 
CLASS="FUNCTION"
3853
 
>resize</TT
3854
 
>(<TT
3855
 
CLASS="PARAMETER"
3856
 
><I
3857
 
>w</I
3858
 
></TT
3859
 
>,
3860
 
            <TT
3861
 
CLASS="PARAMETER"
3862
 
><I
3863
 
>h</I
3864
 
></TT
3865
 
>, <TT
3866
 
CLASS="PARAMETER"
3867
 
><I
3868
 
>x</I
3869
 
></TT
3870
 
>,
3871
 
            <TT
3872
 
CLASS="PARAMETER"
3873
 
><I
3874
 
>y</I
3875
 
></TT
3876
 
>)</DT
3877
 
><DD
3878
 
><P
3879
 
>Resizes the layer to <TT
3880
 
CLASS="PARAMETER"
3881
 
><I
3882
 
>(w,
3883
 
              h)</I
3884
 
></TT
3885
 
>, positioning the original contents at
3886
 
              <TT
3887
 
CLASS="PARAMETER"
3888
 
><I
3889
 
>(x,y)</I
3890
 
></TT
3891
 
>.</P
3892
 
></DD
3893
 
><DT
3894
 
><TT
3895
 
CLASS="REPLACEABLE"
3896
 
><I
3897
 
>layer</I
3898
 
></TT
3899
 
>.<TT
3900
 
CLASS="FUNCTION"
3901
 
>scale</TT
3902
 
>(<TT
3903
 
CLASS="PARAMETER"
3904
 
><I
3905
 
>h</I
3906
 
></TT
3907
 
>,
3908
 
            <TT
3909
 
CLASS="PARAMETER"
3910
 
><I
3911
 
>w</I
3912
 
></TT
3913
 
>,
3914
 
            <TT
3915
 
CLASS="PARAMETER"
3916
 
><I
3917
 
>origin</I
3918
 
></TT
3919
 
>)</DT
3920
 
><DD
3921
 
><P
3922
 
>Scales the layer to <TT
3923
 
CLASS="PARAMETER"
3924
 
><I
3925
 
>(w, h)</I
3926
 
></TT
3927
 
>,
3928
 
              using the specified <TT
3929
 
CLASS="PARAMETER"
3930
 
><I
3931
 
>origin</I
3932
 
></TT
3933
 
> (local
3934
 
              or image).</P
3935
 
></DD
3936
 
><DT
3937
 
><TT
3938
 
CLASS="REPLACEABLE"
3939
 
><I
3940
 
>layer</I
3941
 
></TT
3942
 
>.<TT
3943
 
CLASS="FUNCTION"
3944
 
>set_offsets</TT
3945
 
>(<TT
3946
 
CLASS="PARAMETER"
3947
 
><I
3948
 
>x</I
3949
 
></TT
3950
 
>,
3951
 
            <TT
3952
 
CLASS="PARAMETER"
3953
 
><I
3954
 
>y</I
3955
 
></TT
3956
 
>)</DT
3957
 
><DD
3958
 
><P
3959
 
>Sets the offset of the layer, relative to the
3960
 
              image's origin</P
3961
 
></DD
3962
 
><DT
3963
 
><TT
3964
 
CLASS="REPLACEABLE"
3965
 
><I
3966
 
>layer</I
3967
 
></TT
3968
 
>.<TT
3969
 
CLASS="FUNCTION"
3970
 
>translate</TT
3971
 
>(<TT
3972
 
CLASS="PARAMETER"
3973
 
><I
3974
 
>x</I
3975
 
></TT
3976
 
>,
3977
 
            <TT
3978
 
CLASS="PARAMETER"
3979
 
><I
3980
 
>y</I
3981
 
></TT
3982
 
>)</DT
3983
 
><DD
3984
 
><P
3985
 
>Moves the layer to <TT
3986
 
CLASS="PARAMETER"
3987
 
><I
3988
 
>(x, y)</I
3989
 
></TT
3990
 
>
3991
 
              relative to its current position.</P
3992
 
></DD
3993
 
></DL
3994
 
></DIV
3995
 
></DIV
3996
 
></DIV
3997
 
><DIV
3998
 
CLASS="SECT2"
3999
 
><HR><H3
4000
 
CLASS="SECT2"
4001
 
><A
4002
 
NAME="DRAWABLE-OBJECT"
4003
 
></A
4004
 
>5.4. Drawable Objects</H3
4005
 
><P
4006
 
>Both layers and channels are drawables.  Hence there are a
4007
 
      number of operations that can be performed on both objects.
4008
 
      They also have some common attributes and methods.  In the
4009
 
      description of these attributes, I will refer to a generic
4010
 
      drawable called <TT
4011
 
CLASS="REPLACEABLE"
4012
 
><I
4013
 
>drawable</I
4014
 
></TT
4015
 
>.</P
4016
 
><DIV
4017
 
CLASS="SECT3"
4018
 
><HR><H4
4019
 
CLASS="SECT3"
4020
 
><A
4021
 
NAME="DRAWABLE-OBJECT-MEMBERS"
4022
 
></A
4023
 
>5.4.1. Drawable Members</H4
4024
 
><P
4025
 
></P
4026
 
><P
4027
 
></P
4028
 
><DIV
4029
 
CLASS="VARIABLELIST"
4030
 
><DL
4031
 
><DT
4032
 
><TT
4033
 
CLASS="REPLACEABLE"
4034
 
><I
4035
 
>drawable</I
4036
 
></TT
4037
 
>.<TT
4038
 
CLASS="PARAMETER"
4039
 
><I
4040
 
>bpp</I
4041
 
></TT
4042
 
></DT
4043
 
><DD
4044
 
><P
4045
 
>The number of bytes per pixel.</P
4046
 
></DD
4047
 
><DT
4048
 
><TT
4049
 
CLASS="REPLACEABLE"
4050
 
><I
4051
 
>drawable</I
4052
 
></TT
4053
 
>.<TT
4054
 
CLASS="PARAMETER"
4055
 
><I
4056
 
>is_colour</I
4057
 
></TT
4058
 
>
4059
 
            or
4060
 
            <TT
4061
 
CLASS="REPLACEABLE"
4062
 
><I
4063
 
>drawable</I
4064
 
></TT
4065
 
>.<TT
4066
 
CLASS="PARAMETER"
4067
 
><I
4068
 
>is_color</I
4069
 
></TT
4070
 
>
4071
 
            or
4072
 
            <TT
4073
 
CLASS="REPLACEABLE"
4074
 
><I
4075
 
>drawable</I
4076
 
></TT
4077
 
>.<TT
4078
 
CLASS="PARAMETER"
4079
 
><I
4080
 
>is_rgb</I
4081
 
></TT
4082
 
></DT
4083
 
><DD
4084
 
><P
4085
 
>Non zero if the drawable is colour.</P
4086
 
></DD
4087
 
><DT
4088
 
><TT
4089
 
CLASS="REPLACEABLE"
4090
 
><I
4091
 
>drawable</I
4092
 
></TT
4093
 
>.<TT
4094
 
CLASS="PARAMETER"
4095
 
><I
4096
 
>is_grey</I
4097
 
></TT
4098
 
>
4099
 
            or
4100
 
            <TT
4101
 
CLASS="REPLACEABLE"
4102
 
><I
4103
 
>drawable</I
4104
 
></TT
4105
 
>.<TT
4106
 
CLASS="PARAMETER"
4107
 
><I
4108
 
>is_gray</I
4109
 
></TT
4110
 
></DT
4111
 
><DD
4112
 
><P
4113
 
>Non zero if the drawable is greyscale.</P
4114
 
></DD
4115
 
><DT
4116
 
><TT
4117
 
CLASS="REPLACEABLE"
4118
 
><I
4119
 
>drawable</I
4120
 
></TT
4121
 
>.<TT
4122
 
CLASS="PARAMETER"
4123
 
><I
4124
 
>has_alpha</I
4125
 
></TT
4126
 
></DT
4127
 
><DD
4128
 
><P
4129
 
>Non zero if the drawable has an alpha channel.</P
4130
 
></DD
4131
 
><DT
4132
 
><TT
4133
 
CLASS="REPLACEABLE"
4134
 
><I
4135
 
>drawable</I
4136
 
></TT
4137
 
>.<TT
4138
 
CLASS="PARAMETER"
4139
 
><I
4140
 
>height</I
4141
 
></TT
4142
 
></DT
4143
 
><DD
4144
 
><P
4145
 
>The height of the drawable.</P
4146
 
></DD
4147
 
><DT
4148
 
><TT
4149
 
CLASS="REPLACEABLE"
4150
 
><I
4151
 
>drawable</I
4152
 
></TT
4153
 
>.<TT
4154
 
CLASS="PARAMETER"
4155
 
><I
4156
 
>image</I
4157
 
></TT
4158
 
></DT
4159
 
><DD
4160
 
><P
4161
 
>The image the drawable belongs to.</P
4162
 
></DD
4163
 
><DT
4164
 
><TT
4165
 
CLASS="REPLACEABLE"
4166
 
><I
4167
 
>drawable</I
4168
 
></TT
4169
 
>.<TT
4170
 
CLASS="PARAMETER"
4171
 
><I
4172
 
>is_indexed</I
4173
 
></TT
4174
 
></DT
4175
 
><DD
4176
 
><P
4177
 
>Non zero if the drawable uses an indexed colour
4178
 
              scheme.</P
4179
 
></DD
4180
 
><DT
4181
 
><TT
4182
 
CLASS="REPLACEABLE"
4183
 
><I
4184
 
>drawable</I
4185
 
></TT
4186
 
>.<TT
4187
 
CLASS="PARAMETER"
4188
 
><I
4189
 
>mask_bounds</I
4190
 
></TT
4191
 
></DT
4192
 
><DD
4193
 
><P
4194
 
>The bounds of the drawable's selection.</P
4195
 
></DD
4196
 
><DT
4197
 
><TT
4198
 
CLASS="REPLACEABLE"
4199
 
><I
4200
 
>drawable</I
4201
 
></TT
4202
 
>.<TT
4203
 
CLASS="PARAMETER"
4204
 
><I
4205
 
>name</I
4206
 
></TT
4207
 
></DT
4208
 
><DD
4209
 
><P
4210
 
>The name of the drawable.</P
4211
 
></DD
4212
 
><DT
4213
 
><TT
4214
 
CLASS="REPLACEABLE"
4215
 
><I
4216
 
>drawable</I
4217
 
></TT
4218
 
>.<TT
4219
 
CLASS="PARAMETER"
4220
 
><I
4221
 
>offsets</I
4222
 
></TT
4223
 
></DT
4224
 
><DD
4225
 
><P
4226
 
>The offset of the top left hand corner of the
4227
 
              drawable.</P
4228
 
></DD
4229
 
><DT
4230
 
><TT
4231
 
CLASS="REPLACEABLE"
4232
 
><I
4233
 
>drawable</I
4234
 
></TT
4235
 
>.<TT
4236
 
CLASS="PARAMETER"
4237
 
><I
4238
 
>type</I
4239
 
></TT
4240
 
></DT
4241
 
><DD
4242
 
><P
4243
 
>The type of the drawable.</P
4244
 
></DD
4245
 
><DT
4246
 
><TT
4247
 
CLASS="REPLACEABLE"
4248
 
><I
4249
 
>drawable</I
4250
 
></TT
4251
 
>.<TT
4252
 
CLASS="PARAMETER"
4253
 
><I
4254
 
>visible</I
4255
 
></TT
4256
 
></DT
4257
 
><DD
4258
 
><P
4259
 
>Non zero if the drawable is visible.</P
4260
 
></DD
4261
 
><DT
4262
 
><TT
4263
 
CLASS="REPLACEABLE"
4264
 
><I
4265
 
>drawable</I
4266
 
></TT
4267
 
>.<TT
4268
 
CLASS="PARAMETER"
4269
 
><I
4270
 
>width</I
4271
 
></TT
4272
 
></DT
4273
 
><DD
4274
 
><P
4275
 
>The width of the drawable.</P
4276
 
></DD
4277
 
></DL
4278
 
></DIV
4279
 
></DIV
4280
 
><DIV
4281
 
CLASS="SECT3"
4282
 
><HR><H4
4283
 
CLASS="SECT3"
4284
 
><A
4285
 
NAME="DRAWABLE-OBJECT-METHODS"
4286
 
></A
4287
 
>5.4.2. Drawable Methods</H4
4288
 
><P
4289
 
></P
4290
 
><P
4291
 
></P
4292
 
><DIV
4293
 
CLASS="VARIABLELIST"
4294
 
><DL
4295
 
><DT
4296
 
><TT
4297
 
CLASS="REPLACEABLE"
4298
 
><I
4299
 
>drawable</I
4300
 
></TT
4301
 
>.<TT
4302
 
CLASS="FUNCTION"
4303
 
>fill</TT
4304
 
>(<TT
4305
 
CLASS="PARAMETER"
4306
 
><I
4307
 
>fill_type</I
4308
 
></TT
4309
 
>)</DT
4310
 
><DD
4311
 
><P
4312
 
>Fills the drawable with given
4313
 
              <TT
4314
 
CLASS="PARAMETER"
4315
 
><I
4316
 
>fill_type</I
4317
 
></TT
4318
 
> (one of the
4319
 
              <TT
4320
 
CLASS="LITERAL"
4321
 
>*_FILL</TT
4322
 
> constants).</P
4323
 
></DD
4324
 
><DT
4325
 
><TT
4326
 
CLASS="REPLACEABLE"
4327
 
><I
4328
 
>drawable</I
4329
 
></TT
4330
 
>.<TT
4331
 
CLASS="FUNCTION"
4332
 
>flush</TT
4333
 
>()</DT
4334
 
><DD
4335
 
><P
4336
 
>Flush the changes to the drawable.</P
4337
 
></DD
4338
 
><DT
4339
 
><TT
4340
 
CLASS="REPLACEABLE"
4341
 
><I
4342
 
>drawable</I
4343
 
></TT
4344
 
>.<TT
4345
 
CLASS="FUNCTION"
4346
 
>get_pixel_rgn</TT
4347
 
>(<TT
4348
 
CLASS="PARAMETER"
4349
 
><I
4350
 
>x</I
4351
 
></TT
4352
 
>,
4353
 
            <TT
4354
 
CLASS="PARAMETER"
4355
 
><I
4356
 
>y</I
4357
 
></TT
4358
 
>, <TT
4359
 
CLASS="PARAMETER"
4360
 
><I
4361
 
>w</I
4362
 
></TT
4363
 
>,
4364
 
            <TT
4365
 
CLASS="PARAMETER"
4366
 
><I
4367
 
>h</I
4368
 
></TT
4369
 
>, [<TT
4370
 
CLASS="PARAMETER"
4371
 
><I
4372
 
>dirty</I
4373
 
></TT
4374
 
>,
4375
 
            [<TT
4376
 
CLASS="PARAMETER"
4377
 
><I
4378
 
>shadow</I
4379
 
></TT
4380
 
>])</DT
4381
 
><DD
4382
 
><P
4383
 
>Creates a pixel region for the drawable.  It will
4384
 
              cover the region with origin
4385
 
              <TT
4386
 
CLASS="PARAMETER"
4387
 
><I
4388
 
>(x,y)</I
4389
 
></TT
4390
 
> and dimensions <TT
4391
 
CLASS="PARAMETER"
4392
 
><I
4393
 
>w
4394
 
              x h</I
4395
 
></TT
4396
 
>.  The <TT
4397
 
CLASS="PARAMETER"
4398
 
><I
4399
 
>dirty</I
4400
 
></TT
4401
 
>
4402
 
              argument sets whether any changes to the pixel region
4403
 
              will be reflected in the drawable (default is TRUE).
4404
 
              The <TT
4405
 
CLASS="PARAMETER"
4406
 
><I
4407
 
>shadow</I
4408
 
></TT
4409
 
> argument sets whether
4410
 
              the pixel region acts on the shadow tiles or not
4411
 
              (default is FALSE).  If you draw on the shadow tiles,
4412
 
              you must call
4413
 
              <TT
4414
 
CLASS="REPLACEABLE"
4415
 
><I
4416
 
>drawable</I
4417
 
></TT
4418
 
>.<TT
4419
 
CLASS="FUNCTION"
4420
 
>merge_shadow</TT
4421
 
>()
4422
 
              for changes to take effect.</P
4423
 
></DD
4424
 
><DT
4425
 
><TT
4426
 
CLASS="REPLACEABLE"
4427
 
><I
4428
 
>drawable</I
4429
 
></TT
4430
 
>.<TT
4431
 
CLASS="FUNCTION"
4432
 
>get_tile</TT
4433
 
>(<TT
4434
 
CLASS="PARAMETER"
4435
 
><I
4436
 
>shadow</I
4437
 
></TT
4438
 
>,
4439
 
            <TT
4440
 
CLASS="PARAMETER"
4441
 
><I
4442
 
>row</I
4443
 
></TT
4444
 
>,
4445
 
            <TT
4446
 
CLASS="PARAMETER"
4447
 
><I
4448
 
>col</I
4449
 
></TT
4450
 
>)</DT
4451
 
><DD
4452
 
><P
4453
 
>Get a tile at <TT
4454
 
CLASS="PARAMETER"
4455
 
><I
4456
 
>(row,
4457
 
              col)</I
4458
 
></TT
4459
 
>. Either on or off the
4460
 
              <TT
4461
 
CLASS="PARAMETER"
4462
 
><I
4463
 
>shadow</I
4464
 
></TT
4465
 
> buffer.</P
4466
 
></DD
4467
 
><DT
4468
 
><TT
4469
 
CLASS="REPLACEABLE"
4470
 
><I
4471
 
>drawable</I
4472
 
></TT
4473
 
>.<TT
4474
 
CLASS="FUNCTION"
4475
 
>get_tile2</TT
4476
 
>(<TT
4477
 
CLASS="PARAMETER"
4478
 
><I
4479
 
>shadow</I
4480
 
></TT
4481
 
>,
4482
 
            <TT
4483
 
CLASS="PARAMETER"
4484
 
><I
4485
 
>x</I
4486
 
></TT
4487
 
>, <TT
4488
 
CLASS="PARAMETER"
4489
 
><I
4490
 
>y</I
4491
 
></TT
4492
 
>)</DT
4493
 
><DD
4494
 
><P
4495
 
>Get the tile that contains the pixel
4496
 
              <TT
4497
 
CLASS="PARAMETER"
4498
 
><I
4499
 
>(x, y)</I
4500
 
></TT
4501
 
>.</P
4502
 
></DD
4503
 
><DT
4504
 
><TT
4505
 
CLASS="REPLACEABLE"
4506
 
><I
4507
 
>drawable</I
4508
 
></TT
4509
 
>.<TT
4510
 
CLASS="FUNCTION"
4511
 
>merge_shadow</TT
4512
 
>()</DT
4513
 
><DD
4514
 
><P
4515
 
>Merge the shadow buffer back into the
4516
 
              drawable.</P
4517
 
></DD
4518
 
><DT
4519
 
><TT
4520
 
CLASS="REPLACEABLE"
4521
 
><I
4522
 
>drawable</I
4523
 
></TT
4524
 
>.<TT
4525
 
CLASS="FUNCTION"
4526
 
>update</TT
4527
 
>(<TT
4528
 
CLASS="PARAMETER"
4529
 
><I
4530
 
>x</I
4531
 
></TT
4532
 
>,
4533
 
            <TT
4534
 
CLASS="PARAMETER"
4535
 
><I
4536
 
>y</I
4537
 
></TT
4538
 
>, <TT
4539
 
CLASS="PARAMETER"
4540
 
><I
4541
 
>w</I
4542
 
></TT
4543
 
>,
4544
 
            <TT
4545
 
CLASS="PARAMETER"
4546
 
><I
4547
 
>h</I
4548
 
></TT
4549
 
>)</DT
4550
 
><DD
4551
 
><P
4552
 
>Update the given portion of the drawable.</P
4553
 
></DD
4554
 
></DL
4555
 
></DIV
4556
 
></DIV
4557
 
></DIV
4558
 
><DIV
4559
 
CLASS="SECT2"
4560
 
><HR><H3
4561
 
CLASS="SECT2"
4562
 
><A
4563
 
NAME="TILE-OBJECT"
4564
 
></A
4565
 
>5.5. Tile Objects</H3
4566
 
><P
4567
 
>Tile objects represent the way Gimp stores information.  A
4568
 
      tile is basically just a 64x64 pixel region of the drawable.
4569
 
      The reason Gimp breaks the image into small pieces like this is
4570
 
      so that the whole image doesn't have to be loaded into memory in
4571
 
      order to alter one part of it.  This becomes important with
4572
 
      larger images.</P
4573
 
><P
4574
 
>In Gimp-Python, you would use Tiles if you wanted to
4575
 
      perform some low level operation on the image, instead of using
4576
 
      procedures in the PDB.  This type of object gives a Gimp-Python
4577
 
      plugin the power of a C plugin, rather than just the power of a
4578
 
      Script-Fu script.  Tile objects are created with either the
4579
 
      <TT
4580
 
CLASS="REPLACEABLE"
4581
 
><I
4582
 
>drawable</I
4583
 
></TT
4584
 
>.<TT
4585
 
CLASS="FUNCTION"
4586
 
>get_tile</TT
4587
 
>()
4588
 
      or
4589
 
      <TT
4590
 
CLASS="REPLACEABLE"
4591
 
><I
4592
 
>drawable</I
4593
 
></TT
4594
 
>.<TT
4595
 
CLASS="FUNCTION"
4596
 
>get_tile2</TT
4597
 
>()
4598
 
      functions.  In this section, I will refer to a generic tile
4599
 
      object named <TT
4600
 
CLASS="REPLACEABLE"
4601
 
><I
4602
 
>tile</I
4603
 
></TT
4604
 
>.</P
4605
 
><DIV
4606
 
CLASS="SECT3"
4607
 
><HR><H4
4608
 
CLASS="SECT3"
4609
 
><A
4610
 
NAME="TILE-OBJECT-MEMBERS"
4611
 
></A
4612
 
>5.5.1. Tile Members</H4
4613
 
><P
4614
 
>All tile members are read only.</P
4615
 
><P
4616
 
></P
4617
 
><DIV
4618
 
CLASS="VARIABLELIST"
4619
 
><DL
4620
 
><DT
4621
 
><TT
4622
 
CLASS="REPLACEABLE"
4623
 
><I
4624
 
>tile</I
4625
 
></TT
4626
 
>.<TT
4627
 
CLASS="PARAMETER"
4628
 
><I
4629
 
>bpp</I
4630
 
></TT
4631
 
></DT
4632
 
><DD
4633
 
><P
4634
 
>The number of bytes per pixel.</P
4635
 
></DD
4636
 
><DT
4637
 
><TT
4638
 
CLASS="REPLACEABLE"
4639
 
><I
4640
 
>tile</I
4641
 
></TT
4642
 
>.<TT
4643
 
CLASS="PARAMETER"
4644
 
><I
4645
 
>dirty</I
4646
 
></TT
4647
 
></DT
4648
 
><DD
4649
 
><P
4650
 
>If there have been changes to the tile since it
4651
 
              was last flushed.</P
4652
 
></DD
4653
 
><DT
4654
 
><TT
4655
 
CLASS="REPLACEABLE"
4656
 
><I
4657
 
>tile</I
4658
 
></TT
4659
 
>.<TT
4660
 
CLASS="PARAMETER"
4661
 
><I
4662
 
>drawable</I
4663
 
></TT
4664
 
></DT
4665
 
><DD
4666
 
><P
4667
 
>The drawable that the tile is from.</P
4668
 
></DD
4669
 
><DT
4670
 
><TT
4671
 
CLASS="REPLACEABLE"
4672
 
><I
4673
 
>tile</I
4674
 
></TT
4675
 
>.<TT
4676
 
CLASS="PARAMETER"
4677
 
><I
4678
 
>eheight</I
4679
 
></TT
4680
 
></DT
4681
 
><DD
4682
 
><P
4683
 
>The actual height of the tile.</P
4684
 
></DD
4685
 
><DT
4686
 
><TT
4687
 
CLASS="REPLACEABLE"
4688
 
><I
4689
 
>tile</I
4690
 
></TT
4691
 
>.<TT
4692
 
CLASS="PARAMETER"
4693
 
><I
4694
 
>ewidth</I
4695
 
></TT
4696
 
></DT
4697
 
><DD
4698
 
><P
4699
 
>The actual width of the tile.</P
4700
 
></DD
4701
 
><DT
4702
 
><TT
4703
 
CLASS="REPLACEABLE"
4704
 
><I
4705
 
>tile</I
4706
 
></TT
4707
 
>.<TT
4708
 
CLASS="PARAMETER"
4709
 
><I
4710
 
>ref_count</I
4711
 
></TT
4712
 
></DT
4713
 
><DD
4714
 
><P
4715
 
>The reference count of the tile.  (this is
4716
 
              independent of the Python object reference
4717
 
              count).</P
4718
 
></DD
4719
 
><DT
4720
 
><TT
4721
 
CLASS="REPLACEABLE"
4722
 
><I
4723
 
>tile</I
4724
 
></TT
4725
 
>.<TT
4726
 
CLASS="PARAMETER"
4727
 
><I
4728
 
>shadow</I
4729
 
></TT
4730
 
></DT
4731
 
><DD
4732
 
><P
4733
 
>Non zero if the tile is part of the shadow
4734
 
              buffer.</P
4735
 
></DD
4736
 
></DL
4737
 
></DIV
4738
 
></DIV
4739
 
><DIV
4740
 
CLASS="SECT3"
4741
 
><HR><H4
4742
 
CLASS="SECT3"
4743
 
><A
4744
 
NAME="TILE-OBJECT-METHODS"
4745
 
></A
4746
 
>5.5.2. Tile Methods</H4
4747
 
><P
4748
 
></P
4749
 
><P
4750
 
></P
4751
 
><DIV
4752
 
CLASS="VARIABLELIST"
4753
 
><DL
4754
 
><DT
4755
 
><TT
4756
 
CLASS="REPLACEABLE"
4757
 
><I
4758
 
>tile</I
4759
 
></TT
4760
 
>.<TT
4761
 
CLASS="FUNCTION"
4762
 
>flush</TT
4763
 
>()</DT
4764
 
><DD
4765
 
><P
4766
 
>Flush any changes in the tile.  Note that the tile
4767
 
              is automatically flushed when the Python object is
4768
 
              deleted from memory.</P
4769
 
></DD
4770
 
></DL
4771
 
></DIV
4772
 
></DIV
4773
 
><DIV
4774
 
CLASS="SECT3"
4775
 
><HR><H4
4776
 
CLASS="SECT3"
4777
 
><A
4778
 
NAME="TILE-OBJECT-MAPPING"
4779
 
></A
4780
 
>5.5.3. Tile Mapping Behaviour</H4
4781
 
><P
4782
 
>Tile objects also act as a mapping, or sequence.  You
4783
 
        can access the pixels in the tile in one of two ways.  You can
4784
 
        either access them with a single number, which refers to its
4785
 
        position in the tile
4786
 
        (eg. <TT
4787
 
CLASS="REPLACEABLE"
4788
 
><I
4789
 
>tile</I
4790
 
></TT
4791
 
><TT
4792
 
CLASS="LITERAL"
4793
 
>[64]</TT
4794
 
>
4795
 
        refers to the first pixel in the second row of a 64x64 pixel
4796
 
        tile).  The other way is with a tuple, representing the
4797
 
        coordinates on the tile
4798
 
        (eg. <TT
4799
 
CLASS="REPLACEABLE"
4800
 
><I
4801
 
>tile</I
4802
 
></TT
4803
 
><TT
4804
 
CLASS="LITERAL"
4805
 
>[0, 1]</TT
4806
 
>
4807
 
        refers to the first pixel on the second row of the
4808
 
        tile).</P
4809
 
><P
4810
 
>The type of these subscripts is a string of length
4811
 
        <TT
4812
 
CLASS="REPLACEABLE"
4813
 
><I
4814
 
>tile</I
4815
 
></TT
4816
 
>.<TT
4817
 
CLASS="PARAMETER"
4818
 
><I
4819
 
>bpp</I
4820
 
></TT
4821
 
>.
4822
 
        When you assign to a subscript, the dirty flag is
4823
 
        automatically set on the tile, so you don't have to explicitly
4824
 
        set the flag, or flush the tile.</P
4825
 
></DIV
4826
 
></DIV
4827
 
><DIV
4828
 
CLASS="SECT2"
4829
 
><HR><H3
4830
 
CLASS="SECT2"
4831
 
><A
4832
 
NAME="PREGION-OBJECT"
4833
 
></A
4834
 
>5.6. Pixel Regions</H3
4835
 
><P
4836
 
>Pixel region objects give an interface for low level
4837
 
      operations to act on large regions of an image, instead of on
4838
 
      small 64x64 pixel tiles.  In this section I will refer to a
4839
 
      generic pixel region called <TT
4840
 
CLASS="REPLACEABLE"
4841
 
><I
4842
 
>pr</I
4843
 
></TT
4844
 
>.  For
4845
 
      an example of a pixel region's use, please see the example
4846
 
      plugin <TT
4847
 
CLASS="FILENAME"
4848
 
>whirlpinch.py</TT
4849
 
>.</P
4850
 
><DIV
4851
 
CLASS="SECT3"
4852
 
><HR><H4
4853
 
CLASS="SECT3"
4854
 
><A
4855
 
NAME="PREGION-OBJECT-MEMBERS"
4856
 
></A
4857
 
>5.6.1. Pixel Region Members</H4
4858
 
><P
4859
 
></P
4860
 
><P
4861
 
></P
4862
 
><DIV
4863
 
CLASS="VARIABLELIST"
4864
 
><DL
4865
 
><DT
4866
 
><TT
4867
 
CLASS="REPLACEABLE"
4868
 
><I
4869
 
>pr</I
4870
 
></TT
4871
 
>.<TT
4872
 
CLASS="PARAMETER"
4873
 
><I
4874
 
>drawable</I
4875
 
></TT
4876
 
></DT
4877
 
><DD
4878
 
><P
4879
 
>The drawable this pixel region is for.</P
4880
 
></DD
4881
 
><DT
4882
 
><TT
4883
 
CLASS="REPLACEABLE"
4884
 
><I
4885
 
>pr</I
4886
 
></TT
4887
 
>.<TT
4888
 
CLASS="PARAMETER"
4889
 
><I
4890
 
>bpp</I
4891
 
></TT
4892
 
></DT
4893
 
><DD
4894
 
><P
4895
 
>The number of bytes per pixel for the drawable.</P
4896
 
></DD
4897
 
><DT
4898
 
><TT
4899
 
CLASS="REPLACEABLE"
4900
 
><I
4901
 
>pr</I
4902
 
></TT
4903
 
>.<TT
4904
 
CLASS="PARAMETER"
4905
 
><I
4906
 
>rowstride</I
4907
 
></TT
4908
 
></DT
4909
 
><DD
4910
 
><P
4911
 
>The rowstride for the pixel region.</P
4912
 
></DD
4913
 
><DT
4914
 
><TT
4915
 
CLASS="REPLACEABLE"
4916
 
><I
4917
 
>pr</I
4918
 
></TT
4919
 
>.<TT
4920
 
CLASS="PARAMETER"
4921
 
><I
4922
 
>x</I
4923
 
></TT
4924
 
></DT
4925
 
><DD
4926
 
><P
4927
 
>The x coordinate of the top left hand corner.</P
4928
 
></DD
4929
 
><DT
4930
 
><TT
4931
 
CLASS="REPLACEABLE"
4932
 
><I
4933
 
>pr</I
4934
 
></TT
4935
 
>.<TT
4936
 
CLASS="PARAMETER"
4937
 
><I
4938
 
>y</I
4939
 
></TT
4940
 
></DT
4941
 
><DD
4942
 
><P
4943
 
>The y coordinate of the top left hand corner.</P
4944
 
></DD
4945
 
><DT
4946
 
><TT
4947
 
CLASS="REPLACEABLE"
4948
 
><I
4949
 
>pr</I
4950
 
></TT
4951
 
>.<TT
4952
 
CLASS="PARAMETER"
4953
 
><I
4954
 
>w</I
4955
 
></TT
4956
 
></DT
4957
 
><DD
4958
 
><P
4959
 
>The width of the pixel region.</P
4960
 
></DD
4961
 
><DT
4962
 
><TT
4963
 
CLASS="REPLACEABLE"
4964
 
><I
4965
 
>pr</I
4966
 
></TT
4967
 
>.<TT
4968
 
CLASS="PARAMETER"
4969
 
><I
4970
 
>h</I
4971
 
></TT
4972
 
></DT
4973
 
><DD
4974
 
><P
4975
 
>The height of the pixel region.</P
4976
 
></DD
4977
 
><DT
4978
 
><TT
4979
 
CLASS="REPLACEABLE"
4980
 
><I
4981
 
>pr</I
4982
 
></TT
4983
 
>.<TT
4984
 
CLASS="PARAMETER"
4985
 
><I
4986
 
>dirty</I
4987
 
></TT
4988
 
></DT
4989
 
><DD
4990
 
><P
4991
 
>Non zero if changes to the pixel region will be
4992
 
              reflected in the drawable.</P
4993
 
></DD
4994
 
><DT
4995
 
><TT
4996
 
CLASS="REPLACEABLE"
4997
 
><I
4998
 
>pr</I
4999
 
></TT
5000
 
>.<TT
5001
 
CLASS="PARAMETER"
5002
 
><I
5003
 
>shadow</I
5004
 
></TT
5005
 
></DT
5006
 
><DD
5007
 
><P
5008
 
>Non zero if the pixel region acts on the shadow
5009
 
              tiles of the drawable.</P
5010
 
></DD
5011
 
></DL
5012
 
></DIV
5013
 
></DIV
5014
 
><DIV
5015
 
CLASS="SECT3"
5016
 
><HR><H4
5017
 
CLASS="SECT3"
5018
 
><A
5019
 
NAME="PREGION-OBJECT-METHODS"
5020
 
></A
5021
 
>5.6.2. Pixel Region Methods</H4
5022
 
><P
5023
 
></P
5024
 
><P
5025
 
></P
5026
 
><DIV
5027
 
CLASS="VARIABLELIST"
5028
 
><DL
5029
 
><DT
5030
 
><TT
5031
 
CLASS="REPLACEABLE"
5032
 
><I
5033
 
>pr</I
5034
 
></TT
5035
 
>.<TT
5036
 
CLASS="FUNCTION"
5037
 
>resize</TT
5038
 
>(<TT
5039
 
CLASS="PARAMETER"
5040
 
><I
5041
 
>x</I
5042
 
></TT
5043
 
>,
5044
 
            <TT
5045
 
CLASS="PARAMETER"
5046
 
><I
5047
 
>y</I
5048
 
></TT
5049
 
>, <TT
5050
 
CLASS="PARAMETER"
5051
 
><I
5052
 
>w</I
5053
 
></TT
5054
 
>,
5055
 
            <TT
5056
 
CLASS="PARAMETER"
5057
 
><I
5058
 
>h</I
5059
 
></TT
5060
 
>)</DT
5061
 
><DD
5062
 
><P
5063
 
>resize the pixel region so that it operates on the
5064
 
              the region with corner <TT
5065
 
CLASS="PARAMETER"
5066
 
><I
5067
 
>(x, y)</I
5068
 
></TT
5069
 
>
5070
 
              with dimensions <TT
5071
 
CLASS="PARAMETER"
5072
 
><I
5073
 
>w x h</I
5074
 
></TT
5075
 
>.</P
5076
 
></DD
5077
 
></DL
5078
 
></DIV
5079
 
></DIV
5080
 
><DIV
5081
 
CLASS="SECT3"
5082
 
><HR><H4
5083
 
CLASS="SECT3"
5084
 
><A
5085
 
NAME="PREGION-OBJECT-MAPPING"
5086
 
></A
5087
 
>5.6.3. Pixel Region Mapping Behaviour</H4
5088
 
><P
5089
 
>The pixel region acts as a mapping.  The index is a
5090
 
        2-tuple with components that are either integers or slices.
5091
 
        The subscripts may be read and assigned to.  The type of the
5092
 
        subscripts is a string containing the binary data of the
5093
 
        requested region.  Here is a description of the posible
5094
 
        operations:</P
5095
 
><P
5096
 
></P
5097
 
><DIV
5098
 
CLASS="VARIABLELIST"
5099
 
><DL
5100
 
><DT
5101
 
><TT
5102
 
CLASS="REPLACEABLE"
5103
 
><I
5104
 
>pr</I
5105
 
></TT
5106
 
>[<TT
5107
 
CLASS="PARAMETER"
5108
 
><I
5109
 
>x</I
5110
 
></TT
5111
 
>,
5112
 
            <TT
5113
 
CLASS="PARAMETER"
5114
 
><I
5115
 
>y</I
5116
 
></TT
5117
 
>]</DT
5118
 
><DD
5119
 
><P
5120
 
>Get/Set the pixel at
5121
 
              <TT
5122
 
CLASS="PARAMETER"
5123
 
><I
5124
 
>(x,y)</I
5125
 
></TT
5126
 
></P
5127
 
></DD
5128
 
><DT
5129
 
><TT
5130
 
CLASS="REPLACEABLE"
5131
 
><I
5132
 
>pr</I
5133
 
></TT
5134
 
>[<TT
5135
 
CLASS="PARAMETER"
5136
 
><I
5137
 
>x1</I
5138
 
></TT
5139
 
>:<TT
5140
 
CLASS="PARAMETER"
5141
 
><I
5142
 
>x2</I
5143
 
></TT
5144
 
>,
5145
 
            <TT
5146
 
CLASS="PARAMETER"
5147
 
><I
5148
 
>y</I
5149
 
></TT
5150
 
>]</DT
5151
 
><DD
5152
 
><P
5153
 
>Get/Set the row starting at <TT
5154
 
CLASS="PARAMETER"
5155
 
><I
5156
 
>(x1,
5157
 
              y)</I
5158
 
></TT
5159
 
>, width <TT
5160
 
CLASS="PARAMETER"
5161
 
><I
5162
 
>x2 -
5163
 
              x1</I
5164
 
></TT
5165
 
>.</P
5166
 
></DD
5167
 
><DT
5168
 
><TT
5169
 
CLASS="REPLACEABLE"
5170
 
><I
5171
 
>pr</I
5172
 
></TT
5173
 
>[<TT
5174
 
CLASS="PARAMETER"
5175
 
><I
5176
 
>x</I
5177
 
></TT
5178
 
>,
5179
 
            <TT
5180
 
CLASS="PARAMETER"
5181
 
><I
5182
 
>y1</I
5183
 
></TT
5184
 
>:<TT
5185
 
CLASS="PARAMETER"
5186
 
><I
5187
 
>y2</I
5188
 
></TT
5189
 
>]</DT
5190
 
><DD
5191
 
><P
5192
 
>Get/Set the column starting at <TT
5193
 
CLASS="PARAMETER"
5194
 
><I
5195
 
>(x,
5196
 
              y1)</I
5197
 
></TT
5198
 
>, height <TT
5199
 
CLASS="PARAMETER"
5200
 
><I
5201
 
>y2 -
5202
 
              y1</I
5203
 
></TT
5204
 
>.</P
5205
 
></DD
5206
 
><DT
5207
 
><TT
5208
 
CLASS="REPLACEABLE"
5209
 
><I
5210
 
>pr</I
5211
 
></TT
5212
 
>[<TT
5213
 
CLASS="PARAMETER"
5214
 
><I
5215
 
>x1</I
5216
 
></TT
5217
 
>:<TT
5218
 
CLASS="PARAMETER"
5219
 
><I
5220
 
>x2</I
5221
 
></TT
5222
 
>,
5223
 
            <TT
5224
 
CLASS="PARAMETER"
5225
 
><I
5226
 
>y1</I
5227
 
></TT
5228
 
>:<TT
5229
 
CLASS="PARAMETER"
5230
 
><I
5231
 
>y1</I
5232
 
></TT
5233
 
>]</DT
5234
 
><DD
5235
 
><P
5236
 
>Get/Set the rectangle starting at <TT
5237
 
CLASS="PARAMETER"
5238
 
><I
5239
 
>(x1,
5240
 
              y1)</I
5241
 
></TT
5242
 
>, width <TT
5243
 
CLASS="PARAMETER"
5244
 
><I
5245
 
>x2 - x1</I
5246
 
></TT
5247
 
>
5248
 
              and height <TT
5249
 
CLASS="PARAMETER"
5250
 
><I
5251
 
>y2 - y1</I
5252
 
></TT
5253
 
>.</P
5254
 
></DD
5255
 
></DL
5256
 
></DIV
5257
 
></DIV
5258
 
></DIV
5259
 
></DIV
5260
 
><DIV
5261
 
CLASS="SECT1"
5262
 
><HR><H2
5263
 
CLASS="SECT1"
5264
 
><A
5265
 
NAME="SUPPORT-MODULES"
5266
 
></A
5267
 
>6. Support Modules</H2
5268
 
><P
5269
 
>This section describes the modules that help make using the
5270
 
    <TT
5271
 
CLASS="FILENAME"
5272
 
>gimp</TT
5273
 
> module easier.  These range from a set
5274
 
    of constants to storing persistent data.</P
5275
 
><DIV
5276
 
CLASS="SECT2"
5277
 
><HR><H3
5278
 
CLASS="SECT2"
5279
 
><A
5280
 
NAME="GIMPENUMS-MODULE"
5281
 
></A
5282
 
>6.1. The gimpenums Module</H3
5283
 
><P
5284
 
>This module contains all the constants found in the header
5285
 
      <TT
5286
 
CLASS="FILENAME"
5287
 
>libgimp/gimpenums.h</TT
5288
 
>, as well as some extra
5289
 
      constants that are available in Script-Fu.</P
5290
 
></DIV
5291
 
><DIV
5292
 
CLASS="SECT2"
5293
 
><HR><H3
5294
 
CLASS="SECT2"
5295
 
><A
5296
 
NAME="AEN1468"
5297
 
></A
5298
 
>6.2. The gimpfu Module</H3
5299
 
><P
5300
 
>This module was fully described in an earlier section.  It
5301
 
      provides an easy interface for writing plugins, where you do not
5302
 
      need to worry about run_modes, GUI's and saving previous values.
5303
 
      It is the recommended module for writing plugins.</P
5304
 
></DIV
5305
 
><DIV
5306
 
CLASS="SECT2"
5307
 
><HR><H3
5308
 
CLASS="SECT2"
5309
 
><A
5310
 
NAME="GIMPPLUGIN-MODULE"
5311
 
></A
5312
 
>6.3. The gimpplugin Module</H3
5313
 
><P
5314
 
>This module provides the framework for writing Gimp
5315
 
      plugins in Python.  It gives more flexibility for writing
5316
 
      plugins than the gimpfu module, but does not offer as many
5317
 
      features (such as automatic GUI building).</P
5318
 
><P
5319
 
>To use this framework you subclass
5320
 
      <TT
5321
 
CLASS="FUNCTION"
5322
 
>gimpplugin.plugin</TT
5323
 
> like so:</P
5324
 
><PRE
5325
 
CLASS="PROGRAMLISTING"
5326
 
>import gimpplugin
5327
 
class myplugin(gimpplugin.plugin):
5328
 
        def init(self):
5329
 
                # initialisation routines
5330
 
                # called when gimp starts.
5331
 
        def quit(self):
5332
 
                # clean up routines
5333
 
                # called when gimp exits (normally).
5334
 
        def query(self):
5335
 
                # called to find what functionality the plugin provides.
5336
 
                gimp.install_procedure("procname", ...)
5337
 
        # note that this method name matches the first arg of
5338
 
        # gimp.install_procedure
5339
 
        def procname(self, arg1, ...):
5340
 
                # do what ever this plugin should do</PRE
5341
 
></DIV
5342
 
><DIV
5343
 
CLASS="SECT2"
5344
 
><HR><H3
5345
 
CLASS="SECT2"
5346
 
><A
5347
 
NAME="GIMPSHELF-MODULE"
5348
 
></A
5349
 
>6.4. The gimpshelf Module</H3
5350
 
><P
5351
 
>This module gives a nicer interface to the persistent
5352
 
      storage interface for Gimp plugins.  Due to the complicated
5353
 
      nature of Python objects (there is often a lot of connections
5354
 
      between them), it can be dificult to work out what to store in
5355
 
      gimp's persistent storage.  The python interface only allows
5356
 
      storage of strings, so this module wraps pickle and unpickle to
5357
 
      allow persistentstorage of any python object.</P
5358
 
><P
5359
 
>Here is some examples of using this module:</P
5360
 
><PRE
5361
 
CLASS="SCREEN"
5362
 
>&#62;&#62;&#62; from gimpshelf import shelf
5363
 
&#62;&#62;&#62; shelf['james'] = ['forty-two', (42, 42L, 42.0)]
5364
 
&#62;&#62;&#62; shelf.has_key('james')
5365
 
1
5366
 
&#62;&#62;&#62; shelf['james']
5367
 
['forty-two', (42, 42L, 42.0)]</PRE
5368
 
><P
5369
 
>Anything you store with
5370
 
      <TT
5371
 
CLASS="FUNCTION"
5372
 
>gimpshelf.shelf</TT
5373
 
> will exist until Gimp
5374
 
      exits.  This makes this interface perfect for when a plugin is
5375
 
      executed with the run mode
5376
 
      <TT
5377
 
CLASS="LITERAL"
5378
 
>RUN_WITH_LAST_VALS</TT
5379
 
>.</P
5380
 
></DIV
5381
 
></DIV
5382
 
><DIV
5383
 
CLASS="SECT1"
5384
 
><HR><H2
5385
 
CLASS="SECT1"
5386
 
><A
5387
 
NAME="END-NOTE"
5388
 
></A
5389
 
>7. End Note</H2
5390
 
><P
5391
 
>This package is not yet complete, but it has enough in it to
5392
 
    be useful for writing plugins for Gimp.  If you write any plugins
5393
 
    that might be useful as examples, please mail me at <A
5394
 
HREF="mailto:james@daa.com.au"
5395
 
TARGET="_top"
5396
 
>james@daa.com.au</A
5397
 
>.</P
5398
 
></DIV
5399
 
></DIV
5400
 
></BODY
5401
 
></HTML
5402
 
>
 
 
b'\\ No newline at end of file'