--- a/ImageEditView.st Wed Jun 04 13:37:29 1997 +0200
+++ b/ImageEditView.st Wed Jun 04 13:49:46 1997 +0200
@@ -86,48 +86,62 @@
!
magnification:aMagnificationPoint
- |nPixel savedImage|
+ |nPixel savedImage oldBounds newBounds rects|
magnification ~= aMagnificationPoint ifTrue:[
"show wait cursor; although magnification is fast, dithering may take a while"
- self cursor:Cursor wait.
+ self withWaitCursorDo:[
+ magnifiedImage isNil ifTrue:[
+ oldBounds := image bounds.
+ ] ifFalse:[
+ oldBounds := magnifiedImage bounds
+ ].
- (device visualType == #PseudoColor) ifTrue:[
- "release kept colors"
- colors := IdentitySet new.
- ].
+ (device visualType == #PseudoColor) ifTrue:[
+ "release kept colors"
+ colors := IdentitySet new.
+ ].
+
+ magnification := aMagnificationPoint asPoint.
- magnification := aMagnificationPoint asPoint.
+ "use a magnified image, if its size wont be too big"
+ magnifiedImage := nil.
- "use a magnified image, if its size wont be too big"
- magnifiedImage := nil.
+ "avoid slow scroll"
+ savedImage := image.
+ image := nil.
+ self scrollToTopLeft.
+ image := savedImage.
- "avoid slow scroll"
- savedImage := image.
- image := nil.
- self scrollToTopLeft.
- image := savedImage.
+ magnification ~= (1@1) ifTrue:[
+ nPixel := image width * image height * magnification x * magnification y.
+ nPixel <= (2000 * 2000) ifTrue:[
+ Transcript showCR:'magnifying ..'; endEntry.
+ antiAlias ifTrue:[
+ magnifiedImage := image hardAntiAliasedMagnifiedBy:magnification
+ ] ifFalse:[
+ magnifiedImage := image magnifiedBy:magnification
+ ]
+ ].
+ ].
- magnification ~= (1@1) ifTrue:[
- nPixel := image width * image height * magnification x * magnification y.
- nPixel <= (2000 * 2000) ifTrue:[
- Transcript showCR:'magnifying ..'; endEntry.
- antiAlias ifTrue:[
- magnifiedImage := image hardAntiAliasedMagnifiedBy:magnification
- ] ifFalse:[
- magnifiedImage := image magnifiedBy:magnification
+ self contentsChanged.
+
+ magnifiedImage isNil ifTrue:[
+ newBounds := image bounds.
+ ] ifFalse:[
+ newBounds := magnifiedImage bounds
+ ].
+ (rects := oldBounds areasOutside:newBounds) notNil ifTrue:[
+ rects do:[:rect |
+ self clearRectangle:rect+(1@1).
]
- ].
+ ]
].
-
- self contentsChanged.
- self clear.
self invalidate.
- self cursor:Cursor normal
]
- "Modified: 5.7.1996 / 17:44:29 / stefan"
- "Modified: 2.6.1997 / 15:48:52 / cg"
+ "Modified: 4.6.1997 / 13:38:16 / cg"
!
pathName:aPathName
@@ -159,23 +173,36 @@
"/ self clear.
magnifiedImage notNil ifTrue:[
- magnifiedImage := magnifiedImage on:device.
+ self function:#copy.
+ self paint:Black.
+
+ magnifiedImage device ~~ device ifTrue:[
+ "/ this may take some time (allocating colors & dithering
- magnifiedImage depth == 1 ifTrue:[
- self paint:(magnifiedImage colorFromValue:1)
- on:(magnifiedImage colorFromValue:0).
- ] ifFalse:[
- self paint:Black on:White.
+ self
+ displayRectangleX:margin y:margin
+ width:magnifiedImage width height:magnifiedImage height.
+
+ self withWaitCursorDo:[
+ magnifiedImage := magnifiedImage on:device.
+ ]
].
- self function:#copy.
+ self withWaitCursorDo:[
+ magnifiedImage depth == 1 ifTrue:[
+ self paint:(magnifiedImage colorFromValue:1)
+ on:(magnifiedImage colorFromValue:0).
+ ] ifFalse:[
+ self paint:Black on:White.
+ ].
- (image depth ~~ 1
- and:[image mask notNil]) ifTrue:[
- self clearRectangleX:x y:y width:w height:h.
- self displayForm:magnifiedImage x:margin y:margin
- ] ifFalse:[
- self displayOpaqueForm:magnifiedImage x:margin y:margin
+ (magnifiedImage depth ~~ 1
+ and:[magnifiedImage mask notNil]) ifTrue:[
+ self clearRectangleX:x y:y width:w height:h.
+ self displayForm:magnifiedImage x:margin y:margin
+ ] ifFalse:[
+ self displayOpaqueForm:magnifiedImage x:margin y:margin
+ ].
].
"/ self clippingRectangle:oldClip.
@@ -243,7 +270,7 @@
"/ self clippingRectangle:oldClip
- "Modified: 20.2.1997 / 18:27:10 / cg"
+ "Modified: 4.6.1997 / 13:45:53 / cg"
! !
!ImageEditView methodsFor:'event handling'!
@@ -370,15 +397,15 @@
magnifiedImage := nil.
magnification := 1@1.
image := image perform:operation withArguments:args.
+ self clear.
(oldMag isNil or:[oldMag = magnification]) ifTrue:[
- self clear.
self invalidate
] ifFalse:[
self magnification:oldMag.
]
]
- "Modified: 17.3.1997 / 11:58:33 / cg"
+ "Modified: 4.6.1997 / 13:40:37 / cg"
!
rotateCCW
@@ -776,5 +803,5 @@
!ImageEditView class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libwidg2/ImageEditView.st,v 1.40 1997-06-03 16:43:05 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libwidg2/ImageEditView.st,v 1.41 1997-06-04 11:49:46 cg Exp $'
! !