performance - Faster alternative for getPixel and getPixel in Android Bitmap? -


i'm using methods getpixel , setpixel bitmap , it's slow (getpixels too). want process every pixel of bitmap , create bitmap. how can access pixels renderscript or using c++? think faster don't know how .

this using getpixel / setpixel:

  bitmap.getpixels(colorarray, 0, width, 0, 0, width, height);      (int x = 0; x < width; x++) {         (int y = 0; y < height; y++) {             int g = color.green(colorarray[y * width + x]);             int b = color.blue(colorarray[y * width + x]);             int r = color.red(colorarray[y * width + x]);             //some color changes ....             colorarray[y * width + x] = color.rgb(r, g, b);             returnbitmap.setpixel(x, y, colorarray[y * width + x]);         }     } 

thanks!

use getpixels() pixels, modify values in byte[], call setpixels() store pixels @ once. overhead of calling setpixel() on each individual pixel killing performance.

if it's still not fast enough, can pass array ndk function.

if you're doing live processing of camera images, can even fancier.


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -