File: pdb-calls.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 (76 lines) | stat: -rw-r--r-- 3,228 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
# PDB equivalence

A table of old PDB calls, and their equivalents in the GIMP 3.0+ world.

This document is a work in progress. Feel free to add to it.

## Undo/Context

| Removed function                 | Replacement                   |
| -------------------------------- | ----------------------------
| gimp_undo_push_group_start       | image.undo_group_start() |
| gimp_undo_push_group_end         | image.undo_group_end() |
| gimp.context_push()              | Gimp.context_push()   |
| gimp.context_push()              | Gimp.context_push()   |
| gimp_context_get_background      | Gimp.context_get_background
| gimp_context_set_background      | Gimp.context_set_background

## File load/save

| Removed function                 | Replacement                   |
| -------------------------------- | ----------------------------
| gimp_file_load                   | Gimp.file_load |
| gimp_file_save                   | Gimp.file_save |

## Selection operations

Selection operations are now in the Gimp.Selection class (except
a few in the Image class). E.g.

| Removed function                 | Replacement                   |
| -------------------------------- | ----------------------------
| pdb.gimp_selection_invert(img)   | Gimp.Selection.invert(img) |
| pdb.gimp_selection_none(img)     | Gimp.Selection.none(img) |
| pdb.gimp_selection_layer_alpha(layer) | img.select_item(Gimp.ChannelOps.REPLACE, layer) |
| gimp_image_select_item           | img.select_item(channel_op, layer) |

## Filling and Masks

| Removed function                 | Replacement                   |
| -------------------------------- | ----------------------------
| Gimp.drawable_fill()             | layer.fill() |
| pdb.gimp_edit_fill(FILL_BACKGROUND)  | layer.edit_fill(Gimp.FillType.BACKGROUND) |
| gimp_layer_add_mask              | layer.add_mask
| gimp_layer_remove_mask           | layer.remove_mask

## Miscellaneous and Non-PDB Calls

| Removed function                 | Replacement                   |
| -------------------------------- | ----------------------------
| gimp_displays_flush              | Gimp.displays_flush
| gimp_image_insert_layer          | image.insert_layer


## Plug-ins

Calling other plug-ins is trickier than before. The old
```
pdb.script_fu_drop_shadow(img, layer, -3, -3, blur,
                              (0, 0, 0), 80.0, False)
```
becomes
```
        c = Gegl.Color.new("black")
        c.set_rgba(0.94, 0.71, 0.27, 1.0)
        Gimp.get_pdb().run_procedure('script-fu-drop-shadow',
                                     [ Gimp.RunMode.NONINTERACTIVE,
                                       GObject.Value(Gimp.Image, img),
                                       GObject.Value(Gimp.Drawable, layer),
                                       GObject.Value(GObject.TYPE_DOUBLE, -3),
                                       GObject.Value(GObject.TYPE_DOUBLE, -3),
                                       GObject.Value(GObject.TYPE_DOUBLE,blur),
                                       c,
                                       GObject.Value(GObject.TYPE_DOUBLE, 80.0),
                                       GObject.Value(GObject.TYPE_BOOLEAN, False)
                                     ])
```