Re: [Gimp-developer] Problem deleting mask saved to channel

2002-02-24 Thread Sven Neumann

Hi,

Cindy Huyser [EMAIL PROTECTED] writes:

 I'm in the process of writing a little plug-in that will automate the
 process of converting a selection to a mask.

FYI, GIMP-1.3 finally has this feature builtin.

 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().

From the PDB help of gimp_channel_delete(): 

  This procedure deletes the specified channel. This must not be done
   if the gimage containing this channel was already deleted or if the
   channel was already removed from the image. The only case in which
   this procedure is useful is if you want to get rid of a channel
   which has not yet been added to an image.

The correct way to get rid of the channel is to remove it from the image
using gimp_image_remove_channel().


Salut, Sven
___
Gimp-developer mailing list
[EMAIL PROTECTED]
http://lists.xcf.berkeley.edu/mailman/listinfo/gimp-developer



[Gimp-developer] Problem deleting mask saved to channel

2002-02-23 Thread Cindy Huyser

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?

Thanks,
Cindy Huyser
___
Gimp-developer mailing list
[EMAIL PROTECTED]
http://lists.xcf.berkeley.edu/mailman/listinfo/gimp-developer