49 |
49 |
50 ImageView openOn:'bitmaps/garfield.gif' |
50 ImageView openOn:'bitmaps/garfield.gif' |
51 ImageView openOn:'bitmaps/SBrowser.xbm' |
51 ImageView openOn:'bitmaps/SBrowser.xbm' |
52 |
52 |
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:(Image fromFile:'bitmaps/SBrowser.xbm') |
55 " |
55 " |
56 ! ! |
56 ! ! |
57 |
57 |
58 !ImageView class methodsFor:'startup'! |
58 !ImageView class methodsFor:'startup'! |
59 |
59 |
177 image:anImage |
176 image:anImage |
178 "set the image - show a wait cursor, since image dithering may take a while" |
177 "set the image - show a wait cursor, since image dithering may take a while" |
179 |
178 |
180 image := anImage. |
179 image := anImage. |
181 anImage notNil ifTrue:[ |
180 anImage notNil ifTrue:[ |
182 self cursor:Cursor wait. |
181 self cursor:Cursor wait. |
183 shown ifTrue:[ |
182 shown ifTrue:[ |
184 self invalidate |
183 self invalidate |
185 ]. |
184 ]. |
186 self contentsChanged. |
185 self contentsChanged. |
187 self cursor:(Cursor normal). |
186 self cursor:(Cursor normal). |
188 ]. |
187 ]. |
189 |
188 |
190 " |
189 " |
191 ImageView new realize image:(Image fromFile:'bitmaps/claus.gif') |
190 ImageView new realize image:(Image fromFile:'bitmaps/claus.gif') |
192 |
191 |
203 |
202 |
204 redrawX:x y:y width:w height:h |
203 redrawX:x y:y width:w height:h |
205 |xI yI depth ext| |
204 |xI yI depth ext| |
206 |
205 |
207 image notNil ifTrue:[ |
206 image notNil ifTrue:[ |
208 image device ~~ device ifTrue:[ |
207 image device ~~ device ifTrue:[ |
209 self withWaitCursorDo:[ |
208 self withWaitCursorDo:[ |
210 image := image on:device. |
209 image := image on:device. |
211 ] |
210 ] |
212 ]. |
211 ]. |
213 |
212 |
214 ((depth := image depth) == 1) ifTrue:[ |
213 ((depth := image depth) == 1) ifTrue:[ |
215 self paint:(image colorFromValue:1) |
214 self paint:(image colorFromValue:1) |
216 on:(image colorFromValue:0). |
215 on:(image colorFromValue:0). |
217 ]. |
216 ]. |
218 adjust == #center ifTrue:[ |
217 adjust == #center ifTrue:[ |
219 ext := image extent. |
218 ext := image extent. |
220 xI := (width - (margin * 2) - (ext x)) // 2. |
219 xI := (width - (margin * 2) - (ext x)) // 2. |
221 yI := (height - (margin * 2) - (ext y)) // 2. |
220 yI := (height - (margin * 2) - (ext y)) // 2. |
222 ] ifFalse:[ |
221 ] ifFalse:[ |
223 xI := yI := margin |
222 xI := yI := margin |
224 ]. |
223 ]. |
225 |
224 |
226 (depth ~~ 1 |
225 (depth ~~ 1 |
227 and:[image mask notNil]) ifTrue:[ |
226 and:[image mask notNil]) ifTrue:[ |
228 self clearRectangleX:x y:y width:w height:h. |
227 self clearRectangleX:x y:y width:w height:h. |
229 self displayForm:image x:xI y:yI |
228 self displayForm:image x:xI y:yI |
230 ] ifFalse:[ |
229 ] ifFalse:[ |
231 self displayOpaqueForm:image x:xI y:yI |
230 self displayOpaqueForm:image x:xI y:yI |
232 ] |
231 ] |
233 ] |
232 ] |
234 |
233 |
235 "Created: 11.7.1996 / 21:02:12 / cg" |
234 "Created: 11.7.1996 / 21:02:12 / cg" |
236 "Modified: 5.9.1996 / 11:55:19 / cg" |
235 "Modified: 5.9.1996 / 11:55:19 / cg" |
237 ! ! |
236 ! ! |