Re: gimp-python: checking if point is in selection

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

 



Am Freitag, 2. Juni 2006 19:44 schrieb saulgoode@xxxxxxxxxxxxxx:
> Quoting Sebastian Breuers <sebbreuers@xxxxxx>:
> > i wondered if there is a possibility to check, if a point is in a given
> > selection by using an internal gimp function.
> > If it's not, could someone give me a hint, how to achieve this in
> > creating an own function?
>
> I don't use Python-fu but the following Script-fu function should be
> easily ported (or perhaps you can find a better way):
>
> (define (point-in-selection image x y)
>    (let* (
>        (saved (car (gimp-selection-save image)))
>        (return-value)
>        )
>      (gimp-rect-select image x y 1 1 CHANNEL-OP-INTERSECT 0 0)
>      (set! return-value (car (gimp-selection-is-empty image)))
>      (gimp-selection-load saved)
>      (if (= return-value 0)
>        1
>        0
>        )
>      )
>    )
>

Hi.

thanks for the tip. works fine.

seb

> Note that the selection does not include the points at the rightmost
> and bottommost edges. For example, if the selection is from (0,0) to
> (10,10) then the point (10,10) is *not* "in" the selection but (9,9)
> is. You may need to adjust things to account for this.
> _______________________________________________
> Gimp-developer mailing list
> Gimp-developer@xxxxxxxxxxxxxxxxxxxxxx
> https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer
_______________________________________________
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