Would Corona be the right framework if I wanted to let the user draw some black and white sketches using the finger, and if so, how would that be done? It would be part of something larger, not a specialized drawing app, but I would need some way to get simple smooth sketches going…
Thanks for any help! [import]uid: 10284 topic_id: 4472 reply_id: 304472[/import]
on a touch/move event create a circle … make sure to destroy so that you don’t start to eat memory…
really really rough code to get you going and I mean very crude way to see if this is what you mean. I don’t know if it is going to work or not as I didn’t test… this was off my brain…
[code]
local function drawDrag(event)
local phase = event.phase
if “began” == phase then
– Make target the top-most object
local cc = display.newCircle ( event.x, event.y, 4);
cc:setFillColor(255,0,0);
elseif “moved” == phase then
– Make object move (we subtract t.x0,t.y0 so that moves are
– relative to initial grab point, rather than object “snapping”).
local cc = display.newCircle ( event.x, event.y, 4);
cc:setFillColor(255,0,0);
elseif “ended” == phase or “cancelled” == phase then
moved = FALSE;
end
won’t this start to slow down the more circles are drawn? Corona isn’t capable of “stamping” the images to static bitmap is it? i’m guessing each circle is an individual unit? is “cacheAsBitmap” a feature we can expect? (although not always what you want if you need “undo” functionality)
i dont really know how Corona/OpenGL drawing works at the moment. how many circles is a feasible number to be able to draw with the method above, without seeing device slowdown/memory issues?
actually thanks carlos i hadn’t thought about that. a lot of drawing apps have an “ink level” allowing you to only draw a certain amount of items. (each being active so undo is still possible) once the ink level ran out you could call display.save(), warn the user they won’t be able to undo past that point, but then give them fresh “ink” to draw on top of the saved image.
can we save an image just to memory without it going to disk? or at least to a temporary file cache rather than a system images folder?
it’s alright Carlos i’ve been tempted to use that acronym myself a few times, so good point sorry [import]uid: 6645 topic_id: 4472 reply_id: 14062[/import]