[Gambas-user] check pixel in drawingarea

Benoît Minisini gambas at ...1...
Tue May 10 15:26:37 CEST 2011


> On Tuesday, May 10, 2011 14:14:11 Benoît Minisini wrote:
> > > Question on Gambas 3
> > > 
> > > I need to find pixelcolor from a drawingarea painted with the draw
> > > event. I tried already several variants of drawingarea.grab but always
> > > fail.
> > > 
> > > the help for Grab is weak and typeof(drawingarea.grab) gives 13
> > > (function)
> > > 
> > > goal is to select pixel (drawn object as lines is not possible i gues)
> > > when on mouse.move over drawingarea.
> > > 
> > > wally
> > 
> > You can't, because the DrawingArea contents is stored inside the X server
> > (or the graphic card). This is a X11 thing.
> > 
> > You have to use an intermediate Image object in memory.
> > 
> > Regards,
> 
> that's what i tried using grab(). no idea how this works
> just a an example  line  for gb3, is highly welcome :)
> thx
> 

Grab() takes a screenshot in Gambas 2. In Gambas 3, you cannot take a 
screenshot of a control anymore, and the Grab() method does something else. It 
temporarily grabs the keyboard and the mouse so that the control gets all 
keyboard and mouse events, like a popup menu.

So you have to use an intermediate Image for your drawings if you need the 
value of individual pixels.

Regards,

-- 
Benoît Minisini




More information about the User mailing list