PIKApp/devel-docs/PIKA3-plug-in-porting-guide/pdb-calls.md

77 lines
3.1 KiB
Markdown

# PDB equivalence
A table of old PDB calls, and their equivalents in the PIKA 3.0+ world.
This document is a work in progress. Feel free to add to it.
## Undo/Context
| Removed function | Replacement |
| -------------------------------- | ----------------------------
| pika_undo_push_group_start | image.undo_group_start() |
| pika_undo_push_group_end | image.undo_group_end() |
| pika.context_push() | Pika.context_push() |
| pika.context_push() | Pika.context_push() |
| pika_context_get_background | Pika.context_get_background
| pika_context_set_background | Pika.context_set_background
## File load/save
| Removed function | Replacement |
| -------------------------------- | ----------------------------
| pika_file_load | Pika.file_load |
| pika_file_save | Pika.file_save |
## Selection operations
Selection operations are now in the Pika.Selection class (except
a few in the Image class). E.g.
| Removed function | Replacement |
| -------------------------------- | ----------------------------
| pdb.pika_selection_invert(img) | Pika.Selection.invert(img) |
| pdb.pika_selection_none(img) | Pika.Selection.none(img) |
| pdb.pika_selection_layer_alpha(layer) | img.select_item(Pika.ChannelOps.REPLACE, layer) |
| pika_image_select_item | img.select_item(channel_op, layer) |
## Filling and Masks
| Removed function | Replacement |
| -------------------------------- | ----------------------------
| Pika.drawable_fill() | layer.fill() |
| pdb.pika_edit_fill(FILL_BACKGROUND) | layer.edit_fill(Pika.FillType.BACKGROUND) |
| pika_layer_add_mask | layer.add_mask
| pika_layer_remove_mask | layer.remove_mask
## Miscellaneous and Non-PDB Calls
| Removed function | Replacement |
| -------------------------------- | ----------------------------
| pika_displays_flush | Pika.displays_flush
| pika_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 = Pika.RGB()
c.set(240.0, 180.0, 70.0)
Pika.get_pdb().run_procedure('script-fu-drop-shadow',
[ Pika.RunMode.NONINTERACTIVE,
GObject.Value(Pika.Image, img),
GObject.Value(Pika.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)
])
```