Depth4Image.st
changeset 7516 a1842618aa6d
parent 7499 e482fe94eec6
child 7821 8d6b6486b14f
equal deleted inserted replaced
7515:5da614f4971d 7516:a1842618aa6d
    75 
    75 
    76 !Depth4Image methodsFor:'accessing-pixels'!
    76 !Depth4Image methodsFor:'accessing-pixels'!
    77 
    77 
    78 pixelAtX:x y:y
    78 pixelAtX:x y:y
    79     "retrieve a pixel at x/y; return a pixelValue.
    79     "retrieve a pixel at x/y; return a pixelValue.
       
    80      The interpretation of the returned value depends on the photometric
       
    81      and the colormap. See also Image>>atX:y:)
    80      Pixels start at x=0 , y=0 for upper left pixel, end at
    82      Pixels start at x=0 , y=0 for upper left pixel, end at
    81      x = width-1, y=height-1 for lower right pixel"
    83      x = width-1, y=height-1 for lower right pixel"
    82 
    84 
    83     |lineIndex "{ Class: SmallInteger }"
    85     |lineIndex "{ Class: SmallInteger }"
    84      byteIndex "{ Class: SmallInteger }"
    86      byteIndex "{ Class: SmallInteger }"
   102     "Created: 24.4.1997 / 16:06:43 / cg"
   104     "Created: 24.4.1997 / 16:06:43 / cg"
   103 !
   105 !
   104 
   106 
   105 pixelAtX:x y:y put:aPixelValue
   107 pixelAtX:x y:y put:aPixelValue
   106     "set the pixel at x/y to aPixelValue.
   108     "set the pixel at x/y to aPixelValue.
       
   109      The interpretation of the pixelValue depends on the photometric
       
   110      and the colormap. (see also: Image>>atX:y:put:)
   107      Pixels start at x=0 , y=0 for upper left pixel, end at
   111      Pixels start at x=0 , y=0 for upper left pixel, end at
   108      x = width-1, y=height-1 for lower right pixel"
   112      x = width-1, y=height-1 for lower right pixel"
   109 
   113 
   110     |lineIndex "{ Class: SmallInteger }"
   114     |lineIndex "{ Class: SmallInteger }"
   111      index     "{ Class: SmallInteger }"
   115      index     "{ Class: SmallInteger }"
   115 
   119 
   116     "left pixel is in high bits"
   120     "left pixel is in high bits"
   117     index := lineIndex + (x // 2).
   121     index := lineIndex + (x // 2).
   118     byte := bytes at:index.
   122     byte := bytes at:index.
   119     x even ifTrue:[
   123     x even ifTrue:[
   120 	byte := (byte bitAnd:16rF) bitOr:(aPixelValue bitShift:4)
   124         byte := (byte bitAnd:16rF) bitOr:(aPixelValue bitShift:4)
   121     ] ifFalse:[
   125     ] ifFalse:[
   122 	byte := (byte bitAnd:16rF0) bitOr:aPixelValue
   126         byte := (byte bitAnd:16rF0) bitOr:aPixelValue
   123     ].
   127     ].
   124     bytes at:index put:byte
   128     bytes at:index put:byte
   125 
   129 
   126     "Created: 24.4.1997 / 17:06:39 / cg"
   130     "Created: 24.4.1997 / 17:06:39 / cg"
   127 !
   131 !