DoNotArrestMe
DoNotArrestMe

Reputation: 1279

Draw every pixel in canvas

I have two-dimensional array with size equal screen resolution int[][] matrix = new int[width][height] where width and height are size of screen. I modify array after some multitouch events on screen, for example increase or decrease value of each item. I need to draw in realtime each item in array to each pixel in canvas. For example if value of item is higher then pixel is darker.

I try to use Android draw using SurfaceView and Thread as base. In thread class in override function run in loop throw every array item I do like this canvas.drawPoint(w, h, paint). But it is not quick.

Am i right to do this? What is the best way to do it?

Upvotes: 1

Views: 576

Answers (1)

xaggre
xaggre

Reputation: 128

If I am not completely wrong, you do not have to redraw every pixel each frame, so you should definitely somehow store the changed pixels and draw only them each render loop run.

Upvotes: 1

Related Questions