[Gimp-developer] easier way to convert image into selection

David Gowers 00ai99 at gmail.com
Thu Sep 14 17:51:03 PDT 2006


On 9/15/06, David Gowers <00ai99 at gmail.com> wrote:
>
>
>
> Someone broke the undo grouping in CVS gimp. The attached plugin provides
> 'layer to selection' and 'image to selection' functionality. 'layer to
> selection' has one image.undo_group_start() but two image.undo_group_end()s.
> This is because of the mentioned breakage: someone has made it so that I
> need to do two undo_group_end()s for each undo_group_start(). All my other
> plugins depending on undo groups broke too.
>


Actually, some of my plugins still work. The ones that use floating
selection manipulation do not.
Plugins that do not work:
  * this one
  * QuickAA (which floats the selection and antialiases its edges)


Ones that use undo grouping and do work include
  * 'Apply layer' : http://bugzilla.gnome.org/show_bug.cgi?id=355730
  * 'Maximum layer alpha to sel':

    def plug_in_maximize_selection(self, run_mode, image, drawable):
        #maximize the selection --
        #used to determine the effected area.
        #maximizing any alpha-thing (layer alpha or layer mask)
        #can be used similarly.
        #
        #2 is used rather than 1, because the output of potrace includes
spurious/doubtful 1's
        pdb.gimp_threshold(image.selection, 2,255)

    def plug_in_maxlayeralpha_to_selection(self, run_mode, image, drawable):
        image.undo_group_start()
        if drawable.is_layer_mask:
            drawable = filter(lambda v: v.mask == drawable, image.layers)[0]
        pdb.gimp_selection_layer_alpha(drawable)
        if drawable.mask:
            pdb.gimp_channel_combine_masks(image.selection, drawable.mask,
CHANNEL_OP_INTERSECT, 0,
 0)
        pdb.gimp_threshold(image.selection, 2,255)
        image.undo_group_end()

So I'm fairly sure it originates in the floating selection code, this bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: /lists/gimp-developer/attachments/20060914/27f94b71/attachment.html


More information about the Gimp-developer mailing list