#REFACTORING
class: WindowsIconReader
changed:
#convertPixels (send #unsignedInt16At:put:MSB: instead of #wordAt:put:MSB:, send #unsignedInt16At:MSB: instead of #wordAt:MSB:)
#fromWindowsBMPStream:alreadyRead: (send #unsignedInt16At:MSB: instead of #wordAt:MSB:)
--- a/WindowsIconReader.st Tue Mar 15 22:45:24 2016 +0100
+++ b/WindowsIconReader.st Tue Mar 15 22:45:38 2016 +0100
@@ -1,3 +1,5 @@
+"{ Encoding: utf8 }"
+
"
COPYRIGHT (c) 1993 by Claus Gittinger
All Rights Reserved
@@ -512,9 +514,9 @@
1 to:height do:[:y |
idx := rowIdx.
1 to:width do:[:x |
- oldValue := data wordAt:idx MSB:false.
+ oldValue := data unsignedInt16At:idx MSB:false.
newValue := pixelAction value:oldValue.
- data wordAt:idx put:newValue MSB:true.
+ data unsignedInt16At:idx put:newValue MSB:true.
idx := idx + 2.
].
rowIdx := rowIdx + bpr.
@@ -1236,8 +1238,8 @@
width := bitmapHeader doubleWordAt:(4 + 1) MSB:false.
height := bitmapHeader signedDoubleWordAt:(8 + 1) MSB:false.
- inPlanes := bitmapHeader wordAt:(12 + 1) MSB:false.
- inDepth := bitmapHeader wordAt:(14 + 1) MSB:false.
+ inPlanes := bitmapHeader unsignedInt16At:(12 + 1) MSB:false.
+ inDepth := bitmapHeader unsignedInt16At:(14 + 1) MSB:false.
compression := bitmapHeader doubleWordAt:(16 + 1) MSB:false.
imgSize := bitmapHeader doubleWordAt:(20 + 1) MSB:false.
resH := bitmapHeader doubleWordAt:(24 + 1) MSB:false.
@@ -1316,8 +1318,8 @@
"/
width := bitmapHeader doubleWordAt:(4 + 1) MSB:false.
height := bitmapHeader signedDoubleWordAt:(8 + 1) MSB:false.
- inPlanes := bitmapHeader wordAt:(12 + 1) MSB:false.
- inDepth := bitmapHeader wordAt:(14 + 1) MSB:false.
+ inPlanes := bitmapHeader unsignedInt16At:(12 + 1) MSB:false.
+ inDepth := bitmapHeader unsignedInt16At:(14 + 1) MSB:false.
compression := bitmapHeader doubleWordAt:(16 + 1) MSB:false.
numColor := bitmapHeader doubleWordAt:(32 + 1) MSB:false.
numImportantColor := bitmapHeader doubleWordAt:(36 + 1) MSB:false.
@@ -1338,16 +1340,16 @@
"/ an OS2 bitmap with large dimensions
width := bitmapHeader doubleWordAt:(4 + 1) MSB:false.
height := bitmapHeader signedDoubleWordAt:(8 + 1) MSB:false.
- inPlanes := bitmapHeader wordAt:(12 + 1) MSB:false.
- inDepth := bitmapHeader wordAt:(14 + 1) MSB:false.
+ inPlanes := bitmapHeader unsignedInt16At:(12 + 1) MSB:false.
+ inDepth := bitmapHeader unsignedInt16At:(14 + 1) MSB:false.
numBytesPerColorInColormap := 4.
] ifFalse:[
"/ size == 12:
"/ a Win2.x bitmap
- width := bitmapHeader wordAt:(4 + 1) MSB:false.
+ width := bitmapHeader unsignedInt16At:(4 + 1) MSB:false.
height := bitmapHeader signedWordAt:(6 + 1) MSB:false.
- inPlanes := bitmapHeader wordAt:(8 + 1) MSB:false.
- inDepth := bitmapHeader wordAt:(10 + 1) MSB:false.
+ inPlanes := bitmapHeader unsignedInt16At:(8 + 1) MSB:false.
+ inDepth := bitmapHeader unsignedInt16At:(10 + 1) MSB:false.
].
compression := 0.
inDepth <= 8 ifTrue:[