[Gambas-user] How to save the contents of a drawingarea and a GLArea
martin p cristia
tercoide at ...67...
Mon Mar 10 17:51:52 CET 2014
Thanks for the fast answer, Tobi.
The program is very complex, and the user can opt for a Draw or OpenGL
method to draw things (each with its own control), so I thing a better
way could be to copy the entire window and clip the drawn rectangle
area, if that is possible.
> On Mon, 10 Mar 2014, martin p cristia wrote:
>> Hi:
>>
>> I need to save the contents of a drawingarea and a GLArea as a JPG, how
>> to do it?
>>
> AFAIK, there is no way to access the internal buffer of a DrawingArea. So
> what I do is: define a routine that fills my DrawingArea but is agnostic
> about the drawing device (i.e. uses Paint.Device to refer to it instead of
> a fixed object like the DrawingArea), let's call it DrawIt() and then I do:
>
> Public Sub dwgArea_Draw()
> DrawIt()
> End
>
> and the drawing will be in the DrawingArea whenever needed. If you want to
> save it you just do:
>
> Dim hPicture As New Picture(dwgArea.W, dwgArea.H)
>
> Paint.Begin(hPicture)
> DrawIt()
> Paint.End()
> hPicture.Save(...)
>
> Does that help you? If not, you should be more precise about your code and
> your experience with Gambas next time. My assumptions when writing this
> were:
>
> - you are familiar with drawing in Gambas
> - you use the Draw event
> - your drawing is not a function of external variables, like time (so that
> you can call DrawIt() at any time in your program and produce the same
> result as before)
>
> For the GLArea: no idea. Never used that but maybe you can adapt the idea
> above.
>
> Regards,
> Tobi
More information about the User
mailing list