--- a/WindowsIconReader.st Wed Nov 19 16:33:55 2003 +0100
+++ b/WindowsIconReader.st Wed Nov 19 16:38:53 2003 +0100
@@ -356,6 +356,42 @@
"Modified: / 3.2.1998 / 20:21:16 / cg"
! !
+!WindowsIconReader methodsFor:'private-reading'!
+
+readColorMap:nColors numBytesPerColor:nRawBytesPerColor from:aStream
+ "read the colormap; notice: its in BGR order (sigh)."
+
+ |rawMap rMap gMap bMap
+ srcIndex "{ Class: SmallInteger }"
+ skipDelta "{ Class: SmallInteger }"|
+
+ rawMap := ByteArray uninitializedNew:(nColors*nRawBytesPerColor).
+ aStream nextBytes:(nColors*nRawBytesPerColor) into:rawMap.
+
+ rMap := ByteArray new:nColors.
+ gMap := ByteArray new:nColors.
+ bMap := ByteArray new:nColors.
+ srcIndex := 1.
+ skipDelta := nRawBytesPerColor - 3.
+
+ "/ stupid: this is a BGR-ordered map (otherwise, could use #rgbBytesVector:-message)
+ "/ also, there might be a fourth byte (alpha ?) which is (currently) skipped.
+ 1 to:nColors do:[:i |
+ bMap at:i put:(rawMap at:srcIndex).
+ srcIndex := srcIndex + 1.
+ gMap at:i put:(rawMap at:srcIndex).
+ srcIndex := srcIndex + 1.
+ rMap at:i put:(rawMap at:srcIndex).
+ srcIndex := srcIndex + 1.
+ srcIndex := srcIndex + skipDelta.
+ ].
+
+ ^ MappedPalette
+ redVector:rMap
+ greenVector:gMap
+ blueVector:bMap.
+! !
+
!WindowsIconReader methodsFor:'reading'!
fromOS2File:aFilename
@@ -829,42 +865,6 @@
"Modified: / 18.5.1999 / 15:40:00 / cg"
! !
-!WindowsIconReader methodsFor:'reading-private'!
-
-readColorMap:nColors numBytesPerColor:nRawBytesPerColor from:aStream
- "read the colormap; notice: its in BGR order (sigh)."
-
- |rawMap rMap gMap bMap
- srcIndex "{ Class: SmallInteger }"
- skipDelta "{ Class: SmallInteger }"|
-
- rawMap := ByteArray uninitializedNew:(nColors*nRawBytesPerColor).
- aStream nextBytes:(nColors*nRawBytesPerColor) into:rawMap.
-
- rMap := ByteArray new:nColors.
- gMap := ByteArray new:nColors.
- bMap := ByteArray new:nColors.
- srcIndex := 1.
- skipDelta := nRawBytesPerColor - 3.
-
- "/ stupid: this is a BGR-ordered map (otherwise, could use #rgbBytesVector:-message)
- "/ also, there might be a fourth byte (alpha ?) which is (currently) skipped.
- 1 to:nColors do:[:i |
- bMap at:i put:(rawMap at:srcIndex).
- srcIndex := srcIndex + 1.
- gMap at:i put:(rawMap at:srcIndex).
- srcIndex := srcIndex + 1.
- rMap at:i put:(rawMap at:srcIndex).
- srcIndex := srcIndex + 1.
- srcIndex := srcIndex + skipDelta.
- ].
-
- ^ MappedPalette
- redVector:rMap
- greenVector:gMap
- blueVector:bMap.
-! !
-
!WindowsIconReader methodsFor:'writing'!
save:image onFile:aFileName
@@ -1111,7 +1111,7 @@
!WindowsIconReader class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libview2/WindowsIconReader.st,v 1.57 2003-11-19 15:25:15 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libview2/WindowsIconReader.st,v 1.58 2003-11-19 15:38:30 cg Exp $'
! !
WindowsIconReader initialize!