aboutsummaryrefslogtreecommitdiffstats
path: root/src/org/apache/fop/render/awt
diff options
context:
space:
mode:
authorKeiron Liddle <keiron@apache.org>2001-05-17 07:48:06 +0000
committerKeiron Liddle <keiron@apache.org>2001-05-17 07:48:06 +0000
commitc824ede99cb449252823876b6224f6ed75e799cd (patch)
tree771770e0d8604c5511de0249b4072817fc483736 /src/org/apache/fop/render/awt
parentf89f05c27124377ec9497b30d4d75874a2bec67b (diff)
downloadxmlgraphics-fop-c824ede99cb449252823876b6224f6ed75e799cd.tar.gz
xmlgraphics-fop-c824ede99cb449252823876b6224f6ed75e799cd.zip
FOP now uses Batik to render svg
This is handled for awt - using batik to render to a graphic and pdf. Pdf still requires better image support. The elements and properties are generated from the svgelements.xml document. The version of batik is 17/05/2001 cvs. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@194250 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/org/apache/fop/render/awt')
-rw-r--r--src/org/apache/fop/render/awt/AWTRenderer.java679
1 files changed, 155 insertions, 524 deletions
diff --git a/src/org/apache/fop/render/awt/AWTRenderer.java b/src/org/apache/fop/render/awt/AWTRenderer.java
index 2d0790baa..79dabb579 100644
--- a/src/org/apache/fop/render/awt/AWTRenderer.java
+++ b/src/org/apache/fop/render/awt/AWTRenderer.java
@@ -15,14 +15,20 @@ import org.apache.fop.messaging.MessageHandler;
import org.apache.fop.datatypes.*;
import org.apache.fop.image.*;
import org.apache.fop.svg.*;
-import org.apache.fop.dom.svg.*;
-import org.apache.fop.dom.svg.SVGArea;
import org.apache.fop.render.pdf.*;
import org.apache.fop.viewer.*;
import org.apache.fop.apps.*;
import org.w3c.dom.svg.*;
+import org.apache.batik.bridge.*;
+import org.apache.batik.swing.svg.*;
+import org.apache.batik.swing.gvt.*;
+import org.apache.batik.gvt.*;
+import org.apache.batik.gvt.renderer.*;
+import org.apache.batik.gvt.filter.*;
+import org.apache.batik.gvt.event.*;
+
import java.awt.*;
import java.awt.Image;
import java.awt.image.*;
@@ -629,8 +635,13 @@ public class AWTRenderer implements Renderer, Printable, Pageable {
Enumeration e = area.getChildren().elements();
while (e.hasMoreElements()) {
- org.apache.fop.layout.Box b =
- (org.apache.fop.layout.Box) e.nextElement();
+ org.apache.fop.layout.Box b = (org.apache.fop.layout.Box) e.nextElement();
+ if(b instanceof InlineArea) {
+ InlineArea ia = (InlineArea)b;
+ this.currentYPosition = ry - ia.getYOffset();
+ } else {
+ this.currentYPosition = ry - area.getPlacementOffset();
+ }
b.render(this);
}
@@ -662,26 +673,65 @@ public class AWTRenderer implements Renderer, Printable, Pageable {
this.currentXPosition += area.getContentWidth();
}
-
public void renderSVGArea(SVGArea area) {
- int x = this.currentAreaContainerXPosition;
+ int x = this.currentXPosition;
int y = this.currentYPosition;
int w = area.getContentWidth();
int h = area.getHeight();
- Enumeration e = area.getChildren().elements();
- while (e.hasMoreElements()) {
- Object o = e.nextElement();
- if (o instanceof GraphicImpl) {
- renderElement(area, (GraphicImpl) o, x, y, null);
- }
- }
+// this.currentYPosition -= h;
- this.currentYPosition -= h;
+ SVGDocument doc = area.getSVGDocument();
+
+ UserAgent userAgent = new MUserAgent(new AffineTransform());
+
+ GVTBuilder builder = new GVTBuilder();
+ GraphicsNodeRenderContext rc = getRenderContext();
+ BridgeContext ctx = new BridgeContext(userAgent, rc);
+ GraphicsNode root;
+ graphics.translate(x / 1000f, pageHeight - y / 1000f);
+ graphics.setRenderingHints(rc.getRenderingHints());
+ try {
+ root = builder.build(ctx, doc);
+ root.paint(graphics, rc);
+ } catch(Exception e) {
+ e.printStackTrace();
+ }
+ graphics.translate(-x / 1000f, y / 1000f - pageHeight);
+ this.currentXPosition += area.getContentWidth();
}
+ public GraphicsNodeRenderContext getRenderContext() {
+ GraphicsNodeRenderContext nodeRenderContext = null;
+ if (nodeRenderContext == null) {
+ RenderingHints hints = new RenderingHints(null);
+ hints.put(RenderingHints.KEY_ANTIALIASING,
+ RenderingHints.VALUE_ANTIALIAS_ON);
+
+ hints.put(RenderingHints.KEY_INTERPOLATION,
+ RenderingHints.VALUE_INTERPOLATION_BILINEAR);
+
+ FontRenderContext fontRenderContext =
+ new FontRenderContext(new AffineTransform(), true, true);
+
+ TextPainter textPainter = new StrokingTextPainter();
+
+ GraphicsNodeRableFactory gnrFactory =
+ new ConcreteGraphicsNodeRableFactory();
+
+ nodeRenderContext =
+ new GraphicsNodeRenderContext(new AffineTransform(),
+ null,
+ hints,
+ fontRenderContext,
+ textPainter,
+ gnrFactory);
+ }
+
+ return nodeRenderContext;
+ }
public void setProducer(String producer) {
@@ -782,540 +832,121 @@ public class AWTRenderer implements Renderer, Printable, Pageable {
}
}
+ public void renderForeignObjectArea(ForeignObjectArea area) {
+ area.getObject().render(this);
+ }
-
- public void renderElement(SVGArea svgarea, GraphicImpl area,
- int posx, int posy, Vector parentTransforms) {
- int x = posx;
- int y = posy;
- Hashtable style = area.oldgetStyle();
- DrawingInstruction di = createInstruction(area, style);
-
- Object o = null;
- Vector v = area.oldgetTransform();
- v = (v == null) ? new Vector() : v;
- Vector trans = new Vector(v);
- parentTransforms = (parentTransforms == null) ? new Vector() :
- parentTransforms;
-
- if (parentTransforms != null) {
- trans.addAll(0, parentTransforms);
+ protected class MUserAgent implements UserAgent {
+ AffineTransform currentTransform = null;
+ /**
+ * Creates a new SVGUserAgent.
+ */
+ protected MUserAgent(AffineTransform at) {
+ currentTransform = at;
}
- float red = (float) graphics.getColor().getRed();
- float green = (float) graphics.getColor().getGreen();
- float blue = (float) graphics.getColor().getBlue();
- Color c = null;
-
- ColorType ct = null;
- try {
- o = style.get("fill");
- if (o != null && o instanceof ColorType) {
- ct = (ColorType) o;
- c = new Color((int)(ct.red() * 255f),
- (int)(ct.green() * 255f), (int)(ct.blue() * 255f));
- }
- o = style.get("stroke");
- if (c == null && o != null && o instanceof ColorType) {
- ct = (ColorType) o;
- c = new Color((int)(ct.red() * 255f),
- (int)(ct.green() * 255f), (int)(ct.blue() * 255f));
- }
- } catch (Exception ex) {
- MessageHandler.errorln("Can't set color: R G B : " +
- (int)(ct.red() * 255f) + " " +
- (int)(ct.green() * 255f) + " " +
- (int)(ct.blue() * 255f));
- c = Color.pink;
+ /**
+ * Displays an error message.
+ */
+ public void displayError(String message) {
+ System.err.println(message);
}
-
- if (c == null) {
- c = new Color((int) red, (int) green, (int) blue);
+
+ /**
+ * Displays an error resulting from the specified Exception.
+ */
+ public void displayError(Exception ex) {
+ ex.printStackTrace(System.err);
}
- Color oldColor = graphics.getColor();
- if (area instanceof SVGLineElement) {
- graphics.setColor(c);
- SVGLineElementImpl lg = (SVGLineElementImpl) area;
-
- float x1 = lg.getX1().getBaseVal().getValue() * 1000 + posx;
- float y1 = posy - lg.getY1().getBaseVal().getValue() * 1000 ;
- float x2 = lg.getX2().getBaseVal().getValue() * 1000 + posx;
- float y2 = posy - lg.getY2().getBaseVal().getValue() * 1000;
- // TODO:
- // The thickness of contour protect.
- int th = 1;
- o = style.get("stroke-width");
- if (o != null)
- th = (int)((SVGLengthImpl) o).getValue();
- Line2D.Double aLine = new Line2D.Double(x1 / 1000f,
- pageHeight - y1 / 1000f, x2 / 1000f,
- pageHeight - y2 / 1000f);
- drawShape(transformShape(trans, aLine), di);
- graphics.setColor(oldColor);
- } else if (area instanceof SVGRectElement) {
- graphics.setColor(c);
- SVGRectElement rg = (SVGRectElement) area;
- float rectx = rg.getX().getBaseVal().getValue() * 1000 + posx;
- float recty = posy - rg.getY().getBaseVal().getValue() * 1000;
- float rx = rg.getRx().getBaseVal().getValue() * 1000;
- float ry = rg.getRy().getBaseVal().getValue() * 1000;
- float rw = rg.getWidth().getBaseVal().getValue() * 1000;
- float rh = rg.getHeight().getBaseVal().getValue() * 1000;
-
- // TODO:
- // rx and ry are roundings.
- // RoundRectangle2D.Double
- Rectangle aRectangle = new Rectangle();
- aRectangle.setRect(rectx / 1000d,
- pageHeight - recty / 1000d, rw / 1000d, rh / 1000d);
- drawShape(transformShape(trans, aRectangle), di);
- graphics.setColor(oldColor);
- } else if (area instanceof SVGCircleElement) {
- graphics.setColor(c);
- SVGCircleElement cg = (SVGCircleElement) area;
- float cx = cg.getCx().getBaseVal().getValue() * 1000 + posx;
- float cy = posy - cg.getCy().getBaseVal().getValue() * 1000;
- float r = cg.getR().getBaseVal().getValue();
- Ellipse2D.Double anEllipse =
- new Ellipse2D.Double(cx / 1000d - r,
- pageHeight - cy / 1000d - r, r * 2d, r * 2d);
- drawShape(transformShape(trans, anEllipse), di);
- graphics.setColor(oldColor);
- } else if (area instanceof SVGEllipseElement) {
- graphics.setColor(c);
- SVGEllipseElement cg = (SVGEllipseElement) area;
- float cx = cg.getCx().getBaseVal().getValue() * 1000 + posx;
- float cy = posy - cg.getCy().getBaseVal().getValue() * 1000;
- float rx = cg.getRx().getBaseVal().getValue();
- float ry = cg.getRy().getBaseVal().getValue();
- Ellipse2D.Double anEllipse =
- new Ellipse2D.Double(cx / 1000d - rx,
- pageHeight - cy / 1000d - ry, rx * 2d, ry * 2d);
- drawShape(transformShape(trans, anEllipse), di);
- graphics.setColor(oldColor);
- } else if (area instanceof SVGImageElementImpl) {
- SVGImageElementImpl ig = (SVGImageElementImpl) area;
- renderImage(ig.link, ig.x + posx / 1000f,
- pageHeight - (posy / 1000f - ig.y), ig.width,
- ig.height, trans);
- } else if (area instanceof SVGUseElementImpl) {
- SVGUseElementImpl ug = (SVGUseElementImpl) area;
- String ref = ug.link;
- ref = ref.substring(1, ref.length());
- GraphicImpl graph = null;
- // graph = area.locateDef(ref);
- if (graph != null) {
- // probably not the best way to do this, should be able
- // to render without the style being set.
- // GraphicImpl parent = graph.getGraphicParent();
- // graph.setParent(area);
- // need to clip (if necessary) to the use area
- // the style of the linked element is as if is was
- // a direct descendant of the use element.
-
- renderElement(svgarea, graph, posx, posy, trans);
- // graph.setParent(parent);
- }
- } else if (area instanceof SVGPolylineElementImpl) {
- graphics.setColor(c);
- Vector points = ((SVGPolylineElementImpl) area).points;
- PathPoint p = null;
- Point2D.Double p1 = null;
- Point2D.Double p2 = null;
- if (points.size() > 0) {
- p = (PathPoint) points.elementAt(0);
- double xc = p.x * 1000f + posx;
- double yc = posy - p.y * 1000f;
- p1 = new Point2D.Double(xc / 1000f,
- pageHeight - yc / 1000f);
-
- int[] xarr = {(int) xc};
- int[] yarr = {(int) yc};
- graphics.drawPolyline(xarr, yarr, 1);
- }
- Line2D.Double aLine;
- for (int i = 1; i < points.size(); i++) {
- p = (PathPoint) points.elementAt(i);
- p2 = new Point2D.Double(p.x + posx / 1000f,
- pageHeight - (posy - p.y * 1000f) / 1000f);
- aLine = new Line2D.Double(p1, p2);
- graphics.draw(transformShape(trans, aLine));
- p1 = p2;
- }
- graphics.setColor(oldColor);
- } else if (area instanceof SVGPolygonElementImpl) {
- graphics.setColor(c);
- java.awt.Polygon aPolygon =
- convertPolygon(((SVGPolygonElementImpl) area),
- posx, posy);
- drawShape(transformShape(trans, aPolygon), di);
- graphics.setColor(oldColor);
- } else if (area instanceof SVGGElementImpl) {
- renderGArea(svgarea, (SVGGElementImpl) area, x, y,
- parentTransforms);
- } else if (area instanceof SVGPathElementImpl) {
- graphics.setColor(c);
- GeneralPath path =
- convertPath((SVGPathElementImpl) area, posx, posy);
- drawShape(transformShape(trans, path), di);
- graphics.setColor(oldColor);
- } else if (area instanceof SVGTextElementImpl) {
- MessageHandler.errorln("SVGTextElementImpl is not implemented yet.");
- // renderText(svgarea, (SVGTextElementImpl)area, 0, 0, di);
- } else if (area instanceof SVGArea) {
- // the x and y pos will be wrong!
- Enumeration e = ((SVGArea) area).getChildren().elements();
- while (e.hasMoreElements()) {
- Object el = e.nextElement();
- if (o instanceof GraphicImpl) {
- renderElement((SVGArea) area, (GraphicImpl) el, x,
- y, parentTransforms);
- }
- }
+ /**
+ * Displays a message in the User Agent interface.
+ * The given message is typically displayed in a status bar.
+ */
+ public void displayMessage(String message) {
+ System.out.println(message);
}
- // should be done with some cleanup code, so only
- // required values are reset.
- } // renderElement
-
-
- public void renderGArea(SVGArea svgarea, SVGGElementImpl area,
- int posx, int posy, Vector v) {
+ /**
+ * Returns a customized the pixel to mm factor.
+ */
+ public float getPixelToMM() {
+ return 0.264583333333333333333f; // 72 dpi
+ }
+ /**
+ * Returns the language settings.
+ */
+ public String getLanguages() {
+ return "en";//userLanguages;
+ }
- Vector trans = null;
- // trans = new Vector(area.oldgetTransform());
- // trans.addAll(0, v);
- /* Enumeration e = area.getChildren().elements();
- while (e.hasMoreElements()) {
- Object o = e.nextElement();
- if(o instanceof GraphicImpl) {
- renderElement(svgarea, (GraphicImpl)o, posx, posy, trans);
- }
- }*/
- }
- public void renderGArea(SVGArea svgarea, SVGGElementImpl area,
- int posx, int posy) {
- renderGArea(svgarea, area, posx, posy, new Vector());
- }
+ /**
+ * Returns the user stylesheet uri.
+ * @return null if no user style sheet was specified.
+ */
+ public String getUserStyleSheetURI() {
+ return null;//userStyleSheetURI;
+ }
+ /**
+ * Returns the class name of the XML parser.
+ */
+ public String getXMLParserClassName() {
+ String parserClassName =
+ System.getProperty("org.xml.sax.parser");
+ if (parserClassName == null) {
+ parserClassName = "org.apache.xerces.parsers.SAXParser";
+ }
+ return parserClassName;//application.getXMLParserClassName();
+ }
- /**
- * Applies SVGTransform to the shape and gets the transformed shape.
- * The type of the new shape may be different to the original type.
- */
- public Shape transformShape(Vector trans, Shape shape) {
- if (trans == null || trans.size() == 0) {
- return shape;
+ /**
+ * Opens a link in a new component.
+ * @param doc The current document.
+ * @param uri The document URI.
+ */
+ public void openLink(SVGAElement elt)
+ {
+ //application.openLink(uri);
}
- AffineTransform at;
- for (int i = trans.size() - 1; i >= 0; i--) {
- org.w3c.dom.svg.SVGTransform t =
- (org.w3c.dom.svg.SVGTransform) trans.elementAt(i);
- SVGMatrix matrix = t.getMatrix();
- at = new AffineTransform(matrix.getA(), matrix.getB(),
- matrix.getC(), matrix.getD(), matrix.getE(),
- matrix.getF());
- shape = at.createTransformedShape(shape);
+ public Point getClientAreaLocationOnScreen()
+ {
+ return new Point(0, 0);
}
- return shape;
- }
+ public void setSVGCursor(java.awt.Cursor cursor)
+ {
+ }
- /**
- * Mapps a SVG-Polygon to a AWT-Polygon.
- */
- public java.awt.Polygon convertPolygon(SVGPolygonElementImpl svgpl,
- int x, int y) {
- java.awt.Polygon aPolygon = new java.awt.Polygon();
- Vector points = svgpl.points;
-
- PathPoint p;
- for (int i = 0; i < points.size(); i++) {
- p = (PathPoint) points.elementAt(i);
- aPolygon.addPoint((int)(x / 1000f + p.x),
- pageHeight - (int)(y / 1000f - p.y));
+ public AffineTransform getTransform()
+ {
+ return currentTransform;
}
- return aPolygon;
- }
+ public Dimension2D getViewportSize()
+ {
+ return new Dimension(100, 100);
+ }
- // TODO: other attributes of DrawingInstruction protect too.
- protected DrawingInstruction createInstruction(GraphicImpl area,
- Hashtable style) {
- DrawingInstruction di = new DrawingInstruction();
- Object sp;
- sp = style.get("fill");
- if (sp != null && !(sp instanceof String && sp.equals("none"))) {
- di.fill = true;
+ public EventDispatcher getEventDispatcher()
+ {
+ return null;
}
- // ...
- return di;
- }
- // Draws a shape.
- // TODO: other attributes of DrawingInstruction protect too.
- protected void drawShape(Shape s, DrawingInstruction di) {
- if (di.fill) {
- graphics.fill(s);
- } else {
- graphics.draw(s);
+ public boolean supportExtension(String str)
+ {
+ return false;
}
- }
- /**
- * Mapps a SVG-Path to a AWT-GeneralPath.
- */
- public GeneralPath convertPath(SVGPathElementImpl svgpath, float x,
- float y) {
- Vector points = svgpath.pathElements;
- GeneralPath path = new GeneralPath();
-
- float lastx = 0;
- float lasty = 0;
- SVGPathSegImpl pathmoveto = null;
-
- for (Enumeration e = points.elements(); e.hasMoreElements();) {
- SVGPathSegImpl pc = (SVGPathSegImpl) e.nextElement();
- float[] vals = pc.getValues();
- float lastcx = 0;
- float lastcy = 0;
- switch (pc.getPathSegType()) {
- case SVGPathSeg.PATHSEG_MOVETO_ABS:
- lastx = vals[0];
- lasty = vals[1];
- pathmoveto = pc;
- path.moveTo(lastx + x / 1000f,
- pageHeight - y / 1000f + lasty);
- break;
- case SVGPathSeg.PATHSEG_MOVETO_REL:
- if (pathmoveto == null) {
- lastx = vals[0];
- lasty = vals[1];
- path.moveTo(lastx + x / 1000f,
- pageHeight - y / 1000f + lasty);
- pathmoveto = pc;
- } else {
- lastx += vals[0];
- lasty += vals[1];
- path.lineTo(lastx + x / 1000f,
- pageHeight - y / 1000f + lasty);
-
- }
- break;
- case SVGPathSeg.PATHSEG_LINETO_ABS:
- lastx = vals[0];
- lasty = vals[1];
- path.lineTo(lastx + x / 1000f,
- pageHeight - y / 1000f + lasty);
- break;
- case SVGPathSeg.PATHSEG_LINETO_REL:
- lastx += vals[0];
- lasty += vals[1];
- path.lineTo(lastx + x / 1000f,
- pageHeight - y / 1000f + lasty);
- break;
- case SVGPathSeg.PATHSEG_LINETO_VERTICAL_ABS:
- lasty = vals[0];
- path.lineTo(lastx + x / 1000f,
- pageHeight - y / 1000f + lasty);
- break;
- case SVGPathSeg.PATHSEG_LINETO_VERTICAL_REL:
- lasty += vals[0];
- path.lineTo(lastx + x / 1000f,
- pageHeight - y / 1000f + lasty);
- break;
- case SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_ABS:
- lastx = vals[0];
- path.lineTo(lastx + x / 1000f,
- pageHeight - y / 1000f + lasty);
- break;
- case SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_REL:
- lastx += vals[0];
- path.lineTo(lastx + x / 1000f,
- pageHeight - y / 1000f + lasty);
- break;
- case SVGPathSeg.PATHSEG_CURVETO_CUBIC_ABS:
- lastx = vals[4];
- lasty = vals[5];
- lastcx = vals[2];
- lastcy = vals[3];
- path.curveTo(x / 1000f + vals[0],
- pageHeight - y / 1000f + vals[1],
- x / 1000f + lastcx,
- pageHeight - y / 1000f + lastcy,
- x / 1000f + lastx,
- pageHeight - y / 1000f + lasty);
- break;
- case SVGPathSeg.PATHSEG_CURVETO_CUBIC_REL:
- path.curveTo(x / 1000f + vals[0] + lastx,
- pageHeight - y / 1000f + vals[1] + lasty,
- x / 1000f + lastx + vals[2],
- pageHeight - y / 1000f + lasty + vals[3],
- x / 1000f + lastx + vals[4],
- pageHeight - y / 1000f + lasty + vals[5]);
- lastcx = vals[2] + lastx;
- lastcy = vals[3] + lasty;
- lastx += vals[4];
- lasty += vals[5];
- break;
- case SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_ABS:
- if (lastcx == 0)
- lastcx = lastx;
- if (lastcy == 0)
- lastcy = lasty;
- lastx = vals[2];
- lasty = vals[3];
- path.curveTo(x / 1000f + lastcx,
- pageHeight - y / 1000f + lastcy,
- x / 1000f + vals[0],
- pageHeight - y / 1000f + vals[1],
- x / 1000f + lastx,
- pageHeight - y / 1000f + lasty);
- break;
- case SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_REL:
- if (lastcx == 0)
- lastcx = lastx;
- if (lastcy == 0)
- lastcy = lasty;
- path.curveTo(x / 1000f + lastcx,
- pageHeight - y / 1000f + lastcy,
- x / 1000f + lastx + vals[0],
- pageHeight - y / 1000f + lasty + vals[1],
- x / 1000f + lastx + vals[2],
- pageHeight - y / 1000f + lasty + vals[3]);
- lastx += vals[2];
- lasty += vals[3];
- break;
- case SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_ABS:
- if (lastcx == 0)
- lastcx = lastx;
- if (lastcy == 0)
- lastcy = lasty;
- lastx = vals[0];
- lasty = vals[1];
- lastcx = 0;
- lastcy = 0;
- path.quadTo(x / 1000f + lastcx,
- pageHeight - y / 1000f + lastcy,
- x / 1000f + lastx,
- pageHeight - y / 1000f + lasty);
- break;
- case SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_REL:
- if (lastcx == 0)
- lastcx = lastx;
- if (lastcy == 0)
- lastcy = lasty;
-
- path.quadTo(x / 1000f + lastcx ,
- pageHeight - y / 1000f + lastcy,
- x / 1000f + lastx + vals[0],
- pageHeight - y / 1000f + lasty + vals[1]);
-
- lastx += vals[0];
- lasty += vals[1];
- lastcx = 0;
- lastcy = 0;
- break;
- case SVGPathSeg.PATHSEG_ARC_ABS:
- {
- // Arc2D.Double arc = new Arc2D.Double();
- // arc.setAngles(current point, end point); ....
- double rx = vals[0];
- double ry = vals[1];
- double theta = vals[2];
- boolean largearcflag = (vals[3] == 1.0);
- boolean sweepflag = (vals[4] == 1.0);
-
- double cx = lastx;
- double cy = lasty;
-
- path.curveTo(x / 1000f + lastx,
- pageHeight - y / 1000f + lasty,
- x / 1000f + vals[0],
- pageHeight - y / 1000f + vals[1],
- x / 1000f + vals[5],
- pageHeight - y / 1000f + vals[6]);
-
- lastcx = 0; //??
- lastcy = 0; //??
- lastx = vals[5];
- lasty = vals[6];
- }
- break;
- case SVGPathSeg.PATHSEG_ARC_REL:
- {
- double rx = vals[0];
- double ry = vals[1];
- double theta = vals[2];
- boolean largearcflag = (vals[3] == 1.0);
- boolean sweepflag = (vals[4] == 1.0);
-
- path.curveTo(x / 1000f + lastx,
- pageHeight - y / 1000f + lasty,
- x / 1000f + (vals[0] + lastx),
- pageHeight - y / 1000f + (vals[1] + lasty),
- x / 1000f + (vals[5] + lastx),
- pageHeight - y / 1000f + (vals[6] + lasty));
- lastcx = 0; //??
- lastcy = 0; //??
- lastx += vals[5];
- lasty += vals[6];
- }
- break;
- case SVGPathSeg.PATHSEG_CLOSEPATH:
- path.closePath();
- break;
-
-
- } // switch
- } // for points.elements()
-
- return path;
- } // convertPath
- /*
- if(di == null) {
- currentStream.add("S\n");
- } else {
- if(di.fill) {
- if(di.stroke) {
- if(!di.nonzero)
- currentStream.add("B*\n");
- else
- currentStream.add("B\n");
- } else {
- if(!di.nonzero)
- currentStream.add("f*\n");
- else
- currentStream.add("f\n");
- }
- } else {
- // if(di.stroke)
- currentStream.add("S\n");
- }
- }
- */
-
- /*
- * by pdfrenderer übernommen.
- *
- */
- class DrawingInstruction {
- boolean stroke = false;
- boolean nonzero = false; // non-zero fill rule "f*", "B*" operator
- boolean fill = false;
- int linecap = 0; // butt
- int linejoin = 0; // miter
- int miterwidth = 8;
- }
+ public boolean hasFeature(String str)
+ {
+ return false;
+ }
- public void renderForeignObjectArea(ForeignObjectArea area) {
- area.getObject().render(this);
+ public void registerExtension(BridgeExtension be)
+ {
+ }
}
-
}
-
-
-