aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAdrian Cumiskey <acumiskey@apache.org>2008-11-04 17:40:36 +0000
committerAdrian Cumiskey <acumiskey@apache.org>2008-11-04 17:40:36 +0000
commitb8f51d3e86bcb3c4f4865f1c8e31ec72d7dcc08f (patch)
treee2d26e6724c4bd27911a4f27c0b061cddf2d6a59 /src
parente232c7f439bcc945effc092b1d779a2ffc7fdae0 (diff)
downloadxmlgraphics-fop-b8f51d3e86bcb3c4f4865f1c8e31ec72d7dcc08f.tar.gz
xmlgraphics-fop-b8f51d3e86bcb3c4f4865f1c8e31ec72d7dcc08f.zip
Forgot to add.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_AFPGOCAResources@711324 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src')
-rw-r--r--src/java/org/apache/fop/render/AbstractGraphics2DImagePainter.java55
1 files changed, 55 insertions, 0 deletions
diff --git a/src/java/org/apache/fop/render/AbstractGraphics2DImagePainter.java b/src/java/org/apache/fop/render/AbstractGraphics2DImagePainter.java
new file mode 100644
index 000000000..4a3c7d954
--- /dev/null
+++ b/src/java/org/apache/fop/render/AbstractGraphics2DImagePainter.java
@@ -0,0 +1,55 @@
+package org.apache.fop.render;
+
+import java.awt.Graphics2D;
+import java.awt.geom.Rectangle2D;
+
+import org.apache.batik.gvt.GraphicsNode;
+import org.apache.xmlgraphics.java2d.Graphics2DPainterPreparator;
+
+/**
+ * An initializable graphics 2D image painter
+ */
+public abstract class AbstractGraphics2DImagePainter
+ implements org.apache.xmlgraphics.java2d.Graphics2DImagePainter {
+
+ private final GraphicsNode root;
+
+ protected Graphics2DPainterPreparator preparator;
+
+ /**
+ * Main constructor
+ *
+ * @param root a graphics node root
+ */
+ public AbstractGraphics2DImagePainter(GraphicsNode root) {
+ this.root = root;
+ }
+
+ /**
+ * Sets the graphics 2D painter preparator
+ *
+ * @param initializer the graphics 2D preparator
+ */
+ public void setPreparator(Graphics2DPainterPreparator preparator) {
+ this.preparator = preparator;
+ }
+
+ /**
+ * Returns the graphics 2D painter preparator
+ *
+ * @return the graphics 2D painter preparator
+ */
+ protected Graphics2DPainterPreparator getPreparator() {
+ return this.preparator;
+ }
+
+ /** {@inheritDoc} */
+ public void paint(Graphics2D g2d, Rectangle2D area) {
+ Graphics2DPainterPreparator preparator = getPreparator();
+ if (preparator != null) {
+ preparator.prepare(g2d, area);
+ }
+ root.paint(g2d);
+ }
+
+}