v2.4.0: fixed smarttexture.getpixel using RGBA, not ARGB
This commit is contained in:
committed by
Evan Debenham
parent
811a3b5050
commit
25ddbcf071
@@ -89,7 +89,9 @@ public class SmartTexture extends Texture {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int getPixel( int x, int y ){
|
public int getPixel( int x, int y ){
|
||||||
return bitmap.getPixel(x, y);
|
int color = bitmap.getPixel(x, y);
|
||||||
|
// convert from libGdx RGBA to Noosa ARGB
|
||||||
|
return ( (color << 24) | (color >>> 8) );
|
||||||
}
|
}
|
||||||
|
|
||||||
public void reload() {
|
public void reload() {
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ public class TextureCache {
|
|||||||
} else {
|
} else {
|
||||||
|
|
||||||
Pixmap pixmap =new Pixmap( 1, 1, Pixmap.Format.RGBA8888 );
|
Pixmap pixmap =new Pixmap( 1, 1, Pixmap.Format.RGBA8888 );
|
||||||
// In the rest of the code ARGB is used
|
// convert from Noosa ARGB to libGdx RGBA
|
||||||
pixmap.setColor( (color << 8) | (color >>> 24) );
|
pixmap.setColor( (color << 8) | (color >>> 24) );
|
||||||
pixmap.fill();
|
pixmap.fill();
|
||||||
|
|
||||||
@@ -65,7 +65,7 @@ public class TextureCache {
|
|||||||
|
|
||||||
Pixmap pixmap = new Pixmap( colors.length, 1, Pixmap.Format.RGBA8888);
|
Pixmap pixmap = new Pixmap( colors.length, 1, Pixmap.Format.RGBA8888);
|
||||||
for (int i=0; i < colors.length; i++) {
|
for (int i=0; i < colors.length; i++) {
|
||||||
// In the rest of the code ARGB is used
|
// convert from Noosa ARGB to libGdx RGBA
|
||||||
pixmap.drawPixel( i, 0, (colors[i] << 8) | (colors[i] >>> 24) );
|
pixmap.drawPixel( i, 0, (colors[i] << 8) | (colors[i] >>> 24) );
|
||||||
}
|
}
|
||||||
SmartTexture tx = new SmartTexture( pixmap );
|
SmartTexture tx = new SmartTexture( pixmap );
|
||||||
|
|||||||
Reference in New Issue
Block a user