Hi there,
yesterday I spend a couple of hours in writing some drawing features. The turning point was the step by step undo function. I tried different approaches. I thought to create different panel layers (and one cavas for the active layer) and hide them or set color = transparent if the use hit the undo function. A layer counter managed the active layer panel etc. Everything worked as aspected, in preview mode, the strokes could be hidden.
But now the question was how to combine all cavas objects to one. Or how to save the preview panel with different canvases on different panels
. I created some cavas objects (a canvas array), initialized by one hidden panel. The First canvas has only the first stroke, the second cavas the first and the second stroke and so on. But now the question was, how to reset a canvas, or copy a canvas to annother or combine more canvas objects. I tried only initializing the first canvas and set the other to the canvas with counter -1. But this didn't work as aspected:
Is there annother solution to copy a canvas without saving it to bitmap?
Annother approch I actually try is so save the layer via c.bitmap to an bitmap array and then initialize the main canvas:
My fear is, that this solution will become a little memory overkill on small devices. Because i have to hold the layer pics (from cam) in memory.
Greetings.
yesterday I spend a couple of hours in writing some drawing features. The turning point was the step by step undo function. I tried different approaches. I thought to create different panel layers (and one cavas for the active layer) and hide them or set color = transparent if the use hit the undo function. A layer counter managed the active layer panel etc. Everything worked as aspected, in preview mode, the strokes could be hidden.
But now the question was how to combine all cavas objects to one. Or how to save the preview panel with different canvases on different panels
B4X:
If i = ActiveLayer AND i = 1 Then
pnlTemp.Color = Colors.Transparent
cvsTemp(i).initialize(pnlTemp)
Debug("initialize cvsTemp("&i&" via pnlTemp)")
Else If i = ActiveLayer Then
cvsTemp(i) = cvsTemp(i-1)
Debug("Load cvsTemp("&i&") with: cvsTemp("& (i-1) &")")
End If
Is there annother solution to copy a canvas without saving it to bitmap?
Annother approch I actually try is so save the layer via c.bitmap to an bitmap array and then initialize the main canvas:
B4X:
Dim BitmapToLoad As Bitmap
BitmapToLoad.InitializeMutable(480,360)
BitmapToLoad = Bitmaps(ActiveLayer-1)
c.Initialize2(BitmapToLoad)
My fear is, that this solution will become a little memory overkill on small devices. Because i have to hold the layer pics (from cam) in memory.
Greetings.
Last edited: