File: classes.md

package info (click to toggle)
gimp 3.0.4-6.2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 210,548 kB
  • sloc: ansic: 842,405; lisp: 10,761; python: 10,318; cpp: 7,238; perl: 4,355; sh: 1,043; xml: 963; yacc: 609; lex: 348; javascript: 150; makefile: 43
file content (82 lines) | stat: -rw-r--r-- 1,601 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# Useful Modules/Classes in GIMP 3.0+

Here's a guide to the modules you're likely to need.
It's a work in progress: feel free to add to it.

Online documentation for our libraries can be found at:
https://developer.gimp.org/api/3.0/

You can also get some information in GIMP's Python console with
*help(module)* or *help(object)*, and you can get a list of functions
with *dir(object)*.

## Gimp

The base module: almost everything is under Gimp.

## Gimp.Image

The image object.

Some operations that used to be PDB calls, like
```
pdb.gimp_selection_layer_alpha(layer)
```
are now in the Image object, e.g.
```
img.select_item(Gimp.ChannelOps.REPLACE, layer)
```

## Gimp.Layer

The layer object.

```
fog = Gimp.Layer.new(image, name,
                     drawable.width(), drawable.height(), type, opacity,
                     Gimp.LayerMode.NORMAL)
```

## Gimp.Selection

Selection operations that used to be in the PDB, e.g.
```
pdb.gimp_selection_none(img)
```
are now in the Gimp.Selection module, e.g.
```
Gimp.Selection.none(img)
```

## Gimp.ImageType

A home for image types like RGBA, GRAY, etc:
```
Gimp.ImageType.RGBA_IMAGE
```

## Gimp.FillType

e.g. Gimp.FillType.TRANSPARENT, Gimp.FillType.BACKGROUND

## Gimp.ChannelOps

The old channel op definitions in the gimpfu module, like
```
CHANNEL_OP_REPLACE
```
are now in their own module:

```
Gimp.ChannelOps.REPLACE
```

## Gegl.Color

In legacy plug-ins you could pass a simple list of integers, like (0, 0, 0).
In 3.0+, create a Gegl.Color object:

```
    c = Gegl.Color.new("black")
    c.set_rgba(0.94, 0.71, 0.27, 1.0)
```