[Gambas-user] get the color from a pixel in DrawingArea control
timothy
timothy.marshal-nichols at ...247...
Mon Mar 26 09:14:37 CEST 2007
> -----Original Message-----
> From: gambas-user-bounces at lists.sourceforge.net [mailto:gambas-user-
> bounces at lists.sourceforge.net] On Behalf Of Arief Bayu Purwanto
> Sent: Sunday, 25 March 2007 10:43 AM
> To: gambas-user at lists.sourceforge.net
> Subject: [Gambas-user] get the color from a pixel in DrawingArea
control
>
> Dear member,
>
> I'm trying to create a paint application. Right now I'm encounter a
> problem when I want to aplly a photo bucket tool. Because It's need
> current color of a pixel to do the job. I'm searching around the help
> document, but found nothing. Could someone in this forum help me out?
> or give me proper search query in google so that I can find a heading.
> or is it possible to do this?
> Btw, I'm using gambas from ubuntu edgy repository.
>
> --
> -- Yahoo!ID : ar1ef_310
> -- http://bayu.freelancer.web.id/
>
Suppose you want to get the color of a point on a DrawingArea then:
PUBLIC SUB DrawingArea_MouseMove()
DIM c AS Integer
c = DrawingArea.Grab().Image[Mouse.X, Mouse.Y]
' Use color
END
Note two things. (1) Here color is an integer. (2) You might want to set
the Tracking property of a DrawingArea to TRUE so you get mouse events
without a button being pressed.
In general to get the color of a point on a Image
c = MyImage[X, Y]
and to get the color of a point on a Picture:
c = MyPicture.Image[X, Y]
You can extend this idea to get the color of any point on the screen:
c = Desktop.Grab().Image[Mouse.ScreenX, Mouse.ScreenY]
Thanks
8-{)} Timothy Marshal-Nichols
<mailto: timothy.marshal-nichols at ...247...>
More information about the User
mailing list