Load image blurred Android
- by Mira
I'm trying to create a map for a game through an image, where each black pixel is equivalent to a wall, and yellow to flowers(1) and green grass(0)
so far i had this image (50x50):
http://i.imgur.com/Ydj9Cp2.png
the problem here seems to be that, when i read the image on my code, it get's scaled up to 100x100, even tough i have it on the raw folder. I can't let it scale up or down because that will put noise and blur on the image and then the map won't be readable.
here i have my code:
(...)
Bitmap tab=BitmapFactory.decodeResource(resources, com.example.lolitos2.R.raw.mappixel);
//tab=Bitmap.createScaledBitmap(tab, 50, 50, false);
Log.e("w", tab.getWidth()+"."+tab.getHeight());
for (int i = 0; i < tab.getWidth(); i++) {
for (int j = 0; j < tab.getHeight(); j++) {
int x = j;
int y = i;
switch (tab.getPixel(x, y)) {
// se o é uma parede
case Color.BLACK:
getParedes()[x][y] = new Parede(x, y);
break;
case Color.GREEN:
fundo.add(new Passivo(x,y,0));
break;
default:
fundo.add(new Passivo(x,y,1));
}
}
}
How can i read my image Map without rescaling it?