mirror of
https://github.com/webbukkit/dynmap.git
synced 2025-02-01 04:21:43 +01:00
Handle bogus gamma correction on new GRAY texturepack images
This commit is contained in:
parent
574a400ada
commit
328954b256
@ -1273,7 +1273,17 @@ public class TexturePack {
|
||||
imgs[idx].width = img.getWidth();
|
||||
imgs[idx].height = img.getHeight();
|
||||
imgs[idx].argb = new int[imgs[idx].width * imgs[idx].height];
|
||||
img.getRGB(0, 0, imgs[idx].width, imgs[idx].height, imgs[idx].argb, 0, imgs[idx].width);
|
||||
if (img.getType() == BufferedImage.TYPE_BYTE_GRAY) { // We don't want alpha correction, apparently
|
||||
float[] buffer = new float[imgs[idx].width * imgs[idx].height];
|
||||
img.getData().getPixels(0, 0, imgs[idx].width, imgs[idx].height, buffer);
|
||||
for (int i = 0; i < imgs[idx].argb.length; i++) {
|
||||
int v = (int) buffer[i];
|
||||
imgs[idx].argb[i] = 0xFF000000 | (v << 16) | (v << 8) | v;
|
||||
}
|
||||
}
|
||||
else {
|
||||
img.getRGB(0, 0, imgs[idx].width, imgs[idx].height, imgs[idx].argb, 0, imgs[idx].width);
|
||||
}
|
||||
img.flush();
|
||||
imgs[idx].isLoaded = true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user