return ffi;
}
public static IconImage readIconImage(IDataReader dr, int bytesInRes)
throws IOException {
IconImage ii = new IconImage();
int quadSize = 0;
ii.setHeader(readBitmapInfoHeader(dr));
if (ii.getHeader().getClrUsed() != 0) {
quadSize = ii.getHeader().getClrUsed();
} else {
if (ii.getHeader().getBitCount() <= 8) {
quadSize = 1 << ii.getHeader().getBitCount();
} else {
quadSize = 0;
}
}
int numBytesPerLine = ((((ii.getHeader().getWidth() *
ii.getHeader().getPlanes() * ii.getHeader().getBitCount()) + 31) >> 5) << 2);
int xorSize = numBytesPerLine * ii.getHeader().getHeight() / 2;
int andSize = bytesInRes - (quadSize * 4) - ii.getHeader().getSize() -
xorSize;
if (quadSize > 0) {
RGBQuad[] colors = new RGBQuad[quadSize];
for (int i = 0; i < quadSize; i++) {
colors[i] = readRGB(dr);
}
ii.setColors(colors);
}
byte[] xorMask = new byte[xorSize];
dr.read(xorMask);
ii.setXorMask(xorMask);
byte[] andMask = new byte[andSize];
dr.read(andMask);
ii.setAndMask(andMask);
return ii;
}