#DOCUMENTATION by cg
authorClaus Gittinger <cg@exept.de>
Fri, 01 Sep 2017 15:36:01 +0200
changeset 4009 bece1481d314
parent 4008 f7f1b89886ef
child 4010 3df2676d3e8a
#DOCUMENTATION by cg class: XWDReader changed: #readImage class: XWDReader class comment/format in: #documentation
XWDReader.st
--- a/XWDReader.st	Fri Sep 01 10:17:17 2017 +0200
+++ b/XWDReader.st	Fri Sep 01 15:36:01 2017 +0200
@@ -15,8 +15,9 @@
      which was written by Brad Schoening <brad@boole.com> 
      who placed it into the public domain.
 "
+"{ Package: 'stx:libview2' }"
 
-"{ Package: 'stx:libview2' }"
+"{ NameSpace: Smalltalk }"
 
 ImageReader subclass:#XWDReader
 	instanceVariableNames:''
@@ -52,6 +53,16 @@
     this class provides methods for loading/saving of x-window dump (xwd) images.
     Both reading and writing of images is supported.
 
+    Notice, that an xserver can be started on a mapped xwd-format file with
+        Xvfb :1 -fbdir /var/tmp
+
+    then an application started on it with:
+        xterm -display :1
+
+    and finally, a screenshot be taken by me, with:
+        XWDReader fromFile:'/var/tmp/Xvfb_screen0'
+        
+
     [See also:]
         Image Form Icon
         BlitImageReader FaceReader GIFReader JPEGReader PBMReader PCXReader 
@@ -126,14 +137,14 @@
         |clr r g b|
 
         inStream nextLong.
-        r := inStream nextUnsignedShortMSB:true.
-        g := inStream nextUnsignedShortMSB:true.
-        b := inStream nextUnsignedShortMSB:true.
+        r := inStream nextUnsignedInt16MSB:true.
+        g := inStream nextUnsignedInt16MSB:true.
+        b := inStream nextUnsignedInt16MSB:true.
         clr := ColorValue scaledRed: (r bitShift: -3)
                         scaledGreen: (g bitShift: -3)
                          scaledBlue: (b bitShift: -3).
         colorMap at:i put:clr.
-        inStream nextWord.
+        inStream nextUnsignedInt16MSB:true.
     ].
 
     nColors+1 to:colormapSize do: [:i | colorMap at:i put:Color black].
@@ -163,6 +174,8 @@
      XWDReader save:(Image fromUser) onFile: '/tmp/st.xwd' 
      (Image fromFile: '/tmp/st.xwd') inspect 
     "
+
+    "Modified: / 01-09-2017 / 15:35:34 / cg"
 ! !
 
 !XWDReader methodsFor:'writing'!
@@ -293,7 +306,8 @@
 !XWDReader class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview2/XWDReader.st,v 1.27 2003-11-19 15:24:16 cg Exp $'
+    ^ '$Header$'
 ! !
 
+
 XWDReader initialize!