03-09-2025, 09:51 AM
(03-09-2025, 08:26 AM)Ofnuts Wrote: A few quick comments:
- Instead of saving the foreground color, you should save and restore the whole context (because there are other parts of the context that you are changing, such as the path stroke method). This is done with (gimp-context-push) at the beginning of the code, and (gimp-context-pop) at the end.
- You can make the whole script undone by a single Control-Z by making it run as as an undo group with (gimp-image-undo-group-start image) at the beginning and (gimp-image-undo-group-end image) at the end.
- You can avoid having to deal with channels, masks and selection by enabling the script for RGB* instead of *. I recently learned that this applies to the target drawables and not to the image itself.
Thank you!