--- a/WindowsIconReader.st Thu Sep 13 11:01:37 2001 +0200
+++ b/WindowsIconReader.st Thu Sep 13 15:00:36 2001 +0200
@@ -897,7 +897,7 @@
"save image as BMP file on aFileName.
Only depth 1,4,8 and 24 images can be represented in this format."
- |depth bhSize biSize biClrUsed biSizeImage bfOffBits rowBytes imgBytesPerRow data srcIndex row|
+ |depth bhSize biSize biClrUsed biSizeImage bfOffBits rowBytes imgBytesPerRow data srcIndex row t|
depth := image depth.
width := image width.
@@ -978,6 +978,15 @@
1 to:height do:[:i |
srcIndex := srcIndex - imgBytesPerRow.
row replaceFrom:1 to:imgBytesPerRow with:data startingAt:srcIndex.
+ depth >= 24 ifTrue:[
+ "/ stupid must swap red & blue bytes
+
+ 1 to:row size by:3 do:[:i |
+ t := row at:i.
+ row at:i put:(row at:i+2).
+ row at:i+2 put:t
+ ].
+ ].
outStream nextPutAll:row.
].
@@ -1112,6 +1121,6 @@
!WindowsIconReader class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libview2/WindowsIconReader.st,v 1.48 2000-08-02 10:15:46 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libview2/WindowsIconReader.st,v 1.49 2001-09-13 13:00:36 cg Exp $'
! !
WindowsIconReader initialize!