Merge pull request #2434 from Citadel-Station-13/upstream-merge-30012

[MIRROR] Patch DMITool's import to accept pngs with no alpha channel
This commit is contained in:
LetterJay
2017-08-20 09:46:55 -05:00
committed by GitHub
2 changed files with 3 additions and 2 deletions
Binary file not shown.
@@ -189,6 +189,7 @@ public class IconState {
px[i] = sl.clone();
}
int channelCount = in.imgInfo.alpha ? 4 : 3;
Image[] images = new Image[frames*dirs];
for(int imageY=0; imageY<dirs; imageY++) {
for(int imageX=0; imageX<frames; imageX++) {
@@ -196,11 +197,11 @@ public class IconState {
for(int pixelY=0; pixelY<h; pixelY++) {
for(int pixelX=0; pixelX<w; pixelX++) {
int bY = imageY*h + pixelY;
int bX = imageX*4*w + 4*pixelX;
int bX = imageX*channelCount*w + channelCount*pixelX;
pixels[pixelY][pixelX] = new RGBA(px[bY][bX ],
px[bY][bX + 1],
px[bY][bX + 2],
px[bY][bX + 3]);
in.imgInfo.alpha ? px[bY][bX + 3] : 255);
}
}
images[_getIndex(imageY, imageX, dirs)] = new NonPalettedImage(w, h, pixels);