WinIconRdr.st
changeset 518 c9d492fbb1b6
parent 445 899af8ff2a5d
child 565 03b84a590f49
equal deleted inserted replaced
517:6658791e40d0 518:c9d492fbb1b6
   389 !
   389 !
   390 
   390 
   391 fromWindowsBMPStream:aStream 
   391 fromWindowsBMPStream:aStream 
   392     "read an image from a windows BMP stream"
   392     "read an image from a windows BMP stream"
   393 
   393 
   394     | fileSize header inDepth inPlanes compression
   394     | fileSize header iSize inDepth inPlanes compression
   395       imgSize resH resV numColor numImportantColor
   395       imgSize resH resV numColor numImportantColor
   396       dataStart
   396       dataStart
   397       rawMap rMap gMap bMap srcIndex dstIndex inBytesPerRow
   397       rawMap rMap gMap bMap srcIndex dstIndex inBytesPerRow
   398       data4 mask tmp bytesPerRow fourBytesPerColorInfo|
   398       data4 mask tmp bytesPerRow fourBytesPerColorInfo|
   399 
   399 
   404     "read the header"
   404     "read the header"
   405 
   405 
   406     header := ByteArray uninitializedNew:16r54.
   406     header := ByteArray uninitializedNew:16r54.
   407     aStream nextBytes:18 into:header.
   407     aStream nextBytes:18 into:header.
   408 
   408 
   409     ((header at:(16r0E + 1)) == 40) ifTrue:[    "header-size"
   409     iSize := header at:(16r0E + 1).
       
   410 
       
   411     (iSize == 40) ifTrue:[    "header-size"
   410         "
   412         "
   411          its an Windows3.x BMP file
   413          its an Windows3.x BMP file
   412          or OS/2 vsn 2 BMP file
   414          or OS/2 vsn 2 BMP file
   413         "
   415         "
   414 "/        'WinIconReader [info]: Win3.x or OS/2 vsn 2 format' infoPrintNL.
   416 "/        'WinIconReader [info]: Win3.x or OS/2 vsn 2 format' infoPrintNL.
   441             aStream nextBytes:(numColor * 4) into:rawMap.
   443             aStream nextBytes:(numColor * 4) into:rawMap.
   442             fourBytesPerColorInfo := true.
   444             fourBytesPerColorInfo := true.
   443         ].
   445         ].
   444         dataStart := header wordAt:(16r0A + 1) MSB:false
   446         dataStart := header wordAt:(16r0A + 1) MSB:false
   445     ] ifFalse:[
   447     ] ifFalse:[
   446         ((header at:(16r0E + 1)) == 12) ifTrue:[     "core-info header size"
   448         (iSize == 12) ifTrue:[     "core-info header size"
   447             "
   449             "
   448              its an OS/2 (vsn1.2) BMP file
   450              its an OS/2 (vsn1.2) BMP file
   449             "
   451             "
   450 "/           'WinIconReader [info]: OS/2 vsn 1.2 format' infoPrintNL.
   452 "/           'WinIconReader [info]: OS/2 vsn 1.2 format' infoPrintNL.
   451             aStream nextBytes:(12-4) into:header startingAt:19.
   453             aStream nextBytes:(12-4) into:header startingAt:19.
   537     samplesPerPixel := 1.
   539     samplesPerPixel := 1.
   538     bitsPerSample := #(8).
   540     bitsPerSample := #(8).
   539     colorMap := Colormap redVector:rMap greenVector:gMap blueVector:bMap.
   541     colorMap := Colormap redVector:rMap greenVector:gMap blueVector:bMap.
   540 
   542 
   541     "Modified: 17.9.1995 / 18:48:46 / claus"
   543     "Modified: 17.9.1995 / 18:48:46 / claus"
   542     "Modified: 28.1.1997 / 01:47:18 / cg"
   544     "Modified: 11.4.1997 / 00:49:38 / cg"
   543 !
   545 !
   544 
   546 
   545 fromWindowsICOFile:aFilename 
   547 fromWindowsICOFile:aFilename 
   546     "read an image from a windows ICO file"
   548     "read an image from a windows ICO file"
   547 
   549 
   658 ! !
   660 ! !
   659 
   661 
   660 !WindowsIconReader class methodsFor:'documentation'!
   662 !WindowsIconReader class methodsFor:'documentation'!
   661 
   663 
   662 version
   664 version
   663     ^ '$Header: /cvs/stx/stx/libview2/Attic/WinIconRdr.st,v 1.30 1997-02-24 11:12:59 cg Exp $'
   665     ^ '$Header: /cvs/stx/stx/libview2/Attic/WinIconRdr.st,v 1.31 1997-04-10 22:53:07 cg Exp $'
   664 ! !
   666 ! !
   665 WindowsIconReader initialize!
   667 WindowsIconReader initialize!