[Gambas-user] Grabing an image from a drawingarea ?

Benoit Minisini gambas at ...1...
Wed Sep 27 08:45:56 CEST 2006


On Wednesday 27 September 2006 01:53, serge bouc wrote:
> Hello everybody,
>
> I am trying to use gambas to create a drawing software for some
> mathematical objects. My problem is the following : I can create
> images in large drawingareas (I mean larger than the screen),
> and view them in a scrollview. This works fine.
> The problem is now to save these images to disk : for this, I have
> to create an *image* in Gambas, but all I can do is "grab" a *picture*
> from the drawing area, and then convert it to an image. And when
> I do this, the image is clipped to the part of the drawingarea which
> is actually drawn on the screen, so I don't recover the whole image
> present on the drawingarea.
> And this seems to be a normal behaviour, since if I understand the
> documentation correctly, a "picture" in Gambas is drawn on the screen,
> whereas an "image" is in memory.

Grab() just returns what is visible on the screen.

> So is there a way to recover the image directly from the memory of
> a drawingarea, without drawing it to the screen, to avoid clipping ?
>

I think you use a cached DrawingArea. To be able to control the picture you 
display, you must used an uncached DrawingArea, have the Picture you display 
in a variable, and display it in the Draw event of the DrawingArea. Then you 
will be able to save the Picture easily.

Regards,

-- 
Benoit Minisini





More information about the User mailing list