Depth24Image.st
changeset 4118 47f8b9588f17
parent 3907 31dd3278b835
child 4719 b645e2f1a76a
equal deleted inserted replaced
4117:eedeb5ed8e91 4118:47f8b9588f17
    86     index := 1 + (((width * y) + x) * 3).
    86     index := 1 + (((width * y) + x) * 3).
    87     rVal := bytes at:(index).
    87     rVal := bytes at:(index).
    88     gVal := bytes at:(index + 1).
    88     gVal := bytes at:(index + 1).
    89     bVal := bytes at:(index + 2).
    89     bVal := bytes at:(index + 2).
    90 
    90 
    91     photometric ~~ #rgb ifTrue:[
       
    92         ^ super colorAtX:x y:y
       
    93     ].
       
    94     ^ Color redByte:rVal greenByte:gVal blueByte:bVal
    91     ^ Color redByte:rVal greenByte:gVal blueByte:bVal
    95 
       
    96     "Created: 24.4.1997 / 17:32:47 / cg"
       
    97     "Modified: 24.4.1997 / 21:32:37 / cg"
       
    98 !
    92 !
    99 
    93 
   100 colorAtX:x y:y put:aColor
    94 colorAtX:x y:y put:aColor
   101     "set the pixel at x/y to aColor.
    95     "set the pixel at x/y to aColor.
   102      Pixels start at x=0 , y=0 for upper left pixel, end at
    96      Pixels start at x=0 , y=0 for upper left pixel, end at
   148     bytes at:(index + 1) put:(val bitAnd:16rFF).
   142     bytes at:(index + 1) put:(val bitAnd:16rFF).
   149     val := val bitShift:-8.
   143     val := val bitShift:-8.
   150     bytes at:(index) put:val.
   144     bytes at:(index) put:val.
   151 
   145 
   152     "Created: 24.4.1997 / 17:06:33 / cg"
   146     "Created: 24.4.1997 / 17:06:33 / cg"
       
   147 !
       
   148 
       
   149 rgbValueAtX:x y:y
       
   150     "retrieve a pixels rgb value at x/y; return a 24bit rgbValue (rrggbb, red is MSB).
       
   151      Pixels start at 0@0 for upper left pixel, end at (width-1)@(height-1) for lower right pixel."
       
   152 
       
   153     ^ self pixelAtX:x y:y.
   153 !
   154 !
   154 
   155 
   155 rowAt:y putAll:pixelArray startingAt:startIndex
   156 rowAt:y putAll:pixelArray startingAt:startIndex
   156     "store a single rows bits from bits in the pixelArray argument;
   157     "store a single rows bits from bits in the pixelArray argument;
   157      Return the pixelArray.
   158      Return the pixelArray.
  3000     "return the shift amount used with translation from pixelValues to redBits"
  3001     "return the shift amount used with translation from pixelValues to redBits"
  3001 
  3002 
  3002     ^ -16
  3003     ^ -16
  3003 !
  3004 !
  3004 
  3005 
       
  3006 rgbFromValue:pixelValue
       
  3007     "given a pixel value, return the corresponding 24bit rgbValue (rrggbb, red is MSB)."
       
  3008 
       
  3009     ^ pixelValue
       
  3010 !
       
  3011 
  3005 samplesPerPixel
  3012 samplesPerPixel
  3006     "return the number of samples per pixel in the image."
  3013     "return the number of samples per pixel in the image."
  3007 
  3014 
  3008     samplesPerPixel notNil ifTrue:[^ samplesPerPixel].
  3015     samplesPerPixel notNil ifTrue:[^ samplesPerPixel].
  3009     ^ 3
  3016     ^ 3
  3016 ! !
  3023 ! !
  3017 
  3024 
  3018 !Depth24Image class methodsFor:'documentation'!
  3025 !Depth24Image class methodsFor:'documentation'!
  3019 
  3026 
  3020 version
  3027 version
  3021     ^ '$Header: /cvs/stx/stx/libview/Depth24Image.st,v 1.82 2003-07-04 14:19:27 cg Exp $'
  3028     ^ '$Header: /cvs/stx/stx/libview/Depth24Image.st,v 1.83 2004-03-20 13:35:45 cg Exp $'
  3022 ! !
  3029 ! !