Depth32Image.st
changeset 8728 289cdc983b33
parent 8339 b2b10047577b
child 8744 d9c17cf6f9dd
equal deleted inserted replaced
8727:8af37d3caf22 8728:289cdc983b33
   112 
   112 
   113     |index "{ Class: SmallInteger }"
   113     |index "{ Class: SmallInteger }"
   114      rVal gVal bVal aVal|
   114      rVal gVal bVal aVal|
   115 
   115 
   116     index := 1 + (((width * y) + x) * 4).
   116     index := 1 + (((width * y) + x) * 4).
   117     ((photometric == #rgb) or:[photometric == #xrgb]) ifTrue:[
   117     ((photometric == #rgb) or:[photometric == #rgbx]) ifTrue:[
   118         "/ byteorder is: <ignoredAlpha>,r,g,b
   118         "/ byteorder is: r,g,b,<ignoredAlpha>
   119         rVal := bytes at:(index + 1).
   119         rVal := bytes at:index.
   120         gVal := bytes at:(index + 2).
   120         gVal := bytes at:(index + 1).
   121         bVal := bytes at:(index + 3).
   121         bVal := bytes at:(index + 2).
   122         ^ Color redByte:rVal greenByte:gVal blueByte:bVal
   122         ^ Color redByte:rVal greenByte:gVal blueByte:bVal
   123     ].
   123     ].
   124     (photometric == #rgba) ifTrue:[
   124     (photometric == #rgba) ifTrue:[
   125         "/ byteorder is: r,g,b,<ignoredAlpha>
   125         "/ byteorder is: r,g,b,<ignoredAlpha>
   126         rVal := bytes at:(index).
   126         rVal := bytes at:(index).
   146     ].
   146     ].
   147     "/ the inherited method should handle all cases.
   147     "/ the inherited method should handle all cases.
   148     ^ super colorAtX:x y:y.
   148     ^ super colorAtX:x y:y.
   149 
   149 
   150     "Modified: / 22-08-2017 / 18:17:38 / cg"
   150     "Modified: / 22-08-2017 / 18:17:38 / cg"
       
   151     "Modified: / 12-07-2019 / 14:39:41 / Stefan Reise"
   151 !
   152 !
   152 
   153 
   153 colorAtX:x y:y put:aColor
   154 colorAtX:x y:y put:aColor
   154     "set the pixel at x/y to aColor.
   155     "set the pixel at x/y to aColor.
   155      Pixels start at x=0 , y=0 for upper left pixel, end at
   156      Pixels start at x=0 , y=0 for upper left pixel, end at