#TUNING by cg
authorClaus Gittinger <cg@exept.de>
Wed, 07 Sep 2016 17:21:52 +0200
changeset 7550 b38f65fc5d21
parent 7549 feafeb92feda
child 7551 a58984867d2f
#TUNING by cg class: Depth24Image changed: #colorAtX:y: #colorAtX:y:put:
Depth24Image.st
--- a/Depth24Image.st	Wed Sep 07 17:17:27 2016 +0200
+++ b/Depth24Image.st	Wed Sep 07 17:21:52 2016 +0200
@@ -79,15 +79,11 @@
      Pixels start at x=0 , y=0 for upper left pixel,
      end at x = width-1, y=height-1 for lower right pixel"
 
-    |index "{ Class: SmallInteger }"
-     rVal gVal bVal|
-
-    index := 1 + (((width * y) + x) * 3).
+    |rgbVal|
+
     photometric == #rgb ifTrue:[
-	rVal := bytes at:(index).
-	gVal := bytes at:(index + 1).
-	bVal := bytes at:(index + 2).
-	^ Color redByte:rVal greenByte:gVal blueByte:bVal
+        rgbVal := self pixelAtX:x y:y.
+        ^ Color rgbValue:rgbVal.
     ].
     "/ the inherited method should handle all cases.
     ^ super colorAtX:x y:y.
@@ -98,14 +94,8 @@
      Pixels start at x=0 , y=0 for upper left pixel, end at
      x = width-1, y=height-1 for lower right pixel."
 
-    |index "{ Class: SmallInteger }"|
-
     photometric ~~ #rgb ifTrue:[^ super colorAtX:x y:y put:aColor].
-
-    index := 1 + (((width * y) + x) * 3).
-    bytes at:(index) put:(aColor redByte).
-    bytes at:(index + 1) put:(aColor greenByte).
-    bytes at:(index + 2) put:(aColor blueByte).
+    self pixelAtX:x y:y put:aColor rgbValue.
 
     "Created: 24.4.1997 / 17:32:59 / cg"
 !