Depth24Image.st
changeset 8170 baac5c2583e6
parent 8155 5da09f4eaf56
child 8197 ac41cb09e3f6
equal deleted inserted replaced
8169:a1c4f7d8acad 8170:baac5c2583e6
   189     "retrieve a pixel's rgb value at x/y; 
   189     "retrieve a pixel's rgb value at x/y; 
   190      return a 24bit rgbValue (rrggbb, red is MSB).
   190      return a 24bit rgbValue (rrggbb, red is MSB).
   191      Pixels start at 0@0 for the upper left pixel, 
   191      Pixels start at 0@0 for the upper left pixel, 
   192      and end at (width-1)@(height-1) for the lower right pixel."
   192      and end at (width-1)@(height-1) for the lower right pixel."
   193 
   193 
   194     ^ self pixelAtX:x y:y.
   194     (photometric == #rgb) ifTrue:[
   195 
   195         ^ self pixelAtX:x y:y.
   196     "Modified (comment): / 29-08-2017 / 14:35:01 / cg"
   196     ].
       
   197     ^ super rgbValueAtX:x y:y
       
   198 
       
   199     "Modified: / 10-09-2017 / 16:21:25 / cg"
       
   200 !
       
   201 
       
   202 rgbValueAtX:x y:y put:rgb
       
   203     "store a pixel's rgb value at x/y; 
       
   204      return a 24bit rgbValue (rrggbb, red is MSB).
       
   205      Pixels start at 0@0 for the upper left pixel, 
       
   206      and end at (width-1)@(height-1) for the lower right pixel."
       
   207 
       
   208     (photometric == #rgb) ifTrue:[
       
   209         ^ self pixelAtX:x y:y put:rgb.
       
   210     ].
       
   211     ^ super rgbValueAtX:x y:y put:rgb
       
   212 
       
   213     "Created: / 10-09-2017 / 16:21:50 / cg"
   197 !
   214 !
   198 
   215 
   199 rowAt:y putAll:pixelArray startingAt:startIndex
   216 rowAt:y putAll:pixelArray startingAt:startIndex
   200     "store a single rows bits from bits in the pixelArray argument;
   217     "store a single row's bits from bits in the pixelArray argument;
   201      Return the pixelArray.
   218      Return the pixelArray.
   202      Notice: row coordinate starts at 0."
   219      Notice: row coordinate starts at 0."
   203 
   220 
   204     |bytes dstIdx pixel|
   221     |bytes dstIdx pixel|
   205 
   222 
   206     bytes := self bits.
   223     bytes := self bits.
   207     dstIdx := (y * self bytesPerRow) + 1.
   224     dstIdx := (y * self bytesPerRow) + 1.
   208     0 to:width-1 do:[:col |
   225     0 to:width-1 do:[:col |
   209 	pixel := pixelArray at:(startIndex + col).
   226         pixel := pixelArray at:(startIndex + col).
   210 	bytes at:dstIdx put:((pixel bitShift:-16) bitAnd:16rFF).
   227         bytes at:dstIdx put:((pixel bitShift:-16) bitAnd:16rFF).
   211 	bytes at:dstIdx+1 put:((pixel bitShift:-8) bitAnd:16rFF).
   228         bytes at:dstIdx+1 put:((pixel bitShift:-8) bitAnd:16rFF).
   212 	bytes at:dstIdx+2 put:(pixel bitAnd:16rFF).
   229         bytes at:dstIdx+2 put:(pixel bitAnd:16rFF).
   213 	dstIdx := dstIdx + 3.
   230         dstIdx := dstIdx + 3.
   214     ].
   231     ].
   215     ^ pixelArray
   232     ^ pixelArray
   216 
   233 
   217     "Created: 24.4.1997 / 15:50:27 / cg"
   234     "Created: / 24-04-1997 / 15:50:27 / cg"
       
   235     "Modified (comment): / 10-09-2017 / 16:22:39 / cg"
   218 ! !
   236 ! !
   219 
   237 
   220 !Depth24Image methodsFor:'converting rgb images'!
   238 !Depth24Image methodsFor:'converting rgb images'!
   221 
   239 
   222 asGrayFormOn:aDevice
   240 asGrayFormOn:aDevice