--- a/CairoGraphicsContext.st Fri Mar 25 06:46:05 2016 +0000
+++ b/CairoGraphicsContext.st Fri Mar 25 07:06:46 2016 +0000
@@ -151,11 +151,44 @@
"set the clipping rectangle for drawing (in logical coordinates);
a nil argument turn off clipping (i.e. whole view is drawable)"
- #todo.
- ^ super clippingBounds:aRectangleOrNil
+ super clippingBounds:aRectangleOrNil.
+ cr notNil ifTrue:[
+ aRectangleOrNil isNil ifTrue:[
+ cr clipReset
+ ] ifFalse:[
+ cr rectangleX: aRectangleOrNil left
+ y: aRectangleOrNil top
+ width: aRectangleOrNil width
+ height: aRectangleOrNil height.
+ cr clip.
+ ].
+ ].
"Created: / 15-02-2016 / 21:38:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
- "Modified: / 27-02-2016 / 15:20:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 25-03-2016 / 06:58:26 / jv"
+ "Modified: / 27-03-2016 / 00:05:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+deviceClippingBounds:aRectangleOrNil
+ "set the clipping rectangle for drawing (in device coordinates);
+ a nil argument turns off clipping (i.e. whole view is drawable - incl. margins)"
+
+ super deviceClippingBounds: aRectangleOrNil.
+ self deviceCoordinatesDo:[
+ cr notNil ifTrue:[
+ aRectangleOrNil isNil ifTrue:[
+ cr clipReset
+ ] ifFalse:[
+ cr rectangleX: aRectangleOrNil left
+ y: aRectangleOrNil top
+ width: aRectangleOrNil width
+ height: aRectangleOrNil height.
+ cr clip.
+ ].
+ ].
+ ].
+
+ "Created: / 27-03-2016 / 00:09:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
function:aFunctionSymbol
@@ -912,6 +945,7 @@
cr source: paint.
cr matrixReset.
self transformation: transformation.
+ self clippingBounds: clipRect.
f := font.
font := nil.
self basicFont: f.