[Gambas-user] Using an Image in a PictureBox or help with my issue

John Harrold budgieboy52 at ...1601...
Sun Nov 30 12:21:46 CET 2008


Thanks Benoit, I now understand why there is both picture and image in the
picturebox component.

Just one thing: would it make things easier for Robert (original poster) if
he used gb.gtk rather than gb.qt; I'm not so clear about that.

Budgieboy

That's

2008/11/29 Benoit Minisini <gambas at ...1...>

> On samedi 29 novembre 2008, John Harrold wrote:
> > I'm no Gambas expert but as far as I understand you can't reference the
> > image that way.
> >
> > you would need to do:
> >
> > DIM myImg as Image
> > myImg=PicBox.Picture.Image
> >
> > Even then I think it will make a copy of the image and not be an alias.
> If
> > you make changes to myImg to have them reflected in the original you
> would
> > have to write back the image:
> >
> > PicBox.Picture.Image=myImg
> >
> > Dont think that makes things any easier.
> >
> > Budgieboy
> >
>
> To understand why thing are not easier, you must know that on X-Window
> systems, an image can be stored:
>
> - In the program (the process that uses the GUI), an "Image" in Gambas.
>
> - Or directly in the X-Window process, a "Picture" in Gambas.
>
> Alas, you can only use X-Window drawing commands on Pictures, not on
> Images.
> On the contrary, you can only access individual pixels on Images, not on
> Pictures.
>
> The Picture.Image and Image.Picture properties actually move the image data
> between the X-Window server and your program. It is a relatively heavy
> process, especially when the image is big. But there is no other way!
>
> This is not really true with gb.gtk, as in gb.gtk the conversion is not
> done
> when you use the Picture.Image or Image.Picture property, but only when it
> is
> really needed.
>
> For example, if you really access individual pixels, then the image data
> will
> be moved to your process. Not when you will use the Picture.Image property.
>
> I hope I was clear enough!
>
> Regards,
> --
> Benoit Minisini
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's
> challenge
> Build the coolest Linux based applications with Moblin SDK & win great
> prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>



More information about the User mailing list