UDKOX UDKOX - 6 months ago 23
Java Question

Move all drawn pixels in Canvas

Once I have drawn all I need in a

Canvas
, is there a way to move it all ? Like move it all 10 pixels down ? I search though the functions and Google but I saw nothing interesting.

A lot of things are drawn so recalibrating all the app is kinda hard to do. Any ideas to do this ? I am working in Android, but I don't think it matters.

Maybe I could get the pixels and copy them 1 by 1, but I feel it would be so slow.

Thanks.

Answer

If I got your question right, you could use the canvas.translate() function. You could execute this in your onDraw() method of your Canvas. Here is the documentation for the function (scroll to the very bottom of the page). Hope it helps!