Patch DMITool's import to accept pngs with no alpha channel

This commit is contained in:
CitadelStationBot
2017-08-19 18:39:13 -05:00
parent 9da30ff9f3
commit 10807cb1b9
2 changed files with 3 additions and 2 deletions

Binary file not shown.

View File

@@ -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);