Re: easier way to convert image into selection

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





On 9/15/06, David Gowers <00ai99@xxxxxxxxx> 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.
_______________________________________________
Gimp-developer mailing list
Gimp-developer@xxxxxxxxxxxxxxxxxxxxxx
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer

[Index of Archives]     [Video For Linux]     [Photo]     [Yosemite News]     [gtk]     [GIMP for Windows]     [KDE]     [GEGL]     [Gimp's Home]     [Gimp on GUI]     [Gimp on Windows]     [Steve's Art]

  Powered by Linux