Depth24Image.st
changeset 46 7b331e9012fd
parent 38 2652fc96e660
child 54 29a6b2f8e042
--- a/Depth24Image.st	Thu Jun 02 23:21:42 1994 +0200
+++ b/Depth24Image.st	Fri Jun 03 02:54:39 1994 +0200
@@ -20,13 +20,37 @@
 Depth24Image comment:'
 COPYRIGHT (c) 1993 by Claus Gittinger
               All Rights Reserved
+'!
 
-this class represents truecolor (24 bit / pixel) images
+!Depth24Image class methodsFor:'documentation'!
+
+copyright
+"
+ COPYRIGHT (c) 1993 by Claus Gittinger
+              All Rights Reserved
 
-$Header: /cvs/stx/stx/libview/Depth24Image.st,v 1.4 1994-03-30 10:11:45 claus Exp $
+ This software is furnished under a license and may be used
+ only in accordance with the terms of that license and with the
+ inclusion of the above copyright notice.   This software may not
+ be provided or otherwise made available to, or used by, any
+ other person.  No title to or ownership of the software is
+ hereby transferred.
+"
+!
 
-written summer 93 by claus
-'!
+version
+"
+$Header: /cvs/stx/stx/libview/Depth24Image.st,v 1.5 1994-06-03 00:52:14 claus Exp $
+"
+!
+
+documentation
+"
+    this class represents true-color (24 bit / pixel) images.
+    It mainly consists of methods already implemented in Image,
+    reimplemented here for more performance.
+"
+! !
 
 !Depth24Image methodsFor:'accessing'!
 
@@ -835,8 +859,7 @@
 %{
                 if (__isByteArray(_INST(bytes))) {
                     int sI = _intVal(srcIndex);
-                    unsigned char *cp = (unsigned char *)
-                                    (_ArrayInstPtr(_INST(bytes))->a_element);
+                    unsigned char *cp = _ByteArrayInstPtr(_INST(bytes))->ba_element;
 
                     r = _MKSMALLINT((cp[sI - 1] & _intVal(rMask)) + 1);
                     g = _MKSMALLINT((cp[sI]     & _intVal(gMask)) + 1);
@@ -874,7 +897,7 @@
                     blueArray at:b put:true.
                     nColors := nColors + 1.
                     (nColors > nColorCells) ifTrue:[
-                        'D24IMAGE: more than ' errorPrint. nColorCells errorPrint. ' colors' errorPrintNewline.
+                        'D24IMAGE: more than ' errorPrint. nColorCells errorPrint. ' colors' errorPrintNL.
                         srcIndex := dataSize + 1
                     ]
                 ]
@@ -893,7 +916,7 @@
                     gMask := (gMask bitShift:1) bitAnd:2r11111111.
                     bMask := (bMask bitShift:1) bitAnd:2r11111111
                 ].
-                'D24IMAGE: retry with less color resolution' errorPrintNewline.
+                'D24IMAGE: retry with less color resolution' errorPrintNL.
 "
     'masks:' print. rMask print. ' ' print. gMask print. ' ' print.
     bMask printNewline
@@ -901,7 +924,7 @@
             ]
         ].
 
-       'D24IMAGE: ' errorPrint. nColors errorPrint. ' colors used' errorPrintNewline.
+        'D24IMAGE: ' errorPrint. nColors errorPrint. ' colors used' errorPrintNL.
         colors := Array new:nColors.
         colorIndex := 1.
 
@@ -940,10 +963,10 @@
             r := r + 1
         ].
 
-        "again with less color bits if we didnt get all colors"
+        "again with less color bits if we did not get all colors"
 
         fit ifFalse:[
-           'D24IMAGE: still no fit' errorPrintNewline.
+           'D24IMAGE: still no fit' errorPrintNL.
 
             "free the allocated colors"
             colors atAllPut:nil.
@@ -990,13 +1013,14 @@
         dstIndex := dstIndex + 1
     ].
 
-    f := Form width:width height:height depth:8 on:aDevice.
+    f := Form width:width height:height depth:aDevice depth on:aDevice.
     f isNil ifTrue:[^ nil].
     f colorMap:colors.
     f initGC.
-    aDevice drawBits:pseudoBits depth:8 width:width height:height
-                    x:0 y:0
-                 into:(f id) x:0 y:0 width:width height:height with:(f gcId).
+    aDevice drawBits:pseudoBits bitsPerPixel:8 depth:aDevice depth
+               width:width height:height
+                   x:0 y:0
+                into:(f id) x:0 y:0 width:width height:height with:(f gcId).
     ^ f
 ! !