equal
deleted
inserted
replaced
13 The above copyright does not apply to: |
13 The above copyright does not apply to: |
14 XWDReader>>save:onFile: |
14 XWDReader>>save:onFile: |
15 which was written by Brad Schoening <brad@boole.com> |
15 which was written by Brad Schoening <brad@boole.com> |
16 who placed it into the public domain. |
16 who placed it into the public domain. |
17 " |
17 " |
18 |
|
19 "{ Package: 'stx:libview2' }" |
18 "{ Package: 'stx:libview2' }" |
|
19 |
|
20 "{ NameSpace: Smalltalk }" |
20 |
21 |
21 ImageReader subclass:#XWDReader |
22 ImageReader subclass:#XWDReader |
22 instanceVariableNames:'' |
23 instanceVariableNames:'' |
23 classVariableNames:'' |
24 classVariableNames:'' |
24 poolDictionaries:'' |
25 poolDictionaries:'' |
49 |
50 |
50 documentation |
51 documentation |
51 " |
52 " |
52 this class provides methods for loading/saving of x-window dump (xwd) images. |
53 this class provides methods for loading/saving of x-window dump (xwd) images. |
53 Both reading and writing of images is supported. |
54 Both reading and writing of images is supported. |
|
55 |
|
56 Notice, that an xserver can be started on a mapped xwd-format file with |
|
57 Xvfb :1 -fbdir /var/tmp |
|
58 |
|
59 then an application started on it with: |
|
60 xterm -display :1 |
|
61 |
|
62 and finally, a screenshot be taken by me, with: |
|
63 XWDReader fromFile:'/var/tmp/Xvfb_screen0' |
|
64 |
54 |
65 |
55 [See also:] |
66 [See also:] |
56 Image Form Icon |
67 Image Form Icon |
57 BlitImageReader FaceReader GIFReader JPEGReader PBMReader PCXReader |
68 BlitImageReader FaceReader GIFReader JPEGReader PBMReader PCXReader |
58 ST80FormReader SunRasterReader TargaReader TIFFReader WindowsIconReader |
69 ST80FormReader SunRasterReader TargaReader TIFFReader WindowsIconReader |
124 |
135 |
125 1 to:nColors do:[:i | |
136 1 to:nColors do:[:i | |
126 |clr r g b| |
137 |clr r g b| |
127 |
138 |
128 inStream nextLong. |
139 inStream nextLong. |
129 r := inStream nextUnsignedShortMSB:true. |
140 r := inStream nextUnsignedInt16MSB:true. |
130 g := inStream nextUnsignedShortMSB:true. |
141 g := inStream nextUnsignedInt16MSB:true. |
131 b := inStream nextUnsignedShortMSB:true. |
142 b := inStream nextUnsignedInt16MSB:true. |
132 clr := ColorValue scaledRed: (r bitShift: -3) |
143 clr := ColorValue scaledRed: (r bitShift: -3) |
133 scaledGreen: (g bitShift: -3) |
144 scaledGreen: (g bitShift: -3) |
134 scaledBlue: (b bitShift: -3). |
145 scaledBlue: (b bitShift: -3). |
135 colorMap at:i put:clr. |
146 colorMap at:i put:clr. |
136 inStream nextWord. |
147 inStream nextUnsignedInt16MSB:true. |
137 ]. |
148 ]. |
138 |
149 |
139 nColors+1 to:colormapSize do: [:i | colorMap at:i put:Color black]. |
150 nColors+1 to:colormapSize do: [:i | colorMap at:i put:Color black]. |
140 |
151 |
141 bytesPerRow := width * bitsPerPixel // 8. |
152 bytesPerRow := width * bitsPerPixel // 8. |
161 " |
172 " |
162 " |
173 " |
163 XWDReader save:(Image fromUser) onFile: '/tmp/st.xwd' |
174 XWDReader save:(Image fromUser) onFile: '/tmp/st.xwd' |
164 (Image fromFile: '/tmp/st.xwd') inspect |
175 (Image fromFile: '/tmp/st.xwd') inspect |
165 " |
176 " |
|
177 |
|
178 "Modified: / 01-09-2017 / 15:35:34 / cg" |
166 ! ! |
179 ! ! |
167 |
180 |
168 !XWDReader methodsFor:'writing'! |
181 !XWDReader methodsFor:'writing'! |
169 |
182 |
170 save:image onStream:aStream |
183 save:image onStream:aStream |
291 ! ! |
304 ! ! |
292 |
305 |
293 !XWDReader class methodsFor:'documentation'! |
306 !XWDReader class methodsFor:'documentation'! |
294 |
307 |
295 version |
308 version |
296 ^ '$Header: /cvs/stx/stx/libview2/XWDReader.st,v 1.27 2003-11-19 15:24:16 cg Exp $' |
309 ^ '$Header$' |
297 ! ! |
310 ! ! |
|
311 |
298 |
312 |
299 XWDReader initialize! |
313 XWDReader initialize! |