[Gambas-user] get the color from a pixel in DrawingArea control

Arief Bayu Purwanto ariefbayu at ...626...
Thu Mar 29 04:38:38 CEST 2007


Mmm, Benoit, I have another question regarding draw event. When I draw
something on DrawingArea and move my form outside the screen and bring back
to it's previous position, the image I draw on DrawingArea is dissapeared.
Is it because of the information you provide us (manual draw)?

On 3/27/07, Benoit Minisini <gambas at ...1...> wrote:
>
> On lundi 26 mars 2007, Arief Bayu Purwanto wrote:
> > Thank you for your solution, I'll check it out once I back home and
> > give report ASAP.
> >
> > On 3/26/07, timothy <timothy.marshal-nichols at ...247...> wrote:
> > > > -----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...>
> > >
>
> This is not a good solution.
>
> Actually, as an X server does not provide enough control to its pixmaps
> (the
> images stored on the server, i.e. the Picture class), you must keep the
> image
> in the client side, by using the Image class.
>
> The Image class provides an access to the pixel data. The only problem is
> that
> there is no real drawing method in the Image class. You must do them by
> hand.
>
> This will change in the future, as in Qt 4, you have the same drawing
> method
> in the QImage class (Image in Gambas) and the QPixmap class (Picture in
> Gambas).
>
> Regards,
>
> --
> Benoit Minisini
>
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share
> your
> opinions on IT & business topics through brief surveys-and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>



-- 
-- Yahoo!ID : ar1ef_310
-- http://bayu.freelancer.web.id/ <= moving...
-- http://www.blogshares.com/?referer=28353



More information about the User mailing list