java - How are bitmaps assembled in Android? -


i'm developing (very) simple android app draws mandelbrot set on screen , allows user zoom in on specified regions of set. until did display set calculate color of each pixel of screen (under suitable coordinate transformation) of 2 nested loops:

int mandelpixels[] = new int[ canvas.width() * canvas.height() ]; index = 0;  for(int = 0; <= canvas.getheight(); i++){   for(int j = 0; j <= canvas.getwidth(); j++){    // *** calculations decide color of pixel in question ***   mandelpixels[index] = color;          index++;   }  } 

as can see i'm using index variable way consecutively fill mandelpixels array (which holds color int's of each pixel in plot). implicit assumption here is, when using

 bc = bitmap.config.argb_8888  bitmap.createbitmap(mandelpixels, canvas.getwidth(), canvas.getheight(), bc); 

the bitmap created array line line, color int's index[0] index[canvas.getwidth()] make first line , on.

this works. however, i'm little puzzled why never gets mentioned in android documentation. common way assemble bitmap scratch?


Comments