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


------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech
_______________________________________________
Gambas-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gambas-user

Reply via email to