--- a/ImageEditView.st Wed Jul 10 12:21:12 1996 +0200
+++ b/ImageEditView.st Thu Jul 11 21:15:09 1996 +0200
@@ -50,122 +50,101 @@
!ImageEditView methodsFor:'drawing'!
-redraw
- |x0 y h w dotW dotH color last runW|
+redrawX:x y:y width:w height:h
+ |area ih iw dotW dotH minX maxX minY maxY color last lastY runW x0 oldClip|
image isNil ifTrue:[^ self].
- magnification = (1@1) ifTrue:[
- ^ super redraw
+"/ area := Rectangle left:x top:y width:w height:h.
+"/ oldClip := self clippingRectangleOrNil.
+"/ self clippingRectangle:area.
+
+ (magnification = (1@1)) ifTrue:[
+ super redrawX:x y:y width:w height:h.
+"/ self clippingRectangle:oldClip.
+ ^ self
].
+
+"/ self clear.
+
magnifiedImage notNil ifTrue:[
magnifiedImage := magnifiedImage on:device.
- self clear.
- self paint:Black on:White.
magnifiedImage depth == 1 ifTrue:[
self paint:(magnifiedImage colorFromValue:1)
on:(magnifiedImage colorFromValue:0).
+ ] ifFalse:[
+ self paint:Black on:White.
].
self function:#copy.
self displayOpaqueForm:magnifiedImage x:margin y:margin.
+"/ self clippingRectangle:oldClip.
^ self
].
- self clear.
-
- h := image height.
- w := image width.
+"/ self clear.
+ ih := image height.
+ iw := image width.
dotW := magnification x.
dotH := magnification y.
- ((h * dotH > height) or:[w * dotW > width]) ifTrue:[
- ^ self redrawX:0 y:0 width:width height:height
+
+ minX := x // dotW.
+ minY := y // dotW.
+ maxX := (x + w) // dotW + 1.
+ maxX > iw ifTrue:[
+ maxX := iw
+ ].
+ maxY := (y + h) // dotH + 1.
+ maxY > ih ifTrue:[
+ maxY := ih
].
- y := 0.
- 0 to:h-1 do:[:row |
- runW := 0.
- x0 := 0.
+ lastY := -1.
+
+ x0 := minX.
+ runW := 0.
- image colorsAtY:row from:0 to:(w-1) do:[:x :color |
- color ~= last ifTrue:[
- runW ~~ 0 ifTrue:[
- self fillRectangleX:x0 y:y width:runW height:dotH.
- ].
- "/ keep colors - otherwise they might get collected & changed
- colors notNil ifTrue:[colors add:color].
- self paint:color.
- last := color.
- x0 := x.
+ image colorsFromX:minX y:minY toX:maxX-1 y:maxY-1 do:[:x :y :color |
+ y ~~ lastY ifTrue:[
+ runW ~~ 0 ifTrue:[
+ self fillRectangleX:(x0 * dotW + margin)
+ y:(lastY * dotH + margin)
+ width:runW height:dotH.
runW := 0.
].
- runW := runW + dotW
- ].
- self fillRectangleX:x0 y:y width:runW height:dotH.
- y := y + dotH
- ]
-
- "Modified: 18.6.1996 / 17:05:14 / cg"
-!
-
-redrawX:x y:y width:w height:h
- |area dx dy ih iw dotW dotH minX maxX minY maxY color last runW x0 oldClip|
-
- image isNil ifTrue:[^ self].
-
- area := Rectangle left:x top:y width:w height:h.
- oldClip := self clippingRectangleOrNil.
- self clippingRectangle:area.
-
- (magnification = (1@1) or:[magnifiedImage notNil]) ifTrue:[
- self redraw
- ] ifFalse:[
- self clear.
- ih := image height.
- iw := image width.
- dotW := magnification x.
- dotH := magnification y.
-
- minX := x // dotW.
- minY := y // dotW.
- maxX := (x + w) // dotW + 1.
- maxX > iw ifTrue:[
- maxX := iw
- ].
- maxY := (y + h) // dotH + 1.
- maxY > ih ifTrue:[
- maxY := ih
+ x0 := x.
+ lastY := y.
].
- dy := minY * dotH.
- minY to:maxY-1 do:[:row |
- dx := minX * dotW.
- x0 := dx.
- runW := 0.
+ color ~~ last ifTrue:[
+ runW ~~ 0 ifTrue:[
+ self fillRectangleX:(x0 * dotW + margin)
+ y:(y * dotH + margin)
+ width:runW height:dotH.
+ runW := 0.
+ ].
- image colorsAtY:row from:minX to:(maxX-1) do:[:x :color |
- runW ~~ 0 ifTrue:[
- self fillRectangleX:x0 y:dy width:runW height:dotH.
- ].
- color ~= last ifTrue:[
- "/ keep colors - otherwise they might get collected & changed
- colors notNil ifTrue:[colors add:color].
- self paint:color.
- last := color.
- runW := 0.
- x0 := x * dotW.
- ].
- runW := runW + dotW
- ].
- self fillRectangleX:x0 y:dy width:runW height:dotH.
- dy := dy + dotH
- ]
+ "/ keep colors - otherwise they might get collected & changed
+ colors notNil ifTrue:[colors add:color].
+ self paint:color.
+ last := color.
+ runW := 0.
+ x0 := x.
+ ].
+ runW := runW + dotW
].
- self clippingRectangle:oldClip
+ runW ~~ 0 ifTrue:[
+ self fillRectangleX:(x0 * dotW + margin)
+ y:(lastY * dotH + margin)
+ width:runW height:dotH.
+ runW := 0.
+ ].
- "Modified: 18.6.1996 / 17:05:19 / cg"
+"/ self clippingRectangle:oldClip
+
+ "Modified: 11.7.1996 / 21:13:53 / cg"
! !
!ImageEditView methodsFor:'event handling'!
@@ -239,16 +218,18 @@
|oldMag|
windowGroup withCursor:Cursor wait do:[
- oldMag := magnification.
- magnifiedImage := nil.
- magnification := 1@1.
- image perform:operation withArguments:args.
- (oldMag isNil or:[oldMag = magnification]) ifTrue:[
- self redraw
- ] ifFalse:[
- self magnification:oldMag.
- ]
+ oldMag := magnification.
+ magnifiedImage := nil.
+ magnification := 1@1.
+ image perform:operation withArguments:args.
+ (oldMag isNil or:[oldMag = magnification]) ifTrue:[
+ self invalidate
+ ] ifFalse:[
+ self magnification:oldMag.
+ ]
]
+
+ "Modified: 11.7.1996 / 21:03:10 / cg"
! !
!ImageEditView methodsFor:'initialization'!
@@ -354,12 +335,12 @@
].
self contentsChanged.
- self redraw.
+ self invalidate.
self cursor:Cursor normal
]
- "Modified: 18.6.1996 / 17:05:00 / cg"
"Modified: 5.7.1996 / 17:44:29 / stefan"
+ "Modified: 11.7.1996 / 21:03:06 / cg"
!
saveAs
@@ -420,5 +401,5 @@
!ImageEditView class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libwidg2/ImageEditView.st,v 1.25 1996-07-05 21:10:55 stefan Exp $'
+ ^ '$Header: /cvs/stx/stx/libwidg2/ImageEditView.st,v 1.26 1996-07-11 19:15:00 cg Exp $'
! !