Depth24Image.st
changeset 7273 894274c8169d
parent 7125 f37b7e5d26df
child 7278 52a81602e12c
--- a/Depth24Image.st	Sat Apr 02 19:44:35 2016 +0200
+++ b/Depth24Image.st	Sat Apr 02 19:45:28 2016 +0200
@@ -120,6 +120,25 @@
      gVal  "{ Class: SmallInteger }"
      bVal  "{ Class: SmallInteger }"|
 
+%{  /* NOCONTEXT */
+    OBJ b = __INST(bytes);
+    OBJ w = __INST(width);
+
+    if (__isByteArrayLike(b)
+     && __bothSmallInteger(x, y)
+     && __isSmallInteger(w)
+     && (__INST(pixelFunction)==nil) ) {
+        int _idx;
+
+        _idx = ((__intVal(w) * __intVal(y)) + __intVal(x))*3;
+        if (((unsigned)(_idx+2)) < __byteArraySize(b)) {
+            unsigned char *pPix = &(__ByteArrayInstPtr(b)->ba_element[_idx]);
+            unsigned int _pix;
+            _pix = (((pPix[0]<<8)+pPix[1])<<8)+pPix[2];
+            RETURN( __MKSMALLINT(_pix) );
+        }
+    }
+%}.
     pixelFunction notNil ifTrue:[^ pixelFunction value:x value:y].
 
     index := 1 + (((width * y) + x) * 3).