I have two images overlayed and i copy pixels from bottom image to top image while ACTION_MOVE. My goal is to give erasing feeling to the user but sometimes it doesn’t copy(erase) some parts and it gets worse if touch event is fast( dragging finger fastly).
This is the code i am using for copying pixels
mutable.getPixels(pixels, 0, width, xPos, yPos, width, height) ;
mutable2.setPixels(pixels, 0, width,xPos, yPos, width, height) ;
Store all the touch events in a queue and do the image manipulation in a second thread. Never do anything expensive in the main thread!
Also, try to minimize the area in which you get and set pixels. And, of course, if you already got the pixels, don’t get them again (assuming they didn’t change).
Also, if you do a lot of heavy lifting in your manipulation, you might want to consider JNI as a last resort. Really, really last resort.