@@ -109,7 +109,7 @@ ScalingCanvas class >> exampleFrameAndFillRectangle2 [
109109]
110110
111111{ #category : ' examples' }
112- ScalingCanvas class >> exampleImageMorph [
112+ ScalingCanvas class >> exampleImageMorph1 [
113113
114114 ^ self privateExampleWithMorph: (Morph new
115115 color: Color veryVeryLightGray;
@@ -123,6 +123,34 @@ ScalingCanvas class >> exampleImageMorph [
123123 yourself )
124124]
125125
126+ { #category : ' examples' }
127+ ScalingCanvas class >> exampleImageMorph2 [
128+
129+ | forms imageMorph |
130+
131+ forms := (1 to: 2 ) collect: [ :scale |
132+ (FormCanvas extent: 100 asPoint * scale depth: 1 )
133+ fillOval: ((0 asPoint extent: 100 asPoint * scale) insetBy: 5 * scale) fillStyle: Color green;
134+ form ].
135+ (imageMorph := ImageMorph withFormSet: (FormSet forms: forms))
136+ color: Color blue.
137+ ^ self privateExampleWithMorph: imageMorph
138+ ]
139+
140+ { #category : ' examples' }
141+ ScalingCanvas class >> exampleImageMorph3 [
142+
143+ | forms imageMorph |
144+
145+ forms := (1 to: 2 ) collect: [ :scale |
146+ (FormCanvas extent: 10 asPoint * scale)
147+ fillOval: ((0 asPoint extent: 10 asPoint * scale) insetBy: 1 * scale) fillStyle: Color black;
148+ form ].
149+ (imageMorph := ImageMorph withFormSet: (FormSet forms: forms))
150+ resize: 200 @100 .
151+ ^ self privateExampleWithMorph: imageMorph
152+ ]
153+
126154{ #category : ' examples' }
127155ScalingCanvas class >> exampleLine1 [
128156
@@ -282,6 +310,18 @@ ScalingCanvas >> depth [
282310 ^ formCanvas depth
283311]
284312
313+ { #category : ' drawing - images' }
314+ ScalingCanvas >> drawFormSet: formSet at: point [
315+
316+ | form scaledForm |
317+
318+ form := formSet asForm.
319+ scaledForm := (scale = 2 and : [ FormMapping includesKey: form ])
320+ ifTrue: [ FormMapping at: form ]
321+ ifFalse: [ formSet asFormAtScale: scale ].
322+ formCanvas drawImage: scaledForm at: point * scale
323+ ]
324+
285325{ #category : ' drawing - polygons' }
286326ScalingCanvas >> drawPolygon: vertices color: aColor borderWidth: bw borderColor: bc [
287327
@@ -499,3 +539,15 @@ ScalingCanvas >> translateBy: delta during: aBlock [
499539 formCanvas translateBy: delta * scale during: [ :transformedFormCanvas |
500540 aBlock value: (self class formCanvas: transformedFormCanvas scale: scale) ]
501541]
542+
543+ { #category : ' drawing - images' }
544+ ScalingCanvas >> translucentFormSet: formSet at: point [
545+
546+ | form scaledForm |
547+
548+ form := formSet asForm.
549+ scaledForm := (scale = 2 and : [ FormMapping includesKey: form ])
550+ ifTrue: [ FormMapping at: form ]
551+ ifFalse: [ formSet asFormAtScale: scale ].
552+ formCanvas translucentImage: scaledForm at: point * scale
553+ ]
0 commit comments