XWorkstation.st
changeset 397 094b8604ea72
parent 395 ce984a2deadd
child 402 f5a53e2a868d
--- a/XWorkstation.st	Fri Feb 02 20:22:35 1996 +0100
+++ b/XWorkstation.st	Sun Feb 04 18:11:29 1996 +0100
@@ -6025,23 +6025,37 @@
      number of bytes per scanline. The number of bytes per scanline is not known
      in advance, since the X-server is free to return whatever it thinks is a good padding."
 
-    |info|
+    |rawInfo info|
 
     ((w <= 0) or:[h <= 0]) ifTrue:[
 	self primitiveFailed.
 	^ nil
     ].
 
-    info := Array with:nil "depth"
-		  with:nil "bit order"
-		  with:nil "bytes_per_line"
-		  with:nil "byte_order".
+    rawInfo := Array new:8.
+		  "1 -> bit order"
+		  "2 -> depth"
+		  "3 -> bytes_per_line"
+		  "4 -> byte_order"
+		  "5 -> format"
+		  "6 -> bitmap_unit"
+		  "7 -> bitmap_pad"
+		  "8 -> bits_per_pixel"
 
     "/ had to extract the getPixel call into a separate method, to specify
     "/ unlimitedStack (some implementations use alloca and require huge amounts
     "/ of temporary stack space
 
-    (self primGetBitsFrom:aDrawableId x:srcx y:srcy width:w height:h into:imageBits infoInfo:info) ifTrue:[
+    (self primGetBitsFrom:aDrawableId x:srcx y:srcy width:w height:h into:imageBits infoInto:rawInfo) ifTrue:[
+	info := IdentityDictionary new.
+	info at:#bitOrder put:(rawInfo at:1).
+	info at:#depth put:(rawInfo at:2).
+	info at:#bytesPerLine put:(rawInfo at:3).
+	info at:#byteOrder put:(rawInfo at:4).
+	info at:#format put:(rawInfo at:5).
+	info at:#bitmapUnit put:(rawInfo at:6).
+	info at:#bitmapPad put:(rawInfo at:7).
+	info at:#bitsPerPixel put:(rawInfo at:8).
 	^ info
     ].
     "
@@ -6077,7 +6091,7 @@
     ^ nil
 !
 
-primGetBitsFrom:aDrawableId x:srcx y:srcy width:w height:h into:imageBits infoInfo:info
+primGetBitsFrom:aDrawableId x:srcx y:srcy width:w height:h into:imageBits infoInto:info
     "since XGetImage may allocate huge amount of stack space 
      (some implementations use alloca), this must run with unlimited stack."
 
@@ -6117,9 +6131,10 @@
 		numBytes = image->bytes_per_line * image->height;
 		break;
 	    default:
-		/* unsupported depth */
-		printf("unsupported depth:%d in primGetBits\n", image->depth);
-		goto fail;
+		/* unsupported depth ? */
+		printf("possibly unsupported depth:%d in primGetBits\n", image->depth);
+		numBytes = image->bytes_per_line * image->height;
+		break;
 	}
 
 #ifdef SUPERDEBUG
@@ -6141,6 +6156,16 @@
 	    _ArrayInstPtr(info)->a_element[3] = @symbol(msbFirst);
 	else
 	    _ArrayInstPtr(info)->a_element[3] = @symbol(lsbFirst);
+	if (image->format == XYBitmap)
+	    _ArrayInstPtr(info)->a_element[4] = @symbol(XYBitmap);
+	else if (image->format == XYPixmap)
+	    _ArrayInstPtr(info)->a_element[4] = @symbol(XYPixmap);
+	else if (image->format == ZPixmap)
+	    _ArrayInstPtr(info)->a_element[4] = @symbol(ZPixmap);
+	
+	_ArrayInstPtr(info)->a_element[5] = __MKSMALLINT(image->bitmap_unit);
+	_ArrayInstPtr(info)->a_element[6] = __MKSMALLINT(image->bitmap_pad);
+	_ArrayInstPtr(info)->a_element[7] = __MKSMALLINT(image->bits_per_pixel);
 	bcopy(image->data, _ByteArrayInstPtr(imageBits)->ba_element, numBytes);
 	XDestroyImage(image);
 	RETURN ( true );
@@ -7273,6 +7298,6 @@
 !XWorkstation class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/XWorkstation.st,v 1.106 1996-02-01 20:03:04 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/XWorkstation.st,v 1.107 1996-02-04 17:11:29 cg Exp $'
 ! !
 XWorkstation initialize!