11-25-2022, 09:34 PM
See gimp-image-get-layer-by-name. You can also get list/vector of all the layers in the image and iterate it. The background layer is the mast in the list (first is the top layer).
In the API you don't really "switch" layers, because there is no implicit active layer as you have in the UI. instead every call that involves a layer takes the target layer ID as an argument (the "drawable", in your case).
You can very likely simplify your process because if your mask layers are black and white, after you have a selection on the black you can obtain a selection on the white by just inverting the selection.
In the API you don't really "switch" layers, because there is no implicit active layer as you have in the UI. instead every call that involves a layer takes the target layer ID as an argument (the "drawable", in your case).
You can very likely simplify your process because if your mask layers are black and white, after you have a selection on the black you can obtain a selection on the white by just inverting the selection.