Ispas Claudiu
Ispas Claudiu

Reputation: 1998

How are the pixels placed in an int[] array of pixels when getting pixels from a Android Bitmap?

I really need to know some detail about bitmap.getPixels(...), that the documentation does not say. I want to know how are the pixels displayed in the int[] array. Is it row after row or column after column?

To be more specifi:

imagine image: [0,0][0,1][0,2][0,3]
               [1,0][1,1][1,2][1,3]
array looks like this?: [0,0],[0,1],[0,2],[0,3],[1,0],[1,1],[1,2],[1,3]
or it looks like this?: [0,0],[1,0],[0,1],[1,1],[0,2],[1,2]...

Thank you!

Upvotes: 0

Views: 40

Answers (1)

Matteo Codogno
Matteo Codogno

Reputation: 1579

The third parameter of getPixels function (int stride), is necessary to say at the function how many pixels there are for each row. So the function know that after X pixels have to skip at new row.

Here you can find the documentation!

Upvotes: 2

Related Questions