changeset 257 | 0acd4525d53e |
parent 239 | a0e97ba3d7f4 |
child 269 | 167651794a77 |
256:4684c0a52203 | 257:0acd4525d53e |
---|---|
15 classVariableNames:'' |
15 classVariableNames:'' |
16 poolDictionaries:'' |
16 poolDictionaries:'' |
17 category:'Views-Misc' |
17 category:'Views-Misc' |
18 ! |
18 ! |
19 |
19 |
20 !ImageView class methodsFor:'documentation'! |
20 !ImageView class methodsFor:'documentation'! |
21 |
21 |
22 copyright |
22 copyright |
23 " |
23 " |
24 COPYRIGHT (c) 1993 by Claus Gittinger |
24 COPYRIGHT (c) 1993 by Claus Gittinger |
25 All Rights Reserved |
25 All Rights Reserved |
53 ImageView openOnImage:(Image fromFile:'bitmaps/garfield.gif') |
53 ImageView openOnImage:(Image fromFile:'bitmaps/garfield.gif') |
54 ImageView openOnImage:(Form fromFile:'SBrowser.xbm') |
54 ImageView openOnImage:(Form fromFile:'SBrowser.xbm') |
55 " |
55 " |
56 ! ! |
56 ! ! |
57 |
57 |
58 !ImageView class methodsFor:'startup'! |
58 !ImageView class methodsFor:'startup'! |
59 |
59 |
60 openOn:aFileName |
60 openOn:aFileName |
61 "startup an image viewer on an image read from a file" |
61 "startup an image viewer on an image read from a file" |
62 |
62 |
63 |top img e| |
63 |top img e| |
200 ! ! |
200 ! ! |
201 |
201 |
202 !ImageView methodsFor:'drawing'! |
202 !ImageView methodsFor:'drawing'! |
203 |
203 |
204 redrawX:x y:y width:w height:h |
204 redrawX:x y:y width:w height:h |
205 |xI yI| |
205 |xI yI depth ext| |
206 |
206 |
207 image notNil ifTrue:[ |
207 image notNil ifTrue:[ |
208 image device ~~ device ifTrue:[ |
208 image device ~~ device ifTrue:[ |
209 self withWaitCursorDo:[ |
209 self withWaitCursorDo:[ |
210 image := image on:device. |
210 image := image on:device. |
211 ] |
211 ] |
212 ]. |
212 ]. |
213 |
213 |
214 (image depth == 1) ifTrue:[ |
214 ((depth := image depth) == 1) ifTrue:[ |
215 self paint:(image colorFromValue:1) |
215 self paint:(image colorFromValue:1) |
216 on:(image colorFromValue:0). |
216 on:(image colorFromValue:0). |
217 ]. |
217 ]. |
218 adjust == #center ifTrue:[ |
218 adjust == #center ifTrue:[ |
219 xI := (width - (margin * 2) - (image extent x)) // 2. |
219 ext := image extent. |
220 yI := (height - (margin * 2) - (image extent y)) // 2. |
220 xI := (width - (margin * 2) - (ext x)) // 2. |
221 yI := (height - (margin * 2) - (ext y)) // 2. |
|
221 ] ifFalse:[ |
222 ] ifFalse:[ |
222 xI := yI := margin |
223 xI := yI := margin |
223 ]. |
224 ]. |
224 (image depth ~~ 1 |
225 |
226 (depth ~~ 1 |
|
225 and:[image mask notNil]) ifTrue:[ |
227 and:[image mask notNil]) ifTrue:[ |
226 self clearRectangleX:x y:y width:w height:h. |
228 self clearRectangleX:x y:y width:w height:h. |
227 self displayForm:image x:xI y:yI |
229 self displayForm:image x:xI y:yI |
228 ] ifFalse:[ |
230 ] ifFalse:[ |
229 self displayOpaqueForm:image x:xI y:yI |
231 self displayOpaqueForm:image x:xI y:yI |
255 destroy |
257 destroy |
256 image := nil. |
258 image := nil. |
257 super destroy. |
259 super destroy. |
258 ! ! |
260 ! ! |
259 |
261 |
260 !ImageView class methodsFor:'documentation'! |
262 !ImageView class methodsFor:'documentation'! |
261 |
263 |
262 version |
264 version |
263 ^ '$Header: /cvs/stx/stx/libwidg2/ImageView.st,v 1.23 1996-09-05 09:55:57 cg Exp $' |
265 ^ '$Header: /cvs/stx/stx/libwidg2/ImageView.st,v 1.24 1996-10-22 15:58:43 cg Exp $' |
264 ! ! |
266 ! ! |