Depth16Image.st
changeset 7190 18fc47cc1ce6
parent 6306 a3bbe514829e
child 7209 c4cb8c02e820
equal deleted inserted replaced
7189:4cfe895d6532 7190:18fc47cc1ce6
     9  other person.  No title to or ownership of the software is
     9  other person.  No title to or ownership of the software is
    10  hereby transferred.
    10  hereby transferred.
    11 "
    11 "
    12 "{ Package: 'stx:libview' }"
    12 "{ Package: 'stx:libview' }"
    13 
    13 
       
    14 "{ NameSpace: Smalltalk }"
       
    15 
    14 Image subclass:#Depth16Image
    16 Image subclass:#Depth16Image
    15 	instanceVariableNames:''
    17 	instanceVariableNames:''
    16 	classVariableNames:''
    18 	classVariableNames:''
    17 	poolDictionaries:''
    19 	poolDictionaries:''
    18 	category:'Graphics-Images'
    20 	category:'Graphics-Images'
    81 
    83 
    82     pixelFunction notNil ifTrue:[^ pixelFunction value:x value:y].
    84     pixelFunction notNil ifTrue:[^ pixelFunction value:x value:y].
    83 
    85 
    84     lineIndex := (width * 2 * y) + 1.
    86     lineIndex := (width * 2 * y) + 1.
    85 
    87 
    86     "left pixel in high bits"
       
    87     ^ bytes wordAt:(lineIndex + (x * 2)) MSB:true.
    88     ^ bytes wordAt:(lineIndex + (x * 2)) MSB:true.
    88 
    89 
    89     "Created: 24.4.1997 / 16:06:19 / cg"
    90     "Created: 24.4.1997 / 16:06:19 / cg"
    90 !
    91 !
    91 
    92 
   107     "store a single rows bits from bits in the pixelArray argument;
   108     "store a single rows bits from bits in the pixelArray argument;
   108      Return the pixelArray.
   109      Return the pixelArray.
   109      Notice: row coordinate starts at 0."
   110      Notice: row coordinate starts at 0."
   110 
   111 
   111     |dstIdx "{ Class: SmallInteger }"
   112     |dstIdx "{ Class: SmallInteger }"
       
   113      srcIdx "{ Class: SmallInteger }"
   112      pixel
   114      pixel
   113      bytes|
   115      bytes|
   114 
   116 
   115     bytes := self bits.
   117     bytes := self bits.
   116     dstIdx := (width * 2 * y) + 1.
   118     dstIdx := (width * 2 * y) + 1.
       
   119     srcIdx := startIndex.
   117     1 to:width do:[:col |
   120     1 to:width do:[:col |
   118 	pixel := pixelArray at:(startIndex + col - 1).
   121         pixel := pixelArray at:srcIdx.
   119 	bytes at:dstIdx put:((pixel bitShift:-8) bitAnd:16rFF).
   122         "/ msbFirst
   120 	bytes at:dstIdx+1 put:(pixel bitAnd:16rFF).
   123         bytes at:dstIdx put:((pixel bitShift:-8) bitAnd:16rFF).
   121 	dstIdx := dstIdx + 2.
   124         bytes at:dstIdx+1 put:(pixel bitAnd:16rFF).
       
   125         dstIdx := dstIdx + 2.
       
   126         srcIdx := srcIdx + 1.
   122     ].
   127     ].
   123     ^ pixelArray
   128     ^ pixelArray
   124 
   129 
   125     "Created: 24.4.1997 / 15:50:27 / cg"
   130     "Created: 24.4.1997 / 15:50:27 / cg"
   126 ! !
   131 ! !
   197 ! !
   202 ! !
   198 
   203 
   199 !Depth16Image class methodsFor:'documentation'!
   204 !Depth16Image class methodsFor:'documentation'!
   200 
   205 
   201 version
   206 version
   202     ^ '$Header: /cvs/stx/stx/libview/Depth16Image.st,v 1.17 2014-03-02 14:39:22 cg Exp $'
   207     ^ '$Header$'
   203 !
   208 !
   204 
   209 
   205 version_CVS
   210 version_CVS
   206     ^ '$Header: /cvs/stx/stx/libview/Depth16Image.st,v 1.17 2014-03-02 14:39:22 cg Exp $'
   211     ^ '$Header$'
   207 ! !
   212 ! !
   208 
   213