--- a/Depth8Image.st Thu Jan 22 14:01:51 1998 +0100
+++ b/Depth8Image.st Thu Jan 22 14:04:42 1998 +0100
@@ -10,8 +10,6 @@
hereby transferred.
"
-'From Smalltalk/X, Version:3.2.1 on 19-oct-1997 at 5:19:15 pm' !
-
Image subclass:#Depth8Image
instanceVariableNames:''
classVariableNames:''
@@ -743,9 +741,8 @@
usedDeviceBitsPerPixel := bestFormat at:#bitsPerPixel.
usedDevicePadding := bestFormat at:#padding.
- usedDeviceBytesPerRow := self bytesPerRowPaddedTo:usedDevicePadding.
- padd := usedDeviceBytesPerRow - self bytesPerRow.
-
+ usedDeviceBytesPerRow := self class bytesPerRowForWidth:width depth:usedDeviceBitsPerPixel padding:usedDevicePadding.
+ padd := usedDeviceBytesPerRow -( self class bytesPerRowForWidth:width depth:usedDeviceBitsPerPixel padding:8).
imageBits := ByteArray uninitializedNew:(usedDeviceBytesPerRow * height).
"/ for now, only support some depths
@@ -761,7 +758,7 @@
&& __isArray(colorValues)
&& __isByteArray(_INST(bytes))
&& __isByteArray(imageBits)) {
- int r,p;
+ int r,p;
int x, y, w, h, nPix;
unsigned char *srcPtr = _ByteArrayInstPtr(_INST(bytes))->ba_element;
@@ -770,14 +767,14 @@
w = __intVal(_INST(width));
h = __intVal(_INST(height));
- r = w;
- p = __intVal(padd);
+ r = w;
+ p = __intVal(padd);
nPix = w * h;
- while (nPix > 0) {
+ while (nPix-- > 0) {
unsigned idx, v;
OBJ clr;
- idx = *srcPtr;
+ idx = *srcPtr++;
clr = ap[idx];
v = __intVal(clr);
#ifdef MSBFIRST
@@ -787,8 +784,6 @@
dstPtr[1] = (v) & 0xFF;
#endif
dstPtr += 2;
- srcPtr += 1;
- nPix--;
if (--r == 0) {
dstPtr += p;
@@ -852,7 +847,7 @@
&& __isByteArray(_INST(bytes))
&& __isByteArray(imageBits)) {
int x, y, w, h, nPix;
- int r,p;
+ int r,p;
unsigned char *srcPtr = _ByteArrayInstPtr(_INST(bytes))->ba_element;
unsigned char *dstPtr = _ByteArrayInstPtr(imageBits)->ba_element;
@@ -899,7 +894,7 @@
&& __isByteArray(_INST(bytes))
&& __isByteArray(imageBits)) {
int x, y, w, h, nPix;
- int r,p;
+ int r,p;
unsigned char *srcPtr = _ByteArrayInstPtr(_INST(bytes))->ba_element;
unsigned char *dstPtr = _ByteArrayInstPtr(imageBits)->ba_element;
@@ -950,11 +945,11 @@
form
copyBitsFrom:imageBits
bitsPerPixel:usedDeviceBitsPerPixel
- depth:usedDeviceDepth
- padding:usedDevicePadding
+ depth:usedDeviceDepth
+ padding:usedDevicePadding
width:width height:height
x:0 y:0
- toX:0 y:0.
+ toX:0 y:0.
^ form
@@ -1784,5 +1779,5 @@
!Depth8Image class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libview/Depth8Image.st,v 1.79 1998-01-20 23:19:46 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libview/Depth8Image.st,v 1.80 1998-01-22 13:04:42 tz Exp $'
! !