--- a/DeviceGraphicsContext.st Fri Nov 13 11:58:19 2015 +0100
+++ b/DeviceGraphicsContext.st Fri Nov 13 12:00:15 2015 +0100
@@ -506,7 +506,7 @@
r := Rectangle left:x top:y width:w height:h
]
].
- clipRect := r
+ clipRect := aRectangleOrNil
"Created: / 28.5.1996 / 19:40:20 / cg"
"Modified: / 16.5.1999 / 19:40:37 / cg"
@@ -568,6 +568,42 @@
device := aDevice
!
+deviceClippingRectangle
+ "answer the clipping rectangle for drawing in device coordinates, or nil."
+
+ |x y w h transformedRectangle|
+
+ transformation isNil ifTrue:[
+ ^ clipRect.
+ ].
+
+ transformedRectangle := transformation transformRectangle:clipRect.
+
+ x := transformedRectangle left.
+ y := transformedRectangle top.
+ w := transformedRectangle width + 1.
+ h := transformedRectangle height + 1.
+
+ (x class == SmallInteger) ifFalse:[
+ w := w + (x - x truncated).
+ x := x truncated
+ ].
+ (y class == SmallInteger) ifFalse:[
+ h := h + (y - y truncated).
+ y := y truncated
+ ].
+ (w class == SmallInteger) ifFalse:[
+ w := w truncated + 1
+ ].
+ (h class == SmallInteger) ifFalse:[
+ h := h truncated + 1
+ ].
+ w := w max:0.
+ h := h max:0.
+
+ ^ Rectangle left:x top:y width:w height:h
+!
+
deviceClippingRectangle:aRectangleOrNil
"set the clipping rectangle for drawing (in device coordinates);
a nil argument turns off clipping (i.e. whole view is drawable - incl. margins)"
@@ -2060,15 +2096,7 @@
leaving background as-is. If the transformation involves scaling,
the fonts point-size is scaled as appropriate."
- (aString isString not or:[aString isText]) ifTrue:[
- "
- hook for non-strings (i.e. attributed text)
- that 'thing' should know how to display itself ...
- "
- ^ aString displayOn:self x:x y:y
- ].
-
- self displayString:aString from:1 to:aString size x:x y:y
+ self displayString:aString from:1 to:aString size x:x y:y opaque:false.
!
displayUnscaledForm:formToDraw x:x y:y