A canvas holds an image bigger that its size. (so the canvas has scroll, and zoom)
The user may draw/add into graphics of the canvas.
Is there a way to save or copy the whole picture of the canvas? The canvas1.DrawInto only copy the visible portion of the image.
I know (too late) that I should have used a pictBuffer but I didn’t, so to avoid to re-code all, is there a way to get the whole image? In some place should Xojo keep the whole image, no?
There is no way to do this without maintaining a copy of the image in-memory as a property, or redrawing to a Picture using a method when you wish to save.
A canvas really is meant more as a display component rather than storage, and it should be trivial for you to adapt your Paint event code to a function that returns a Picture.
Sub Paint(g As Graphics, areas() As REALbasic.Rect) Handles Paint
Var pRet as Picture = myDrawMethod( g.Width, g.Height )
g.DrawPicture( pRet, 0, 0 )
End Sub
[code]Private Function myDrawMethod(bufferWidth as Double, bufferHeight as Double) as Picture
Var p as new Picture( bufferWidth, bufferHeight )
Var g as Graphics = p.Graphics
u can use a full size picture as permanent property and then
Sub Paint(g As Graphics, areas() As REALbasic.Rect) Handles Paint
DrawMoreInto(MyPicture.Graphics)
g.DrawPicture( MyPicture, OffsetX, OffsetY )
End Sub
or you need to store any draw step (into a list) and paint it on the fly into any graphics object
but it will be slower the more you had paint.