#DOCUMENTATION
class: WindowsIconReader
comment/format in: #fileFormatDescription
changed: #fromWindowsBMPStream:alreadyRead:
--- a/WindowsIconReader.st Mon Mar 07 10:31:02 2016 +0100
+++ b/WindowsIconReader.st Mon Mar 07 11:12:02 2016 +0100
@@ -71,7 +71,15 @@
DataOffset 4 bytes 10 File offset to Raster Data
InfoHeader 40 bytes Windows Structure: BITMAPINFOHEADER
-
+ different sizes, depending on Windows-version:
+ 12 - Win2.x or OS/2 1.x
+ 40 - WinNT, Win3.x or later
+ 52 - adds undocumented; adds r/g/b masks
+ 56 - adds undocumented; adds r/g/b/a masks
+ 64 - OS/2 2.x
+ 108 - WinNT4.0, 95 or later
+ 124 - WinNT5.0, 98 or later
+
Size 4 bytes 14 Size of InfoHeader =40
Width 4 bytes 18 Bitmap Width
Height 4 bytes 22 Bitmap Height
@@ -89,6 +97,7 @@
3 = BITFIELDS Windows V3+ only
4 = JPEG Windows V3+ only
5 = PNG Windows V3+ only
+ 6 = ALPHA_BITFIELDS Windows CE only
3 = HUFFMAN1D OS/2 2.x-only
4 = RLE24 OS/2 2.x-only
@@ -102,7 +111,8 @@
ColorsImportant
4 bytes 50 Number of important colors
0 = all
- ColorTable 4 * NumColors bytes
+
+ ColorTable 4 * NumColors bytes (3 on Win2)
present only if Info.BitsPerPixel <= 8
colors should be ordered by importance
@@ -1297,7 +1307,7 @@
numBytesPerColorInColormap := 3.
- iSize >= 64 ifTrue:[
+ iSize == 64 ifTrue:[
"/
"/ its an OS/2 (vsn2) BMP file
"/
@@ -1309,6 +1319,7 @@
numColor := bitmapHeader doubleWordAt:(32 + 1) MSB:false.
numImportantColor := bitmapHeader doubleWordAt:(36 + 1) MSB:false.
(compression > 2) ifTrue:[
+ "/ 3 = HUFFMAN; 4 = RLE24
^ self fileFormatError:'unhandled OS2 compression'.
].
numColor == 0 ifTrue:[