Re: [Gimp-developer] gimp-python: checking if point is in selection
Am Freitag, 2. Juni 2006 19:44 schrieb [EMAIL PROTECTED]: Quoting Sebastian Breuers [EMAIL PROTECTED]: 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@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer ___ Gimp-developer mailing list Gimp-developer@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer
[Gimp-developer] gimp-python: checking if point is in selection
[EMAIL PROTECTED] 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? seb Mail: [EMAIL PROTECTED] ___ Gimp-developer mailing list Gimp-developer@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer
Re: [Gimp-developer] gimp-python: checking if point is in selection
Quoting Sebastian Breuers [EMAIL PROTECTED]: 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 ) ) ) 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@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer
Re: [Gimp-developer] gimp-python: checking if point is in selection
Hi, On Fri, 2006-06-02 at 13:48 +0200, Sebastian Breuers wrote: 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? Use gimp-image-get-selection to get the selection mask and check the value of the pixel you are interested in. Sven ___ Gimp-developer mailing list Gimp-developer@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer
Re: [Gimp-developer] gimp-python: checking if point is in selection
Am Freitag, 2. Juni 2006 19:54 schrieben Sie: Hi, On Fri, 2006-06-02 at 13:48 +0200, Sebastian Breuers wrote: 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? Use gimp-image-get-selection to get the selection mask and check the value of the pixel you are interested in. Hi, Sven, i've already found the selection function, but could you tell me how to check the value of the pixel? Sven seb ___ Gimp-developer mailing list Gimp-developer@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer
Re: [Gimp-developer] gimp-python: checking if point is in selection
On Fri, 2006-06-02 at 23:16 +0200, Sebastian Breuers wrote: Am Freitag, 2. Juni 2006 19:54 schrieben Sie: Hi, On Fri, 2006-06-02 at 13:48 +0200, Sebastian Breuers wrote: 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? Use gimp-image-get-selection to get the selection mask and check the value of the pixel you are interested in. Hi, Sven, i've already found the selection function, but could you tell me how to check the value of the pixel? Use gimp-selection-value ciao, --mitch ___ Gimp-developer mailing list Gimp-developer@lists.XCF.Berkeley.EDU https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer