|
Lines 138-144
Link Here
|
| 138 |
byte[] maskData = bmpFormat.loadData(infoHeader); |
138 |
byte[] maskData = bmpFormat.loadData(infoHeader); |
| 139 |
maskData = convertPad(maskData, width, height, 1, 4, 2); |
139 |
maskData = convertPad(maskData, width, height, 1, 4, 2); |
| 140 |
bitInvertData(maskData, 0, maskData.length); |
140 |
bitInvertData(maskData, 0, maskData.length); |
| 141 |
return ImageData.internal_new( |
141 |
ImageData data = ImageData.internal_new( |
| 142 |
width, |
142 |
width, |
| 143 |
height, |
143 |
height, |
| 144 |
depth, |
144 |
depth, |
|
Lines 155-160
Link Here
|
| 155 |
0, |
155 |
0, |
| 156 |
0, |
156 |
0, |
| 157 |
0); |
157 |
0); |
|
|
158 |
if (depth == 32) { |
| 159 |
/* |
| 160 |
* Looking at various header information, only icons with |
| 161 |
* 32-bit depth can contain alpha channel. So, constructing |
| 162 |
* alphaData bytes accordingly into imageData object. |
| 163 |
*/ |
| 164 |
int stride = (width * depth + 7) / 8; |
| 165 |
byte[] alphaData = new byte[width * height]; |
| 166 |
for (int y = 0; y < height; y++) { |
| 167 |
for (int x = 0; x < width; x++) { |
| 168 |
alphaData[y*width+x] = shapeData[y*stride+x*4 + 3]; |
| 169 |
} |
| 170 |
} |
| 171 |
data.alphaData = alphaData; |
| 172 |
} |
| 173 |
return data; |
| 158 |
} |
174 |
} |
| 159 |
int[][] loadIconHeaders(int numIcons) { |
175 |
int[][] loadIconHeaders(int numIcons) { |
| 160 |
int[][] headers = new int[numIcons][7]; |
176 |
int[][] headers = new int[numIcons][7]; |