Added outer rectangular clipping path.
authordinu_gherman
Fri, 21 Jun 2002 10:51:58 +0000
changeset 1661 94d09f7b4c9a
parent 1660 c93476060b9d
child 1662 26a730637022
Added outer rectangular clipping path.
reportlab/graphics/renderSVG.py
--- a/reportlab/graphics/renderSVG.py	Thu Jun 20 15:05:58 2002 +0000
+++ b/reportlab/graphics/renderSVG.py	Fri Jun 21 10:51:58 2002 +0000
@@ -126,8 +126,17 @@
         self.setLineJoin(0)
         self.setLineWidth(1)
 
+        # Add a rectangular clipping path identical to view area.
+        clipPath = transformNode(self.doc, "clipPath", id="clip") 
+        clipRect = transformNode(self.doc, "rect", x=0, y=0, 
+            width=self.width, height=self.height)
+        clipPath.appendChild(clipRect)
+        self.svg.appendChild(clipPath)
+
         self.groupTree = transformNode(self.doc, "g", 
-            id="group", transform="scale(1,-1) translate(0,-%d)" % self.height)
+            id="group", 
+            transform="scale(1,-1) translate(0,-%d)" % self.height,
+            style="clip-path: url(#clip)")
         self.svg.appendChild(self.groupTree)
         self.currGroup = self.groupTree