Depth4Image.st
changeset 2197 1b88e629091d
parent 2186 4e4b6f9b0d27
child 2203 49d06f1c9fe2
equal deleted inserted replaced
2196:f78bbe9789b0 2197:1b88e629091d
   168 ! !
   168 ! !
   169 
   169 
   170 !Depth4Image methodsFor:'converting images'!
   170 !Depth4Image methodsFor:'converting images'!
   171 
   171 
   172 anyImageAsTrueColorFormOn:aDevice
   172 anyImageAsTrueColorFormOn:aDevice
   173     "return a true-color device-form for the palette-image receiver.
   173     "return a true-color device-form for receiver.
   174      Supports true color devices with depths: 8, 16, 24 and 32"
   174      Supports true color devices with depths: 8, 16, 24 and 32"
   175 
   175 
   176     |depth 
   176     |depth 
   177      nColors "{ Class: SmallInteger }"
   177      nColors "{ Class: SmallInteger }"
   178      colorValues 
   178      colorValues 
   802         shift := -4
   802         shift := -4
   803     ] ifFalse:[
   803     ] ifFalse:[
   804         shift := 0
   804         shift := 0
   805     ].
   805     ].
   806 
   806 
       
   807     byte := bytes at:srcIndex.
   807     x1 to:x2 do:[:x |
   808     x1 to:x2 do:[:x |
   808         shift == 0 ifTrue:[
   809         shift == 0 ifTrue:[
   809             byte := bytes at:srcIndex.
       
   810             value := byte bitAnd:16rF.
   810             value := byte bitAnd:16rF.
   811             shift := -4.
   811             shift := -4.
   812             srcIndex := srcIndex + 1.
   812             srcIndex := srcIndex + 1.
   813         ] ifFalse:[
   813         ] ifFalse:[
   814             byte := bytes at:srcIndex.
   814             byte := bytes at:srcIndex.
   816             shift := 0
   816             shift := 0
   817         ].
   817         ].
   818         aBlock value:x value:(colorArray at:(value + 1)).
   818         aBlock value:x value:(colorArray at:(value + 1)).
   819     ]
   819     ]
   820 
   820 
   821     "Created: 7.6.1996 / 19:12:33 / cg"
   821     "Created: / 7.6.1996 / 19:12:33 / cg"
   822     "Modified: 10.6.1996 / 10:29:39 / cg"
   822     "Modified: / 28.7.1998 / 21:26:11 / cg"
   823 !
   823 !
   824 
   824 
   825 valuesAtY:y from:xLow to:xHigh do:aBlock
   825 valuesAtY:y from:xLow to:xHigh do:aBlock
   826     "perform aBlock for each pixelValue from x1 to x2 in row y.
   826     "perform aBlock for each pixelValue from x1 to x2 in row y.
   827      The block is passed the pixelValue at each pixel.
   827      The block is passed the pixelValue at each pixel.
  1007 ! !
  1007 ! !
  1008 
  1008 
  1009 !Depth4Image class methodsFor:'documentation'!
  1009 !Depth4Image class methodsFor:'documentation'!
  1010 
  1010 
  1011 version
  1011 version
  1012     ^ '$Header: /cvs/stx/stx/libview/Depth4Image.st,v 1.30 1998-07-27 08:18:11 cg Exp $'
  1012     ^ '$Header: /cvs/stx/stx/libview/Depth4Image.st,v 1.31 1998-07-28 19:45:10 cg Exp $'
  1013 ! !
  1013 ! !