Re: Selections in plugins

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

 



Joël-Alexis Bialkiewicz (jabial@xxxxxxxxx) wrote:
> On 1/26/06, Simon Budig <simon@xxxxxxxx> wrote:
> >
> > Joël-Alexis Bialkiewicz (jabial@xxxxxxxxx) wrote:
> > >
> > > In fact I don't want to ignore selections but to use them in a different
> > > way. Especially, I would like to be able know, for a specific point,
> > whether
> > > it is selected or not.
> >
> > You can request the selection as a drawable using
> > gimp_image_get_selection(). You then can peek into this drawable to get
> > the selection value for a specific pixel. You probably need to be
> > careful with the offset handling a bit though.
> 
> 1) What do you mean by careful with the offset handling?

Layers are not necessarily at the 0,0 position of the canvas. The
selection however is. So you need to take that difference into account.

> 2) When I read the data from the selection drawable, 1 means selected and 0
> means not selected, isn't it?

A selection is not binary. 255 means selected, 0 means not selected, 100
means "partially selected".

> 3) When I call gimp_drawable_mask_bounds and there is a complex selection,
> what part of the image does it point out to me? Does it correspond the
> littlest square possible containing all selected points?

this returns the bounding box, All pixels outside are *not* selected,
there may be not selected pixels inside.

> 4) When I try to read a point that is not selected, will it give me the
> right value for this point or some dummy value?

When reading the pixels from a drawable the selection does not affect
the result. You always get the correct result (under the assumption that
you do read correctly...)

Hope this helps,
        Simon

-- 
              simon@xxxxxxxx              http://simon.budig.de/
_______________________________________________
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