Adding snapshot to snapshot.

Hi, so I’m making a drawing app and I have two snapshots.

board1. One for all drawings,

board2. Another for current stroke drawing.

I use circle and line to make vector-ish lines instead of pushing circles whenever move is detected.

I can’t just have 1. because I need alpha in my strokes. (Without snapshots, I can see individual alphas in my circles and lines. This causes the overlapped parts be darker like a transparent 3D snake lol)

So whenever user lifts finger, I do  

board1.group:insert(board2)

Then When user puts finger down again, I do

board1 = display.newSnapshot(screenW,screenH)

But unfortunately, when board2 is inserted into board1, snapshot object doesn’t melt into board1 and I get a memory leak.

Is there any way I could fix this problem?

This was a stupid question.

I am stupid.

All I had to do was

-- This will make sure when canvas is invalidated,  -- add snapshot.canvas to snapshot to render,  -- but discard it and not add to snapshot.group snapshot.canvasMode = "discard" snapshot.canvas:insert(snapshot2) -- invalidate canvas instead of group. snapshot:invalidate("canvas")   

This was a stupid question.

I am stupid.

All I had to do was

-- This will make sure when canvas is invalidated,  -- add snapshot.canvas to snapshot to render,  -- but discard it and not add to snapshot.group snapshot.canvasMode = "discard" snapshot.canvas:insert(snapshot2) -- invalidate canvas instead of group. snapshot:invalidate("canvas")   

when i try to add a snapshot to a snapshot i get an error. are you sure both of yours are snapshots?

snapshot2.canvas:insert(snapshot)

--------------------------- Corona Runtime Error --------------------------- main.lua:91: bad argument #-2 to 'insert' (Proxy expected, got nil) stack traceback: [C]: in function 'insert' main.lua:91: in function \<main.lua:73\> ?: in function \<?:221\>

thanks

J

when i try to add a snapshot to a snapshot i get an error. are you sure both of yours are snapshots?

snapshot2.canvas:insert(snapshot)

--------------------------- Corona Runtime Error --------------------------- main.lua:91: bad argument #-2 to 'insert' (Proxy expected, got nil) stack traceback: [C]: in function 'insert' main.lua:91: in function \<main.lua:73\> ?: in function \<?:221\>

thanks

J