Re: [Gimp-developer] Selections in plugins

2006-01-28 Thread Joël-Alexis Bialkiewicz
On 1/26/06, Simon Budig <[EMAIL PROTECTED]> wrote:
Joël-Alexis Bialkiewicz ([EMAIL PROTECTED]) 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 usinggimp_image_get_selection(). You then can peek into this drawable to getthe 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? 2) When I read the data from the selection drawable, 1 means selected and 0 means not selected, isn't it?
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?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?
Thanks in advance.Sincerely,Joel-Alexis Bialkiewicz 
___
Gimp-developer mailing list
Gimp-developer@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer


Re: [Gimp-developer] Selections in plugins

2006-01-28 Thread Simon Budig
Joël-Alexis Bialkiewicz ([EMAIL PROTECTED]) wrote:
> On 1/26/06, Simon Budig <[EMAIL PROTECTED]> wrote:
> >
> > Joël-Alexis Bialkiewicz ([EMAIL PROTECTED]) 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

-- 
  [EMAIL PROTECTED]  http://simon.budig.de/
___
Gimp-developer mailing list
Gimp-developer@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer