Hey I got this code that checks two images that overlap each other if any pixels are transparent, anyway; I made an array like this and I got it to work:
The image is 8x8 so I make the array like this:
public long[] getArray(){
long[] array = new long[8];
String s = null;
for(int i = 0; i<8; i++){
for(int z = 0; z <8; z++){
String s2;
if(image.getRGB(z, i)==0){ s2 = "0";}
else s2 = "1";
if(s == null) {s = s2;}
else s+=s2;
}
array[i] = Long.parseLong(s);
s = null;
}
return array;
}
As you see, the result would be a 8 long array with each cell representing a whole row of the image so for example, the value of array[0] would represent a whole row like:
111000
But here’s the problem… For this to work, the image has to be less wide than 20 pixels or else I get a NumberFormatException, in other words the whole combination of
1s and 0s becomes too long.
So, how are you actually supposed to handle these bitmask arrays since a mere 20 pixels is very restrictive!