v2.4.0: fixed smarttexture.getpixel using RGBA, not ARGB

This commit is contained in:
Evan Debenham
2024-04-28 23:43:24 -04:00
committed by Evan Debenham
parent 811a3b5050
commit 25ddbcf071
2 changed files with 5 additions and 3 deletions

View File

@@ -89,7 +89,9 @@ public class SmartTexture extends Texture {
}
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() {

View File

@@ -42,7 +42,7 @@ public class TextureCache {
} else {
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.fill();
@@ -65,7 +65,7 @@ public class TextureCache {
Pixmap pixmap = new Pixmap( colors.length, 1, Pixmap.Format.RGBA8888);
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) );
}
SmartTexture tx = new SmartTexture( pixmap );