1
<!DOCTYPE HTML PUBLIC "-//Norman Walsh//DTD DocBook HTML 1.0//EN">
8
CONTENT="Modular DocBook HTML Stylesheet"><LINK
10
TITLE="Gimp Python Documentation"
11
HREF="pygimp.html"><LINK
13
TITLE="Gimp Module Procedures"
14
HREF="gimp-module-procedures.html"><LINK
16
TITLE="Support Modules"
17
HREF="support-modules.html"></HEAD
30
>Gimp Python Documentation</TH
38
HREF="gimp-module-procedures.html"
51
HREF="support-modules.html"
68
>Gimp-Python implements a number of special object types that
69
represent the different types of parameters you can pass to a PDB
70
procedure. Rather than just making these place holders, I have
71
added a number of members and methods to them that allow a lot of
72
configurability without directly calling PDB procedures.</P
74
>There are also a couple of extra objects that allow low
75
level manipulation of images. These are tile objects (working)
76
and pixel regions (not quite finished).</P
86
>This is the object that represents an open image. In this
92
> represents a generic
99
NAME="IMAGE-OBJECT-MEMBERS"
121
>This is the active channel of the image. You can
122
also assign to this member, or
128
> if there is no active
145
>This is the active layer of the image. You can
146
also assign to this member, or
152
> if there is no active
169
>This is the type of the image (eg RGB, INDEXED).</P
185
>This is a list of the channels of the image.
186
Altering this list has no effect, and you can not assign
203
>This is the colour map for the image.</P
219
>This is the filename for the image. A file load
220
or save handler might assign to this.</P
236
>This is the height of the image. You can't assign
248
>floating_selection</I
253
>The floating selection layer, or
259
> if there is no floating
276
>This is a list of the layers of the image.</P
292
>The selection mask for the image.</P
308
>This is the width of the image. You can't assign
318
NAME="IMAGE-OBJECT-METHODS"
466
>Unsets the dirty flag on the image.</P
504
>Enables undo for <TT
510
You might use these commands round a plugin, so that the
511
plugin's actions can be undone in a single step.</P
527
>Returns the resulting layer after merging all the
528
visible layers, discarding non visible ones and
529
stripping the alpha channel.</P
540
>get_component_active</B
571
>get_component_visible</B
598
>set_component_active</B
614
>Sets the activeness of
631
>set_component_visible</B
647
>Sets the visibility of
716
>merge_visible_layers</B
726
>Merges the visible layers of
732
> using the given merge
744
>pick_correlate_layer</B
760
>Returns the layer that is visible at the point
772
> if no layer matches.</P
899
>remove_layer_mask</B
915
>Removes the mask from
966
>Resizes the image to size <TT
972
> and places the old contents at
988
NAME="CHANNEL-OBJECT"
992
>These objects represent a Gimp Image's colour channels.
999
to a generic channel object.</P
1005
NAME="CHANNEL-OBJECT-MEMBERS"
1039
>The colour of the channel.</P
1055
>The height of the channel.</P
1071
>The width of the channel.</P
1087
>The image the channel belongs to, or
1093
> if it isn't attached
1110
>The channel's layer (??) or
1116
> if one doesn't exist.</P
1132
>Non zero if the channel is a layer mask.</P
1148
>The name of the channel.</P
1164
>The opacity of the channel.</P
1180
>The show_masked value of the channel.</P
1196
>Non-zero if the channel is visible.</P
1205
NAME="CHANNEL-OBJECT-METHODS"
1227
>returns a copy of the channel.</P
1241
>Layer objects represent the layers of a Gimp image. In
1242
this section I will refer to a generic layer called
1254
NAME="LAYER-OBJECT-MEMBERS"
1276
>The apply mask setting. (non zero if the layer
1277
mask is being composited with the layer's alpha
1294
>The number of bytes per pixel.</P
1310
>The edit mask setting. (non zero if the mask is
1311
active, rather than the layer).</P
1327
>The height of the layer.</P
1343
>The image the layer is part of, or
1349
> if the layer isn't
1361
>is_floating_selection</I
1366
>Non zero if this layer is the image's floating
1383
>The layer's mask, or <TT
1389
if it doesn't have one.</P
1405
>The mode of the layer.</P
1421
>The name of the layer.</P
1437
>The opacity of the layer.</P
1448
>preserve_transparency</I
1453
>The layer's preserve transparency setting.</P
1462
NAME="LAYER-OBJECT-METHODS"
1484
>Adds an alpha component to the layer.</P
1505
>Creates a copy of the layer, optionally with an
1527
>Creates a layer mask of type
1571
>Resizes the layer to <TT
1577
>, positioning the original contents at
1616
>Scales the layer to <TT
1622
using the specified <TT
1655
>Sets the offset of the layer, relative to the
1683
>Moves the layer to <TT
1689
relative to its current position.</P
1699
NAME="DRAWABLE-OBJECT"
1700
>Drawable Objects</A
1703
>Both layers and channels are drawables. Hence there are a
1704
number of operations that can be performed on both objects.
1705
They also have some common attributes and methods. In the
1706
description of these attributes, I will refer to a generic
1718
NAME="DRAWABLE-OBJECT-MEMBERS"
1719
>Drawable Members</A
1740
>The number of bytes per pixel.</P
1780
>Non zero if the drawable is colour.</P
1808
>Non zero if the drawable is greyscale.</P
1824
>Non zero if the drawable has an alpha channel.</P
1840
>The height of the drawable.</P
1856
>The image the drawable belongs to.</P
1872
>Non zero if the drawable uses an indexed colour
1889
>The bounds of the drawable's selection.</P
1905
>The name of the drawable.</P
1921
>The offset of the top left hand corner of the
1938
>The type of the drawable.</P
1954
>Non zero if the drawable is visible.</P
1970
>The width of the drawable.</P
1979
NAME="DRAWABLE-OBJECT-METHODS"
1980
>Drawable Methods</A
2006
>Fills the drawable with given
2032
>Flush the changes to the drawable.</P
2081
>Creates a pixel region for the drawable. It will
2082
cover the region with origin
2088
> and dimensions <TT
2100
argument sets whether any changes to the pixel region
2101
will be reflected in the drawable (default is TRUE).
2107
> argument sets whether
2108
the pixel region acts on the shadow tiles or not
2109
(default is FALSE). If you draw on the shadow tiles,
2122
for changes to take effect.</P
2161
>. Either on or off the
2199
>Get the tile that contains the pixel
2221
>Merge the shadow buffer back into the
2260
>Update the given portion of the drawable.</P
2274
>Tile objects represent the way Gimp stores information. A
2275
tile is basically just a 64x64 pixel region of the drawable.
2276
The reason Gimp breaks the image into small pieces like this is
2277
so that the whole image doesn't have to be loaded into memory in
2278
order to alter one part of it. This becomes important with
2281
>In Gimp-Python, you would use Tiles if you wanted to
2282
perform some low level operation on the image, instead of using
2283
procedures in the PDB. This type of object gives a Gimp-Python
2284
plugin the power of a C plugin, rather than just the power of a
2285
Script-Fu script. Tile objects are created with either the
2309
functions. In this section, I will refer to a generic tile
2321
NAME="TILE-OBJECT-MEMBERS"
2325
>All tile members are read only.</P
2343
>The number of bytes per pixel.</P
2359
>If there have been changes to the tile since it
2360
was last flushed.</P
2376
>The drawable that the tile is from.</P
2392
>The actual height of the tile.</P
2408
>The actual width of the tile.</P
2424
>The reference count of the tile. (this is
2425
independent of the Python object reference
2442
>Non zero if the tile is part of the shadow
2452
NAME="TILE-OBJECT-METHODS"
2474
>Flush any changes in the tile. Note that the tile
2475
is automatically flushed when the Python object is
2476
deleted from memory.</P
2485
NAME="TILE-OBJECT-MAPPING"
2486
>Tile Mapping Behaviour</A
2489
>Tile objects also act as a mapping, or sequence. You
2490
can access the pixels in the tile in one of two ways. You can
2491
either access them with a single number, which refers to its
2492
position in the tile
2502
refers to the first pixel in the second row of a 64x64 pixel
2503
tile). The other way is with a tuple, representing the
2504
coordinates on the tile
2514
refers to the first pixel on the second row of the
2517
>The type of these subscripts is a string of length
2529
When you assign to a subscript, the dirty flag is
2530
automatically set on the tile, so you don't have to explicitly
2531
set the flag, or flush the tile.</P
2539
NAME="PREGION-OBJECT"
2543
>Pixel region objects give an interface for low level
2544
operations to act on large regions of an image, instead of on
2545
small 64x64 pixel tiles. In this section I will refer to a
2546
generic pixel region called <TT
2552
an example of a pixel region's use, please see the example
2562
NAME="PREGION-OBJECT-MEMBERS"
2563
>Pixel Region Members</A
2584
>The drawable this pixel region is for.</P
2600
>The number of bytes per pixel for the drawable.</P
2616
>The rowstride for the pixel region.</P
2632
>The x coordinate of the top left hand corner.</P
2648
>The y coordinate of the top left hand corner.</P
2664
>The width of the pixel region.</P
2680
>The height of the pixel region.</P
2696
>Non zero if changes to the pixel region will be
2697
reflected in the drawable.</P
2713
>Non zero if the pixel region acts on the shadow
2714
tiles of the drawable.</P
2723
NAME="PREGION-OBJECT-METHODS"
2724
>Pixel Region Methods</A
2767
>resize the pixel region so that it operates on the
2768
the region with corner <TT
2788
NAME="PREGION-OBJECT-MAPPING"
2789
>Pixel Region Mapping Behaviour</A
2792
>The pixel region acts as a mapping. The index is a
2793
2-tuple with components that are either integers or slices.
2794
The subscripts may be read and assigned to. The type of the
2795
subscripts is a string containing the binary data of the
2796
requested region. Here is a description of the posible
2821
>Get/Set the pixel at
2854
>Get/Set the row starting at <TT
2893
>Get/Set the column starting at <TT
2937
>Get/Set the rectangle starting at <TT
2975
HREF="gimp-module-procedures.html"
2991
HREF="support-modules.html"
3000
>Gimp Module Procedures</TD
3010
>Support Modules</TD
b'\\ No newline at end of file'