Hello, all,

I'm in the process of writing a little plug-in that will automate the
process of converting a selection to a mask. My goal is to add a layer
to the image containing the mask made from the selection. The outline of
my process is:

1) Save the selection to a channel
2) Duplicate the original layer
3) Add alpha to the original and duplicate layers
4) Add a layer mask (transparent/black) to the duplicate layer
5) Copy the selection mask saved as a channel
6) Paste the copy buffer onto the duplicate layer
7) Anchor the pasted layer
8) Delete the selection mask channel

I've been everything except for deleting the selection mask channel.  So
far, I've tried:

1) calling gimp_channel_delete() on the channel ID, either preceded by
gimp_selection_clear() or by itself.  The call returns TRUE.
2) calling gimp_drawable_delete() on the channel's drawable, with and
without preceding it by a call to gimp_drawable_detach().

I flush and update the drawable for the duplicated layer when the
routine is finished, as I do the drawable associated with the saved
selection mask (except, course, when I call delete() on the selection
mask channel). 

In every case, the selection mask channel remains visible in the Layers
dialog.  I have been working with a grayscale test image, so the
selection channel mask and gray channels are the only channels that
appear in the dialog.

I'm still pretty much a newbie at doing this, so I'm sure there's
something I've overlooked. Any ideas?

Cindy Huyser
Gimp-developer mailing list

Reply via email to