You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by ke...@apache.org on 2001/03/01 03:20:40 UTC
cvs commit: xml-fop/src/org/apache/fop/render/xml XMLRenderer.java
keiron 01/02/28 18:20:40
Modified: src/org/apache/fop/fo Tag: fop-0_17_0_batikSVG
SVGTreeBuilder.java
src/org/apache/fop/render Tag: fop-0_17_0_batikSVG
Renderer.java
src/org/apache/fop/render/awt Tag: fop-0_17_0_batikSVG
AWTRenderer.java
src/org/apache/fop/render/mif Tag: fop-0_17_0_batikSVG
MIFRenderer.java
src/org/apache/fop/render/pdf Tag: fop-0_17_0_batikSVG
PDFRenderer.java SVGRenderer.java
src/org/apache/fop/render/xml Tag: fop-0_17_0_batikSVG
XMLRenderer.java
Log:
changes for batik
Revision Changes Path
No revision
No revision
1.3.2.1 +5 -4 xml-fop/src/org/apache/fop/fo/SVGTreeBuilder.java
Index: SVGTreeBuilder.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/SVGTreeBuilder.java,v
retrieving revision 1.3
retrieving revision 1.3.2.1
diff -u -r1.3 -r1.3.2.1
--- SVGTreeBuilder.java 2000/11/10 22:04:44 1.3
+++ SVGTreeBuilder.java 2001/03/01 02:20:38 1.3.2.1
@@ -1,4 +1,4 @@
-/*-- $Id: SVGTreeBuilder.java,v 1.3 2000/11/10 22:04:44 klease Exp $ --
+/*-- $Id: SVGTreeBuilder.java,v 1.3.2.1 2001/03/01 02:20:38 keiron Exp $ --
============================================================================
The Apache Software License, Version 1.1
@@ -52,7 +52,7 @@
// FOP
import org.apache.fop.fo.*;
-import org.apache.fop.dom.svg.*;
+import org.apache.fop.svg.*;
import org.apache.fop.layout.AreaTree;
import org.apache.fop.messaging.MessageHandler;
import org.apache.fop.apps.FOPException;
@@ -297,9 +297,10 @@
*/
public SVGDocument getSVGDocument()
{
- SVGDocumentImpl doc = new SVGDocumentImpl();
+ SVGDocument doc = null;
+/* doc = new SVGDocumentImpl();
SVGSVGElement svg = (SVGSVGElement)((org.apache.fop.svg.SVG)rootFObj).createGraphic();
- doc.appendChild(svg);
+ doc.appendChild(svg);*/
return doc;
}
}
No revision
No revision
1.13.2.1 +2 -2 xml-fop/src/org/apache/fop/render/Renderer.java
Index: Renderer.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/render/Renderer.java,v
retrieving revision 1.13
retrieving revision 1.13.2.1
diff -u -r1.13 -r1.13.2.1
--- Renderer.java 2001/01/24 00:31:31 1.13
+++ Renderer.java 2001/03/01 02:20:39 1.13.2.1
@@ -1,4 +1,4 @@
-/*-- $Id: Renderer.java,v 1.13 2001/01/24 00:31:31 keiron Exp $ --
+/*-- $Id: Renderer.java,v 1.13.2.1 2001/03/01 02:20:39 keiron Exp $ --
============================================================================
The Apache Software License, Version 1.1
@@ -51,7 +51,7 @@
package org.apache.fop.render;
// FOP
-import org.apache.fop.dom.svg.SVGArea;
+import org.apache.fop.svg.SVGArea;
import org.apache.fop.image.ImageArea;
import org.apache.fop.apps.FOPException;
import org.apache.fop.layout.*;
No revision
No revision
1.18.2.1 +0 -539 xml-fop/src/org/apache/fop/render/awt/AWTRenderer.java
Index: AWTRenderer.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/render/awt/AWTRenderer.java,v
retrieving revision 1.18
retrieving revision 1.18.2.1
diff -u -r1.18 -r1.18.2.1
--- AWTRenderer.java 2001/01/24 00:31:36 1.18
+++ AWTRenderer.java 2001/03/01 02:20:39 1.18.2.1
@@ -15,8 +15,6 @@
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.*;
@@ -670,14 +668,6 @@
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;
}
@@ -780,535 +770,6 @@
MessageHandler.errorln("AWTRenderer: renderImage(): " +
ex.getMessage());
}
- }
-
-
-
- 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);
- }
-
- 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;
- }
-
- if (c == null) {
- c = new Color((int) red, (int) green, (int) blue);
- }
- 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);
- }
- }
- }
-
- // 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) {
-
-
- 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());
- }
-
-
- /**
- * 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;
- }
-
- 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);
- }
- return shape;
- }
-
-
- /**
- * 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));
- }
-
- return aPolygon;
- }
-
- // 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;
- }
- // ...
- 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);
- }
- }
-
- /**
- * 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 void renderForeignObjectArea(ForeignObjectArea area) {
No revision
No revision
1.1.2.1 +536 -541 xml-fop/src/org/apache/fop/render/mif/MIFRenderer.java
Index: MIFRenderer.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/render/mif/MIFRenderer.java,v
retrieving revision 1.1
retrieving revision 1.1.2.1
diff -u -r1.1 -r1.1.2.1
--- MIFRenderer.java 2001/02/10 03:25:29 1.1
+++ MIFRenderer.java 2001/03/01 02:20:39 1.1.2.1
@@ -1,541 +1,536 @@
-/*-- $Id: MIFRenderer.java,v 1.1 2001/02/10 03:25:29 arved Exp $ --
-
- ============================================================================
- The Apache Software License, Version 1.1
- ============================================================================
-
- Copyright (C) 1999 The Apache Software Foundation. All rights reserved.
-
- Redistribution and use in source and binary forms, with or without modifica-
- tion, are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-
- 3. The end-user documentation included with the redistribution, if any, must
- include the following acknowledgment: "This product includes software
- developed by the Apache Software Foundation (http://www.apache.org/)."
- Alternately, this acknowledgment may appear in the software itself, if
- and wherever such third-party acknowledgments normally appear.
-
- 4. The names "FOP" and "Apache Software Foundation" must not be used to
- endorse or promote products derived from this software without prior
- written permission. For written permission, please contact
- apache@apache.org.
-
- 5. Products derived from this software may not be called "Apache", nor may
- "Apache" appear in their name, without prior written permission of the
- Apache Software Foundation.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
- FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
- DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- This software consists of voluntary contributions made by many individuals
- on behalf of the Apache Software Foundation and was originally created by
- James Tauber <jt...@jtauber.com>. For more information on the Apache
- Software Foundation, please see <http://www.apache.org/>.
-
- */
-
-// Author : Seshadri G
-
-
-
-
-package org.apache.fop.render.mif;
-
-// FOP
-import org.apache.fop.render.Renderer;
-import org.apache.fop.messaging.MessageHandler;
-import org.apache.fop.image.ImageArea;
-import org.apache.fop.image.FopImage;
-import org.apache.fop.apps.FOPException;
-import org.apache.fop.fo.properties.*;
-import org.apache.fop.fo.*;
-import org.apache.fop.layout.*;
-import org.apache.fop.layout.inline.*;
-import org.apache.fop.datatypes.*;
-import org.apache.fop.svg.PathPoint;
-import org.apache.fop.mif.*;
-import org.apache.fop.layout.*;
-import org.apache.fop.image.*;
-
-import org.w3c.dom.*;
-import org.w3c.dom.svg.*;
-import org.w3c.dom.css.*;
-import org.w3c.dom.svg.SVGLength;
-
-import org.apache.fop.dom.svg.*;
-import org.apache.fop.dom.svg.SVGRectElementImpl;
-import org.apache.fop.dom.svg.SVGTextElementImpl;
-import org.apache.fop.dom.svg.SVGLineElementImpl;
-import org.apache.fop.dom.svg.SVGArea;
-
-// Java
-import java.io.IOException;
-import java.io.OutputStream;
-import java.util.Enumeration;
-import java.awt.Rectangle;
-import java.util.Vector;
-import java.util.Hashtable;
-/**
- * Renderer that renders areas to MIF
- */
-public class MIFRenderer implements Renderer {
-
- private String currentFontName;
- private String currentFontSize;
- private int pageHeight;
- private int pageWidth;
-
- /** the current vertical position in millipoints from bottom */
- protected int currentYPosition = 0;
-
- /** the current horizontal position in millipoints from left */
- protected int currentXPosition = 0;
-
- /** the horizontal position of the current area container */
- private int currentAreaContainerXPosition = 0;
-
-
- /** the MIF Document being created */
- protected MIFDocument mifDoc;
-
-
- /* is a table currently open? */
- private boolean inTable=false;
-
-
-
- /**
- * create the MIF renderer
- */
- public MIFRenderer() {
- this.mifDoc = new MIFDocument();
- }
-
-
- /**
- * render the areas into MIF
- *
- * @param areaTree the laid-out area tree
- * @param writer the PrintWriter to write the MIF with
- */
-
- public void render(AreaTree areaTree,
- OutputStream stream) throws IOException, FOPException {
-
- MessageHandler.logln("rendering areas to MIF");
- // idReferences=areaTree.getIDReferences();
- //this.pdfResources = this.pdfDoc.getResources();
- //this.pdfDoc.setIDReferences(idReferences);
- Enumeration e = areaTree.getPages().elements();
- while (e.hasMoreElements()) {
- this.renderPage((Page) e.nextElement());
- }
-
-
- // MessageHandler.logln("writing out MIF");
-
- this.mifDoc.output(stream);
- stream.close();
- }
-
-
-
-
- /** set up the given FontInfo */
- public void setupFontInfo(FontInfo fontInfo) {
-
- FontSetup.setup(fontInfo);
- //FontSetup.addToFontFormat(this.mifDoc, fontInfo);
-
-
- }
-
- /** set the producer of the rendering */
- public void setProducer(String producer) {}
-
-
- public void renderAreaContainer(AreaContainer area) {
-
- if (area.foCreator != null && area.foCreator.getName() == "fo:table") {
-
- this.mifDoc.createTable();
- this.inTable=true;
- }
- else
- if (area.foCreator != null && area.foCreator.getName() == "fo:table-body") {
-
- this.mifDoc.setCurrent("fo:table-body");
- }
- else
- if (area.foCreator != null && area.foCreator.getName() == "fo:table-column") {
-
- int colWidth=((org.apache.fop.fo.flow.TableColumn) area.foCreator).getColumnWidth();
- this.mifDoc.setColumnProp(colWidth);
- }
- else
- if (area.foCreator != null && area.foCreator.getName() == "fo:table-row") {
-
- this.mifDoc.startRow();
- }
- else
- if (area.foCreator != null && area.foCreator.getName() == "fo:table-cell") {
-
- int rowSpan=((org.apache.fop.fo.flow.TableCell) area.foCreator).getNumRowsSpanned();
- int colSpan=((org.apache.fop.fo.flow.TableCell) area.foCreator).getNumColumnsSpanned();
- this.mifDoc.startCell(rowSpan,colSpan);
- }
- else
- if (inTable) {
-
- inTable=false;
- this.mifDoc.endTable();
-
- }
- int saveY = this.currentYPosition;
- int saveX = this.currentAreaContainerXPosition;
-
- if (area.getPosition() == Position.ABSOLUTE) {
- // Y position is computed assuming positive Y axis, adjust for negative postscript one
- this.currentYPosition =area.getYPosition() - 2 * area.getPaddingTop() - 2 * area.borderWidthTop;
-
- this.currentAreaContainerXPosition = area.getXPosition();
- } else if (area.getPosition() == Position.RELATIVE) {
-
- this.currentYPosition -= area.getYPosition();
- this.currentAreaContainerXPosition += area.getXPosition();
-
- } else if (area.getPosition() == Position.STATIC) {
-
- this.currentYPosition -=
- area.getPaddingTop() + area.borderWidthTop;
- this.currentAreaContainerXPosition +=area.getPaddingLeft() + area.borderWidthLeft;
- }
-
- this.currentXPosition = this.currentAreaContainerXPosition;
- doFrame(area);
-
- Enumeration e = area.getChildren().elements();
- while (e.hasMoreElements()) {
- Box b = (Box) e.nextElement();
- b.render(this);
- }
- if (area.getPosition() != Position.STATIC) {
- this.currentYPosition = saveY;
- this.currentAreaContainerXPosition = saveX;
- } else
- this.currentYPosition -= area.getHeight();
- }
-
- public void renderBodyAreaContainer(BodyAreaContainer area) {
-
-
- int saveY = this.currentYPosition;
- int saveX = this.currentAreaContainerXPosition;
-
- if (area.getPosition() == Position.ABSOLUTE) {
- // Y position is computed assuming positive Y axis, adjust for negative postscript one
- this.currentYPosition = area.getYPosition();
- this.currentAreaContainerXPosition = area.getXPosition();
- } else if (area.getPosition() == Position.RELATIVE) {
- this.currentYPosition -= area.getYPosition();
- this.currentAreaContainerXPosition += area.getXPosition();
- }
-
- this.currentXPosition = this.currentAreaContainerXPosition;
- int w, h;
- int rx = this.currentAreaContainerXPosition;
- w = area.getContentWidth();
- h = area.getContentHeight();
- int ry = this.currentYPosition;
- ColorType bg = area.getBackgroundColor();
-
- /*
-
- // I'm not sure I should have to check for bg being null
- // but I do
- if ((bg != null) && (bg.alpha() == 0)) {
- this.addRect(rx, ry, w, -h, new PDFColor(bg), new PDFColor(bg));
- }
-
- */
- /*
-
- // floats & footnotes stuff
- renderAreaContainer(area.getBeforeFloatReferenceArea());
- renderAreaContainer(area.getFootnoteReferenceArea());
-
- */
- // main reference area
- Enumeration e = area.getMainReferenceArea().getChildren().elements();
- while (e.hasMoreElements()) {
- Box b = (Box) e.nextElement();
- b.render(this); // span areas
- }
-
- if (area.getPosition() != Position.STATIC) {
- this.currentYPosition = saveY;
- this.currentAreaContainerXPosition = saveX;
- } else
- this.currentYPosition -= area.getHeight();
-
- }
-
-
- private void doFrame(Area area) {
- int w, h;
- int rx = this.currentAreaContainerXPosition;
- w = area.getContentWidth();
-
- if (area instanceof BlockArea)
- rx += ((BlockArea)area).getStartIndent();
-
- h = area.getContentHeight();
- int ry = this.currentYPosition;
- ColorType bg = area.getBackgroundColor();
-
- rx = rx - area.getPaddingLeft();
- ry = ry + area.getPaddingTop();
- w = w + area.getPaddingLeft() + area.getPaddingRight();
- h = h + area.getPaddingTop() + area.getPaddingBottom();
-
- /*
- // I'm not sure I should have to check for bg being null
- // but I do
- if ((bg != null) && (bg.alpha() == 0)) {
- this.addRect(rx, ry, w, -h,
- new PDFColor(bg),
- new PDFColor(bg));
- }
-
- */
-
- rx = rx - area.borderWidthLeft;
- ry = ry + area.borderWidthTop;
- w = w + area.borderWidthLeft + area.borderWidthRight;
- h = h + area.borderWidthTop + area.borderWidthBottom;
-
- //Create a textrect with these dimensions.
- //The y co-ordinate is measured +ve downwards so subtract page-height
-
- this.mifDoc.setTextRectProp(rx,pageHeight-ry,w,h);
-
-
- /*
-
- if (area.borderWidthTop != 0)
- addLine(rx, ry, rx + w, ry,
- area.borderWidthTop,
- new PDFColor(area.borderColorTop));
- if (area.borderWidthLeft != 0)
- addLine(rx, ry, rx, ry - h,
- area.borderWidthLeft,
- new PDFColor(area.borderColorLeft));
- if (area.borderWidthRight != 0)
- addLine(rx + w, ry, rx + w, ry - h,
- area.borderWidthRight,
- new PDFColor(area.borderColorRight));
- if (area.borderWidthBottom != 0)
- addLine(rx, ry - h, rx + w, ry - h,
- area.borderWidthBottom,
- new PDFColor(area.borderColorBottom));
-
- */
- }
-
- public void renderSpanArea(SpanArea area) {
-
- //A span maps to a textframe
-
-
- this.mifDoc.createTextRect(area.getColumnCount());
-
- Enumeration e = area.getChildren().elements();
- while (e.hasMoreElements()) {
- Box b = (Box) e.nextElement();
- b.render(this); // column areas
- }
- }
-
-
-
-
-
-
- /** render the given block area */
- public void renderBlockArea(BlockArea area) {
-
- this.mifDoc.setBlockProp(area.getStartIndent(),area.getEndIndent());
- Enumeration e = area.getChildren().elements();
- while (e.hasMoreElements()) {
- Box b = (Box) e.nextElement();
- b.render(this);
- }
-
- }
-
- /** render the given display space */
- public void renderDisplaySpace(DisplaySpace space) {
-
- int d = space.getSize();
- this.currentYPosition -= d;
-
- }
-
- /** render the given SVG area */
- public void renderSVGArea(SVGArea area) {}
-
- /** render a foreign object area */
- public void renderForeignObjectArea(ForeignObjectArea area) {
- }
-
- public void renderWordArea(WordArea area) {
- String s;
- s = area.getText();
- this.mifDoc.addToStream(s);
-
- this.currentXPosition += area.getContentWidth();
- }
-
- /** render the given image area */
- public void renderImageArea(ImageArea area) {
-
- int x = this.currentAreaContainerXPosition + area.getXOffset();
- int y = this.currentYPosition;
- int w = area.getContentWidth();
- int h = area.getHeight();
-
- this.currentYPosition -= h;
-
- FopImage img = area.getImage();
- if (img instanceof SVGImage) {
- /* try {
- SVGSVGElement svg =
- ((SVGImage) img).getSVGDocument().getRootElement();
- currentStream.add("ET\nq\n" + (((float) w) / 1000f) +
- " 0 0 " + (((float) h) / 1000f) + " " +
- (((float) x) / 1000f) + " " +
- (((float)(y - h)) / 1000f) + " cm\n");
- // renderSVG(svg, (int) x, (int) y);
- currentStream.add("Q\nBT\n");
- } catch (FopImageException e) {
- } */
-
- MessageHandler.logln("Warning: SVG images not supported in this version");
- } else {
- String url = img.getURL();
- this.mifDoc.addImage(url,x,pageHeight-y,w,h);
-
- }
- }
-
-
-
- /** render the given inline area */
- public void renderInlineArea(InlineArea area) {}
-
- /** render the given inline space */
- public void renderInlineSpace(InlineSpace space) {
-
- // I dont need the size of space! I just need to
- // leave a blank space each time
- String s=" ";
- this.mifDoc.addToStream(s); // cool!
- this.currentXPosition += space.getSize();
- }
-
- /** render the given line area */
- public void renderLineArea(LineArea area) {
-
-
-
- int rx = this.currentAreaContainerXPosition
- + area.getStartIndent();
- int ry = this.currentYPosition;
- int w = area.getContentWidth();
- int h = area.getHeight();
-
- this.currentYPosition -= area.getPlacementOffset();
- this.currentXPosition = rx;
-
- int bl = this.currentYPosition;
-
- //The start of a new linearea corresponds to a new para in FM
-
- this.mifDoc.startLine();
-
- Enumeration e = area.getChildren().elements();
- while (e.hasMoreElements()) {
-
- Box b = (Box) e.nextElement();
- this.currentYPosition = ry - area.getPlacementOffset();
- b.render(this);
-
- }
- this.currentYPosition = ry-h;
- this.currentXPosition = rx;
-
-
- }
-
-
-
- /** render the given page */
- public void renderPage(Page page) {
-
- AreaContainer before, after;
- BodyAreaContainer body;
- body = page.getBody();
- before = page.getBefore();
- after = page.getAfter();
-
- this.currentFontName = "";
- this.currentFontSize = "0";
-
- pageHeight=page.getHeight();
- pageWidth=page.getWidth();
- this.mifDoc.setDocumentHeightWidth(pageHeight,pageWidth);
-
-
- this.mifDoc.createPage();
-
- renderBodyAreaContainer(body);
-
-
- // If the area is an instance of anything other than body, it goes into the
- // corresponding master page.
-
-
- if (before != null) {
-
- this.mifDoc.createTextRect(1); // Create a rect with one col
- renderAreaContainer(before);
- }
-
- if (after != null) {
-
- this.mifDoc.createTextRect(1); // Create a rect with one col
- renderAreaContainer(after);
- }
-
- }
-
- /** render the given leader area */
- public void renderLeaderArea(LeaderArea area) {}
-
-
-}
+/*-- $Id: MIFRenderer.java,v 1.1.2.1 2001/03/01 02:20:39 keiron Exp $ --
+
+ ============================================================================
+ The Apache Software License, Version 1.1
+ ============================================================================
+
+ Copyright (C) 1999 The Apache Software Foundation. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modifica-
+ tion, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ 3. The end-user documentation included with the redistribution, if any, must
+ include the following acknowledgment: "This product includes software
+ developed by the Apache Software Foundation (http://www.apache.org/)."
+ Alternately, this acknowledgment may appear in the software itself, if
+ and wherever such third-party acknowledgments normally appear.
+
+ 4. The names "FOP" and "Apache Software Foundation" must not be used to
+ endorse or promote products derived from this software without prior
+ written permission. For written permission, please contact
+ apache@apache.org.
+
+ 5. Products derived from this software may not be called "Apache", nor may
+ "Apache" appear in their name, without prior written permission of the
+ Apache Software Foundation.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
+ DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ This software consists of voluntary contributions made by many individuals
+ on behalf of the Apache Software Foundation and was originally created by
+ James Tauber <jt...@jtauber.com>. For more information on the Apache
+ Software Foundation, please see <http://www.apache.org/>.
+
+ */
+
+// Author : Seshadri G
+
+
+
+
+package org.apache.fop.render.mif;
+
+// FOP
+import org.apache.fop.render.Renderer;
+import org.apache.fop.messaging.MessageHandler;
+import org.apache.fop.image.ImageArea;
+import org.apache.fop.image.FopImage;
+import org.apache.fop.apps.FOPException;
+import org.apache.fop.fo.properties.*;
+import org.apache.fop.fo.*;
+import org.apache.fop.svg.*;
+import org.apache.fop.layout.*;
+import org.apache.fop.layout.inline.*;
+import org.apache.fop.datatypes.*;
+import org.apache.fop.svg.PathPoint;
+import org.apache.fop.mif.*;
+import org.apache.fop.layout.*;
+import org.apache.fop.image.*;
+
+import org.w3c.dom.*;
+import org.w3c.dom.svg.*;
+import org.w3c.dom.css.*;
+import org.w3c.dom.svg.SVGLength;
+
+// Java
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.Enumeration;
+import java.awt.Rectangle;
+import java.util.Vector;
+import java.util.Hashtable;
+/**
+ * Renderer that renders areas to MIF
+ */
+public class MIFRenderer implements Renderer {
+
+ private String currentFontName;
+ private String currentFontSize;
+ private int pageHeight;
+ private int pageWidth;
+
+ /** the current vertical position in millipoints from bottom */
+ protected int currentYPosition = 0;
+
+ /** the current horizontal position in millipoints from left */
+ protected int currentXPosition = 0;
+
+ /** the horizontal position of the current area container */
+ private int currentAreaContainerXPosition = 0;
+
+
+ /** the MIF Document being created */
+ protected MIFDocument mifDoc;
+
+
+ /* is a table currently open? */
+ private boolean inTable=false;
+
+
+
+ /**
+ * create the MIF renderer
+ */
+ public MIFRenderer() {
+ this.mifDoc = new MIFDocument();
+ }
+
+
+ /**
+ * render the areas into MIF
+ *
+ * @param areaTree the laid-out area tree
+ * @param writer the PrintWriter to write the MIF with
+ */
+
+ public void render(AreaTree areaTree,
+ OutputStream stream) throws IOException, FOPException {
+
+ MessageHandler.logln("rendering areas to MIF");
+ // idReferences=areaTree.getIDReferences();
+ //this.pdfResources = this.pdfDoc.getResources();
+ //this.pdfDoc.setIDReferences(idReferences);
+ Enumeration e = areaTree.getPages().elements();
+ while (e.hasMoreElements()) {
+ this.renderPage((Page) e.nextElement());
+ }
+
+
+ // MessageHandler.logln("writing out MIF");
+
+ this.mifDoc.output(stream);
+ stream.close();
+ }
+
+
+
+
+ /** set up the given FontInfo */
+ public void setupFontInfo(FontInfo fontInfo) {
+
+ FontSetup.setup(fontInfo);
+ //FontSetup.addToFontFormat(this.mifDoc, fontInfo);
+
+
+ }
+
+ /** set the producer of the rendering */
+ public void setProducer(String producer) {}
+
+
+ public void renderAreaContainer(AreaContainer area) {
+
+ if (area.foCreator != null && area.foCreator.getName() == "fo:table") {
+
+ this.mifDoc.createTable();
+ this.inTable=true;
+ }
+ else
+ if (area.foCreator != null && area.foCreator.getName() == "fo:table-body") {
+
+ this.mifDoc.setCurrent("fo:table-body");
+ }
+ else
+ if (area.foCreator != null && area.foCreator.getName() == "fo:table-column") {
+
+ int colWidth=((org.apache.fop.fo.flow.TableColumn) area.foCreator).getColumnWidth();
+ this.mifDoc.setColumnProp(colWidth);
+ }
+ else
+ if (area.foCreator != null && area.foCreator.getName() == "fo:table-row") {
+
+ this.mifDoc.startRow();
+ }
+ else
+ if (area.foCreator != null && area.foCreator.getName() == "fo:table-cell") {
+
+ int rowSpan=((org.apache.fop.fo.flow.TableCell) area.foCreator).getNumRowsSpanned();
+ int colSpan=((org.apache.fop.fo.flow.TableCell) area.foCreator).getNumColumnsSpanned();
+ this.mifDoc.startCell(rowSpan,colSpan);
+ }
+ else
+ if (inTable) {
+
+ inTable=false;
+ this.mifDoc.endTable();
+
+ }
+ int saveY = this.currentYPosition;
+ int saveX = this.currentAreaContainerXPosition;
+
+ if (area.getPosition() == Position.ABSOLUTE) {
+ // Y position is computed assuming positive Y axis, adjust for negative postscript one
+ this.currentYPosition =area.getYPosition() - 2 * area.getPaddingTop() - 2 * area.borderWidthTop;
+
+ this.currentAreaContainerXPosition = area.getXPosition();
+ } else if (area.getPosition() == Position.RELATIVE) {
+
+ this.currentYPosition -= area.getYPosition();
+ this.currentAreaContainerXPosition += area.getXPosition();
+
+ } else if (area.getPosition() == Position.STATIC) {
+
+ this.currentYPosition -=
+ area.getPaddingTop() + area.borderWidthTop;
+ this.currentAreaContainerXPosition +=area.getPaddingLeft() + area.borderWidthLeft;
+ }
+
+ this.currentXPosition = this.currentAreaContainerXPosition;
+ doFrame(area);
+
+ Enumeration e = area.getChildren().elements();
+ while (e.hasMoreElements()) {
+ Box b = (Box) e.nextElement();
+ b.render(this);
+ }
+ if (area.getPosition() != Position.STATIC) {
+ this.currentYPosition = saveY;
+ this.currentAreaContainerXPosition = saveX;
+ } else
+ this.currentYPosition -= area.getHeight();
+ }
+
+ public void renderBodyAreaContainer(BodyAreaContainer area) {
+
+
+ int saveY = this.currentYPosition;
+ int saveX = this.currentAreaContainerXPosition;
+
+ if (area.getPosition() == Position.ABSOLUTE) {
+ // Y position is computed assuming positive Y axis, adjust for negative postscript one
+ this.currentYPosition = area.getYPosition();
+ this.currentAreaContainerXPosition = area.getXPosition();
+ } else if (area.getPosition() == Position.RELATIVE) {
+ this.currentYPosition -= area.getYPosition();
+ this.currentAreaContainerXPosition += area.getXPosition();
+ }
+
+ this.currentXPosition = this.currentAreaContainerXPosition;
+ int w, h;
+ int rx = this.currentAreaContainerXPosition;
+ w = area.getContentWidth();
+ h = area.getContentHeight();
+ int ry = this.currentYPosition;
+ ColorType bg = area.getBackgroundColor();
+
+ /*
+
+ // I'm not sure I should have to check for bg being null
+ // but I do
+ if ((bg != null) && (bg.alpha() == 0)) {
+ this.addRect(rx, ry, w, -h, new PDFColor(bg), new PDFColor(bg));
+ }
+
+ */
+ /*
+
+ // floats & footnotes stuff
+ renderAreaContainer(area.getBeforeFloatReferenceArea());
+ renderAreaContainer(area.getFootnoteReferenceArea());
+
+ */
+ // main reference area
+ Enumeration e = area.getMainReferenceArea().getChildren().elements();
+ while (e.hasMoreElements()) {
+ Box b = (Box) e.nextElement();
+ b.render(this); // span areas
+ }
+
+ if (area.getPosition() != Position.STATIC) {
+ this.currentYPosition = saveY;
+ this.currentAreaContainerXPosition = saveX;
+ } else
+ this.currentYPosition -= area.getHeight();
+
+ }
+
+
+ private void doFrame(Area area) {
+ int w, h;
+ int rx = this.currentAreaContainerXPosition;
+ w = area.getContentWidth();
+
+ if (area instanceof BlockArea)
+ rx += ((BlockArea)area).getStartIndent();
+
+ h = area.getContentHeight();
+ int ry = this.currentYPosition;
+ ColorType bg = area.getBackgroundColor();
+
+ rx = rx - area.getPaddingLeft();
+ ry = ry + area.getPaddingTop();
+ w = w + area.getPaddingLeft() + area.getPaddingRight();
+ h = h + area.getPaddingTop() + area.getPaddingBottom();
+
+ /*
+ // I'm not sure I should have to check for bg being null
+ // but I do
+ if ((bg != null) && (bg.alpha() == 0)) {
+ this.addRect(rx, ry, w, -h,
+ new PDFColor(bg),
+ new PDFColor(bg));
+ }
+
+ */
+
+ rx = rx - area.borderWidthLeft;
+ ry = ry + area.borderWidthTop;
+ w = w + area.borderWidthLeft + area.borderWidthRight;
+ h = h + area.borderWidthTop + area.borderWidthBottom;
+
+ //Create a textrect with these dimensions.
+ //The y co-ordinate is measured +ve downwards so subtract page-height
+
+ this.mifDoc.setTextRectProp(rx,pageHeight-ry,w,h);
+
+
+ /*
+
+ if (area.borderWidthTop != 0)
+ addLine(rx, ry, rx + w, ry,
+ area.borderWidthTop,
+ new PDFColor(area.borderColorTop));
+ if (area.borderWidthLeft != 0)
+ addLine(rx, ry, rx, ry - h,
+ area.borderWidthLeft,
+ new PDFColor(area.borderColorLeft));
+ if (area.borderWidthRight != 0)
+ addLine(rx + w, ry, rx + w, ry - h,
+ area.borderWidthRight,
+ new PDFColor(area.borderColorRight));
+ if (area.borderWidthBottom != 0)
+ addLine(rx, ry - h, rx + w, ry - h,
+ area.borderWidthBottom,
+ new PDFColor(area.borderColorBottom));
+
+ */
+ }
+
+ public void renderSpanArea(SpanArea area) {
+
+ //A span maps to a textframe
+
+
+ this.mifDoc.createTextRect(area.getColumnCount());
+
+ Enumeration e = area.getChildren().elements();
+ while (e.hasMoreElements()) {
+ Box b = (Box) e.nextElement();
+ b.render(this); // column areas
+ }
+ }
+
+
+
+
+
+
+ /** render the given block area */
+ public void renderBlockArea(BlockArea area) {
+
+ this.mifDoc.setBlockProp(area.getStartIndent(),area.getEndIndent());
+ Enumeration e = area.getChildren().elements();
+ while (e.hasMoreElements()) {
+ Box b = (Box) e.nextElement();
+ b.render(this);
+ }
+
+ }
+
+ /** render the given display space */
+ public void renderDisplaySpace(DisplaySpace space) {
+
+ int d = space.getSize();
+ this.currentYPosition -= d;
+
+ }
+
+ /** render the given SVG area */
+ public void renderSVGArea(SVGArea area) {}
+
+ /** render a foreign object area */
+ public void renderForeignObjectArea(ForeignObjectArea area) {
+ }
+
+ public void renderWordArea(WordArea area) {
+ String s;
+ s = area.getText();
+ this.mifDoc.addToStream(s);
+
+ this.currentXPosition += area.getContentWidth();
+ }
+
+ /** render the given image area */
+ public void renderImageArea(ImageArea area) {
+
+ int x = this.currentAreaContainerXPosition + area.getXOffset();
+ int y = this.currentYPosition;
+ int w = area.getContentWidth();
+ int h = area.getHeight();
+
+ this.currentYPosition -= h;
+
+ FopImage img = area.getImage();
+ if (img instanceof SVGImage) {
+ /* try {
+ SVGSVGElement svg =
+ ((SVGImage) img).getSVGDocument().getRootElement();
+ currentStream.add("ET\nq\n" + (((float) w) / 1000f) +
+ " 0 0 " + (((float) h) / 1000f) + " " +
+ (((float) x) / 1000f) + " " +
+ (((float)(y - h)) / 1000f) + " cm\n");
+ // renderSVG(svg, (int) x, (int) y);
+ currentStream.add("Q\nBT\n");
+ } catch (FopImageException e) {
+ } */
+
+ MessageHandler.logln("Warning: SVG images not supported in this version");
+ } else {
+ String url = img.getURL();
+ this.mifDoc.addImage(url,x,pageHeight-y,w,h);
+
+ }
+ }
+
+
+
+ /** render the given inline area */
+ public void renderInlineArea(InlineArea area) {}
+
+ /** render the given inline space */
+ public void renderInlineSpace(InlineSpace space) {
+
+ // I dont need the size of space! I just need to
+ // leave a blank space each time
+ String s=" ";
+ this.mifDoc.addToStream(s); // cool!
+ this.currentXPosition += space.getSize();
+ }
+
+ /** render the given line area */
+ public void renderLineArea(LineArea area) {
+
+
+
+ int rx = this.currentAreaContainerXPosition
+ + area.getStartIndent();
+ int ry = this.currentYPosition;
+ int w = area.getContentWidth();
+ int h = area.getHeight();
+
+ this.currentYPosition -= area.getPlacementOffset();
+ this.currentXPosition = rx;
+
+ int bl = this.currentYPosition;
+
+ //The start of a new linearea corresponds to a new para in FM
+
+ this.mifDoc.startLine();
+
+ Enumeration e = area.getChildren().elements();
+ while (e.hasMoreElements()) {
+
+ Box b = (Box) e.nextElement();
+ this.currentYPosition = ry - area.getPlacementOffset();
+ b.render(this);
+
+ }
+ this.currentYPosition = ry-h;
+ this.currentXPosition = rx;
+
+
+ }
+
+
+
+ /** render the given page */
+ public void renderPage(Page page) {
+
+ AreaContainer before, after;
+ BodyAreaContainer body;
+ body = page.getBody();
+ before = page.getBefore();
+ after = page.getAfter();
+
+ this.currentFontName = "";
+ this.currentFontSize = "0";
+
+ pageHeight=page.getHeight();
+ pageWidth=page.getWidth();
+ this.mifDoc.setDocumentHeightWidth(pageHeight,pageWidth);
+
+
+ this.mifDoc.createPage();
+
+ renderBodyAreaContainer(body);
+
+
+ // If the area is an instance of anything other than body, it goes into the
+ // corresponding master page.
+
+
+ if (before != null) {
+
+ this.mifDoc.createTextRect(1); // Create a rect with one col
+ renderAreaContainer(before);
+ }
+
+ if (after != null) {
+
+ this.mifDoc.createTextRect(1); // Create a rect with one col
+ renderAreaContainer(after);
+ }
+
+ }
+
+ /** render the given leader area */
+ public void renderLeaderArea(LeaderArea area) {}
+
+
+}
No revision
No revision
1.55.2.1 +4 -10 xml-fop/src/org/apache/fop/render/pdf/PDFRenderer.java
Index: PDFRenderer.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/render/pdf/PDFRenderer.java,v
retrieving revision 1.55
retrieving revision 1.55.2.1
diff -u -r1.55 -r1.55.2.1
--- PDFRenderer.java 2001/02/27 12:28:19 1.55
+++ PDFRenderer.java 2001/03/01 02:20:39 1.55.2.1
@@ -1,4 +1,4 @@
-/*-- $Id: PDFRenderer.java,v 1.55 2001/02/27 12:28:19 fotis Exp $ --
+/*-- $Id: PDFRenderer.java,v 1.55.2.1 2001/03/01 02:20:39 keiron Exp $ --
============================================================================
The Apache Software License, Version 1.1
@@ -61,7 +61,7 @@
import org.apache.fop.layout.*;
import org.apache.fop.layout.inline.*;
import org.apache.fop.datatypes.*;
-import org.apache.fop.svg.PathPoint;
+import org.apache.fop.svg.*;
import org.apache.fop.pdf.*;
import org.apache.fop.layout.*;
import org.apache.fop.image.*;
@@ -74,12 +74,6 @@
import org.w3c.dom.css.*;
import org.w3c.dom.svg.SVGLength;
-import org.apache.fop.dom.svg.*;
-import org.apache.fop.dom.svg.SVGRectElementImpl;
-import org.apache.fop.dom.svg.SVGTextElementImpl;
-import org.apache.fop.dom.svg.SVGLineElementImpl;
-import org.apache.fop.dom.svg.SVGArea;
-
// Java
import java.io.IOException;
import java.io.OutputStream;
@@ -592,7 +586,7 @@
int xOffset = x, yOffset = y;
// translate and scale according to viewbox.
- if (svg.getViewBox () != null) {
+/* if (svg.getViewBox () != null) {
SVGRect view = svg.getViewBox().getBaseVal();
// TODO take aspect constraints (attribute preserveAspectRatio)
@@ -608,7 +602,7 @@
sy = -sy;
}
-
+*/
/*
* Clip to the svg area.
* Note: To have the svg overlay (under) a text area then use
1.8.2.1 +178 -175 xml-fop/src/org/apache/fop/render/pdf/SVGRenderer.java
Index: SVGRenderer.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/render/pdf/SVGRenderer.java,v
retrieving revision 1.8
retrieving revision 1.8.2.1
diff -u -r1.8 -r1.8.2.1
--- SVGRenderer.java 2001/02/27 00:05:52 1.8
+++ SVGRenderer.java 2001/03/01 02:20:39 1.8.2.1
@@ -1,4 +1,4 @@
-/*-- $Id: SVGRenderer.java,v 1.8 2001/02/27 00:05:52 keiron Exp $ --
+/*-- $Id: SVGRenderer.java,v 1.8.2.1 2001/03/01 02:20:39 keiron Exp $ --
============================================================================
The Apache Software License, Version 1.1
@@ -69,12 +69,6 @@
import org.w3c.dom.css.*;
import org.w3c.dom.svg.SVGLength;
-import org.apache.fop.dom.svg.*;
-import org.apache.fop.dom.svg.SVGRectElementImpl;
-import org.apache.fop.dom.svg.SVGTextElementImpl;
-import org.apache.fop.dom.svg.SVGLineElementImpl;
-import org.apache.fop.dom.svg.SVGArea;
-
// Java
import java.io.IOException;
import java.io.StringWriter;
@@ -197,8 +191,8 @@
org.w3c.dom.Node n = nl.item(count);
// only render the first child that has a valid
// test data
- if (n instanceof GraphicElement) {
- GraphicElement graphic = (GraphicElement) n;
+ if (n instanceof SVGTests) {
+ SVGTests graphic = (SVGTests) n;
SVGStringList grelist = graphic.getRequiredExtensions();
// if null it evaluates to true
if (grelist != null) {
@@ -407,10 +401,10 @@
* out in order.
* Arcs don't work.
*/
- protected void addPath(Vector points, int posx, int posy,
+ protected void addPath(SVGPathSegList points, int posx, int posy,
DrawingInstruction di) {
PDFNumber pdfNumber = new PDFNumber();
- SVGPathSegImpl pathmoveto = null;
+ SVGPathSeg pathmoveto = null;
float lastx = 0;
float lasty = 0;
float lastmovex = 0;
@@ -420,14 +414,15 @@
float tempy;
float lastcx = 0;
float lastcy = 0;
- for (Enumeration e = points.elements(); e.hasMoreElements();) {
- SVGPathSegImpl pc = (SVGPathSegImpl) e.nextElement();
- float[] vals = pc.getValues();
+ for (int count = 0; count < points.getNumberOfItems(); count++) {
+ SVGPathSeg pc = (SVGPathSeg) points.getItem(count);
+// float[] vals = pc.getValues();
switch (pc.getPathSegType()) {
case SVGPathSeg.PATHSEG_MOVETO_ABS:
pathmoveto = pc;
- lastx = vals[0];
- lasty = vals[1];
+ SVGPathSegMovetoAbs mta = (SVGPathSegMovetoAbs)pc;
+ lastx = mta.getX();
+ lasty = mta.getY();
currentStream.write(pdfNumber.doubleOut(lastx) + " " + pdfNumber.doubleOut(lasty) + " m\n");
lastcx = 0;
lastcy = 0;
@@ -439,14 +434,15 @@
// it seems if there is an 'm' then the current path is closed
// then the point is move to a place relative to the point
// after doing the close
+ SVGPathSegMovetoRel mtr = (SVGPathSegMovetoRel)pc;
if (pathmoveto == null) {
- lastx += vals[0];
- lasty += vals[1];
+ lastx += mtr.getX();
+ lasty += mtr.getY();
pathmoveto = pc;
currentStream.write(pdfNumber.doubleOut(lastx) + " " + pdfNumber.doubleOut(lasty) + " m\n");
} else {
- lastx += vals[0];
- lasty += vals[1];
+ lastx += mtr.getX();
+ lasty += mtr.getY();
pathmoveto = pc;
currentStream.write(pdfNumber.doubleOut(lastx) + " " + pdfNumber.doubleOut(lasty) + " l\n");
}
@@ -456,65 +452,73 @@
lastcy = 0;
break;
case SVGPathSeg.PATHSEG_LINETO_ABS:
- lastx = vals[0];
- lasty = vals[1];
+ SVGPathSegLinetoAbs lta = (SVGPathSegLinetoAbs)pc;
+ lastx = lta.getX();
+ lasty = lta.getY();
currentStream.write(pdfNumber.doubleOut(lastx) + " " + pdfNumber.doubleOut(lasty) + " l\n");
lastcx = 0;
lastcy = 0;
break;
case SVGPathSeg.PATHSEG_LINETO_REL:
- lastx += vals[0];
- lasty += vals[1];
+ SVGPathSegLinetoRel ltr = (SVGPathSegLinetoRel)pc;
+ lastx += ltr.getX();
+ lasty += ltr.getY();
currentStream.write(pdfNumber.doubleOut(lastx) + " " + pdfNumber.doubleOut(lasty) + " l\n");
lastcx = 0;
lastcy = 0;
break;
case SVGPathSeg.PATHSEG_LINETO_VERTICAL_ABS:
- lasty = vals[0];
+ SVGPathSegLinetoVerticalAbs lva = (SVGPathSegLinetoVerticalAbs)pc;
+ lasty = lva.getY();
currentStream.write(pdfNumber.doubleOut(lastx) + " " + pdfNumber.doubleOut(lasty) + " l\n");
lastcx = 0;
lastcy = 0;
break;
case SVGPathSeg.PATHSEG_LINETO_VERTICAL_REL:
- lasty += vals[0];
+ SVGPathSegLinetoVerticalRel lvr = (SVGPathSegLinetoVerticalRel)pc;
+ lasty += lvr.getY();
currentStream.write(pdfNumber.doubleOut(lastx) + " " + pdfNumber.doubleOut(lasty) + " l\n");
lastcx = 0;
lastcy = 0;
break;
case SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_ABS:
- lastx = vals[0];
+ SVGPathSegLinetoHorizontalAbs lha = (SVGPathSegLinetoHorizontalAbs)pc;
+ lastx = lha.getX();
currentStream.write(pdfNumber.doubleOut(lastx) + " " + pdfNumber.doubleOut(lasty) + " l\n");
lastcx = 0;
lastcy = 0;
break;
case SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_REL:
- lastx += vals[0];
+ SVGPathSegLinetoHorizontalRel lhr = (SVGPathSegLinetoHorizontalRel)pc;
+ lastx += lhr.getX();
currentStream.write(pdfNumber.doubleOut(lastx) + " " + pdfNumber.doubleOut(lasty) + " l\n");
lastcx = 0;
lastcy = 0;
break;
case SVGPathSeg.PATHSEG_CURVETO_CUBIC_ABS:
- lastx = vals[4];
- lasty = vals[5];
- lastcx = vals[2];
- lastcy = vals[3];
- currentStream.write(pdfNumber.doubleOut(vals[0]) + " " + pdfNumber.doubleOut(vals[1]) +
- " " + pdfNumber.doubleOut(vals[2]) + " " + pdfNumber.doubleOut(vals[3]) + " " +
+ SVGPathSegCurvetoCubicAbs cca = (SVGPathSegCurvetoCubicAbs)pc;
+ lastx = cca.getX2();
+ lasty = cca.getY2();
+ lastcx = cca.getX1();
+ lastcy = cca.getY1();
+ currentStream.write(pdfNumber.doubleOut(cca.getX()) + " " + pdfNumber.doubleOut(cca.getY()) +
+ " " + pdfNumber.doubleOut(lastcx) + " " + pdfNumber.doubleOut(lastcy) + " " +
pdfNumber.doubleOut(lastx) + " " + pdfNumber.doubleOut(lasty) + " c\n");
break;
case SVGPathSeg.PATHSEG_CURVETO_CUBIC_REL:
- currentStream.write(pdfNumber.doubleOut(vals[0] + lastx) + " " +
- pdfNumber.doubleOut(vals[1] + lasty) + " " +
- pdfNumber.doubleOut(vals[2] + lastx) + " " +
- pdfNumber.doubleOut(vals[3] + lasty) + " " +
- pdfNumber.doubleOut(vals[4] + lastx) + " " +
- pdfNumber.doubleOut(vals[5] + lasty) + " c\n");
- lastcx = vals[2] + lastx;
- lastcy = vals[3] + lasty;
- lastx += vals[4];
- lasty += vals[5];
+ SVGPathSegCurvetoCubicRel ccr = (SVGPathSegCurvetoCubicRel)pc;
+ currentStream.write(pdfNumber.doubleOut(ccr.getX() + lastx) + " " +
+ pdfNumber.doubleOut(ccr.getY() + lasty) + " " +
+ pdfNumber.doubleOut(ccr.getX1() + lastx) + " " +
+ pdfNumber.doubleOut(ccr.getY1() + lasty) + " " +
+ pdfNumber.doubleOut(ccr.getX2() + lastx) + " " +
+ pdfNumber.doubleOut(ccr.getY2() + lasty) + " c\n");
+ lastcx = ccr.getX1() + lastx;
+ lastcy = ccr.getY1() + lasty;
+ lastx += ccr.getX2();
+ lasty += ccr.getY2();
break;
- case SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_ABS:
+/* case SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_ABS:
if (lastcx == 0) {
lastcx = lastx;
}
@@ -645,7 +649,7 @@
pathmoveto = null;
lastx = lastmovex;
lasty = lastmovey;
- break;
+ break;*/
}
}
doDrawing(di);
@@ -797,23 +801,22 @@
* A polygon is merely a closed polyline.
* This is made up from a set of points that straight lines are drawn between.
*/
- protected void addPolyline(Vector points, DrawingInstruction di,
+ protected void addPolyline(SVGPointList points, DrawingInstruction di,
boolean close) {
PDFNumber pdfNumber = new PDFNumber();
- PathPoint pc;
+ SVGPoint pc;
float lastx = 0;
float lasty = 0;
- Enumeration e = points.elements();
- if (e.hasMoreElements()) {
- pc = (PathPoint) e.nextElement();
- lastx = pc.x;
- lasty = pc.y;
+ if (points.getNumberOfItems() > 0) {
+ pc = (SVGPoint) points.getItem(0);
+ lastx = pc.getX();
+ lasty = pc.getY();
currentStream.write(pdfNumber.doubleOut(lastx) + " " + pdfNumber.doubleOut(lasty) + " m\n");
}
- while (e.hasMoreElements()) {
- pc = (PathPoint) e.nextElement();
- lastx = pc.x;
- lasty = pc.y;
+ for(int count = 1; count < points.getNumberOfItems(); count++) {
+ pc = (SVGPoint) points.getItem(count);
+ lastx = pc.getX();
+ lasty = pc.getY();
currentStream.write(pdfNumber.doubleOut(lastx) + " " + pdfNumber.doubleOut(lasty) + " l\n");
}
if (close)
@@ -943,7 +946,7 @@
NodeList nl = pattern.getChildNodes();
SVGPatternElement ref = (SVGPatternElement) locateDef(
pattern.getHref().getBaseVal(), pattern);
- while (ref != null) {
+/* while (ref != null) {
if (x == null) {
x = ref.getX();
pattUnits = ref.getPatternUnits().getBaseVal();
@@ -986,7 +989,7 @@
length.newValueSpecifiedUnits(
SVGLength.SVG_LENGTHTYPE_PERCENTAGE, 1);
height = new SVGAnimatedLengthImpl(length);
- }
+ }*/
StringWriter realStream = currentStream;
currentStream = new StringWriter();
@@ -1006,13 +1009,13 @@
double xval = x.getBaseVal().getValue() + currentXPosition / 1000f;
double yval = -y.getBaseVal().getValue() + currentYPosition / 1000f;
- if (area instanceof GraphicElement) {
- SVGRect bbox = ((GraphicElement) area).getBBox();
+/* if (area instanceof SVGLocatable) {
+ SVGRect bbox = ((SVGLocatable) area).getBBox();
if (bbox != null) {
// xval += bbox.getX();
// yval -= bbox.getY();
}
- }
+ }*/
double widthval = width.getBaseVal().getValue();
double heightval = height.getBaseVal().getValue();
Vector bbox = new Vector();
@@ -1059,7 +1062,7 @@
stops = linear.getChildNodes();
SVGLinearGradientElement ref = (SVGLinearGradientElement) locateDef(
linear.getHref().getBaseVal(), linear);
- while (ref != null) {
+/* while (ref != null) {
if (ax1 == null) {
ax1 = ref.getX1();
gradUnits = ref.getGradientUnits().getBaseVal();
@@ -1103,7 +1106,7 @@
length.newValueSpecifiedUnits(
SVGLength.SVG_LENGTHTYPE_PERCENTAGE, 0);
ay2 = new SVGAnimatedLengthImpl(length);
- }
+ }*/
SVGAnimatedTransformList an = linear.getGradientTransform();
SVGMatrix transform = null;
if(an != null)
@@ -1149,8 +1152,8 @@
new Double(currentYPosition / 1000f + y2));
}
}
- } else if (area instanceof GraphicElement) {
- SVGRect rect = ((GraphicElement) area).getBBox();
+/* } else if (area instanceof SVGLocatable) {
+ SVGRect rect = ((SVGLocatable) area).getBBox();
if (rect != null) {
theCoords = new Vector();
SVGLength val;
@@ -1206,7 +1209,7 @@
new Double(currentYPosition / 1000f -
val.getValue()));
}
- }
+ }*/
}
if (theCoords == null) {
theCoords = new Vector();
@@ -1244,7 +1247,7 @@
Vector someColors = new Vector();
float lastoffset = 0;
Vector lastVector = null;
- SVGStopElementImpl stop;
+ SVGStopElement stop;
if (nl.getLength() == 0) {
// the color should be "none"
if (fill)
@@ -1253,7 +1256,7 @@
di.stroke = false;
return;
} else if (nl.getLength() == 1) {
- stop = (SVGStopElementImpl) nl.item(0);
+ stop = (SVGStopElement) nl.item(0);
CSSValue cv = stop.getPresentationAttribute("stop-color");
if (cv == null) {
// maybe using color
@@ -1266,7 +1269,7 @@
}
PDFColor color = new PDFColor(0, 0, 0);
if (cv != null &&
- cv.getValueType() == CSSValue.CSS_PRIMITIVE_VALUE) {
+ cv.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE) {
if (((CSSPrimitiveValue) cv).getPrimitiveType() ==
CSSPrimitiveValue.CSS_RGBCOLOR) {
RGBColor col =
@@ -1292,7 +1295,7 @@
return;
}
for (int count = 0; count < nl.getLength(); count++) {
- stop = (SVGStopElementImpl) nl.item(count);
+ stop = (SVGStopElement) nl.item(count);
CSSValue cv = stop.getPresentationAttribute("stop-color");
if (cv == null) {
// maybe using color
@@ -1305,7 +1308,7 @@
}
PDFColor color = new PDFColor(0, 0, 0);
if (cv != null &&
- cv.getValueType() == CSSValue.CSS_PRIMITIVE_VALUE) {
+ cv.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE) {
if (((CSSPrimitiveValue) cv).getPrimitiveType() ==
CSSPrimitiveValue.CSS_RGBCOLOR) {
RGBColor col =
@@ -1376,7 +1379,7 @@
stops = radial.getChildNodes();
SVGRadialGradientElement ref = (SVGRadialGradientElement) locateDef(
radial.getHref().getBaseVal(), radial);
- while (ref != null) {
+/* while (ref != null) {
if (acx == null) {
acx = ref.getCx();
gradUnits = ref.getGradientUnits().getBaseVal();
@@ -1428,10 +1431,10 @@
length.newValueSpecifiedUnits(
SVGLength.SVG_LENGTHTYPE_PERCENTAGE, 0.5f);
afy = new SVGAnimatedLengthImpl(length);
- }
+ }*/
ColorSpace aColorSpace = new ColorSpace(ColorSpace.DEVICE_RGB);
org.w3c.dom.NodeList nl = stops;
- SVGStopElementImpl stop;
+ SVGStopElement stop;
if (nl.getLength() == 0) {
// the color should be "none"
if (fill)
@@ -1440,7 +1443,7 @@
di.stroke = false;
return;
} else if (nl.getLength() == 1) {
- stop = (SVGStopElementImpl) nl.item(0);
+ stop = (SVGStopElement) nl.item(0);
CSSValue cv = stop.getPresentationAttribute("stop-color");
if (cv == null) {
// maybe using color
@@ -1453,7 +1456,7 @@
}
PDFColor color = new PDFColor(0, 0, 0);
if (cv != null &&
- cv.getValueType() == CSSValue.CSS_PRIMITIVE_VALUE) {
+ cv.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE) {
if (((CSSPrimitiveValue) cv).getPrimitiveType() ==
CSSPrimitiveValue.CSS_RGBCOLOR) {
RGBColor col =
@@ -1527,10 +1530,10 @@
new Double(ar.getBaseVal().getValue()));
// }
}
- } else if (gradUnits ==
+/* } else if (gradUnits ==
SVGUnitTypes.SVG_UNIT_TYPE_OBJECTBOUNDINGBOX &&
- area instanceof GraphicElement) {
- SVGRect rect = ((GraphicElement) area).getBBox();
+ area instanceof SVGLocatable) {
+ SVGRect rect = ((SVGLocatable) area).getBBox();
if (rect != null) {
theCoords = new Vector();
SVGLength val;
@@ -1596,14 +1599,14 @@
} else {
theCoords.addElement(new Double(val.getValue()));
}
- }
+ }*/
}
if (theCoords == null) {
// percentage values are expressed according to the viewport.
- SVGElement vp =
+/* SVGElement vp =
((GraphicElement) area).getNearestViewportElement();
- if (area instanceof GraphicElement) {
- SVGRect rect = ((GraphicElement) area).getBBox();
+ if (area instanceof SVGLocatable) {
+ SVGRect rect = ((SVGLocatable) area).getBBox();
if (rect != null) {
theCoords = new Vector();
SVGLength val = acx.getBaseVal();
@@ -1674,7 +1677,7 @@
theCoords.addElement(new Double(val.getValue()));
}
}
- }
+ }*/
}
if (theCoords == null) {
theCoords = new Vector();
@@ -1693,7 +1696,7 @@
}
float lastoffset = 0;
for (int count = 0; count < nl.getLength(); count++) {
- stop = (SVGStopElementImpl) nl.item(count);
+ stop = (SVGStopElement) nl.item(count);
CSSValue cv = stop.getPresentationAttribute("stop-color");
if (cv == null) {
// maybe using color
@@ -1706,7 +1709,7 @@
}
PDFColor color = new PDFColor(0, 0, 0);
if (cv != null &&
- cv.getValueType() == CSSValue.CSS_PRIMITIVE_VALUE) {
+ cv.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE) {
if (((CSSPrimitiveValue) cv).getPrimitiveType() ==
CSSPrimitiveValue.CSS_RGBCOLOR) {
RGBColor col =
@@ -1759,7 +1762,7 @@
CSSValue sp;
sp = style.getPresentationAttribute("fill");
if (sp != null) {
- if (sp.getValueType() == CSSValue.CSS_PRIMITIVE_VALUE) {
+ if (sp.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE) {
if (((CSSPrimitiveValue) sp).getPrimitiveType() ==
CSSPrimitiveValue.CSS_RGBCOLOR) {
RGBColor col =
@@ -1803,7 +1806,7 @@
}
sp = style.getPresentationAttribute("fill-rule");
if (sp != null) {
- if (sp.getValueType() == CSSValue.CSS_PRIMITIVE_VALUE) {
+ if (sp.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE) {
if (((CSSPrimitiveValue) sp).getPrimitiveType() ==
CSSPrimitiveValue.CSS_STRING) {
if (sp.getCssText().equals("nonzero")) {
@@ -1815,7 +1818,7 @@
}
sp = style.getPresentationAttribute("stroke");
if (sp != null) {
- if (sp.getValueType() == CSSValue.CSS_PRIMITIVE_VALUE) {
+ if (sp.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE) {
if (((CSSPrimitiveValue) sp).getPrimitiveType() ==
CSSPrimitiveValue.CSS_RGBCOLOR) {
RGBColor col =
@@ -1855,7 +1858,7 @@
}
sp = style.getPresentationAttribute("stroke-linecap");
if (sp != null) {
- if (sp.getValueType() == CSSValue.CSS_PRIMITIVE_VALUE) {
+ if (sp.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE) {
if (((CSSPrimitiveValue) sp).getPrimitiveType() ==
CSSPrimitiveValue.CSS_STRING) {
String str = sp.getCssText();
@@ -1873,7 +1876,7 @@
}
sp = style.getPresentationAttribute("stroke-linejoin");
if (sp != null) {
- if (sp.getValueType() == CSSValue.CSS_PRIMITIVE_VALUE) {
+ if (sp.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE) {
if (((CSSPrimitiveValue) sp).getPrimitiveType() ==
CSSPrimitiveValue.CSS_STRING) {
String str = sp.getCssText();
@@ -1890,7 +1893,7 @@
}
sp = style.getPresentationAttribute("stroke-miterlimit");
if (sp != null) {
- if (sp.getValueType() == CSSValue.CSS_PRIMITIVE_VALUE) {
+ if (sp.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE) {
float width;
width = ((CSSPrimitiveValue) sp).getFloatValue(
CSSPrimitiveValue.CSS_PT);
@@ -1901,7 +1904,7 @@
}
sp = style.getPresentationAttribute("stroke-width");
if (sp != null) {
- if (sp.getValueType() == CSSValue.CSS_PRIMITIVE_VALUE) {
+ if (sp.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE) {
float width;
width = ((CSSPrimitiveValue) sp).getFloatValue(
CSSPrimitiveValue.CSS_PT);
@@ -1911,12 +1914,12 @@
}
sp = style.getPresentationAttribute("stroke-dasharray");
if (sp != null) {
- if (sp.getValueType() == CSSValue.CSS_VALUE_LIST) {
+ if (sp.getCssValueType() == CSSValue.CSS_VALUE_LIST) {
currentStream.write("[ ");
CSSValueList list = (CSSValueList) sp;
for (int count = 0; count < list.getLength(); count++) {
CSSValue val = list.item(count);
- if (val.getValueType() ==
+ if (val.getCssValueType() ==
CSSValue.CSS_PRIMITIVE_VALUE) {
currentStream.write(
((CSSPrimitiveValue) val).getFloatValue(
@@ -1925,7 +1928,7 @@
}
currentStream.write("] ");
sp = style.getPresentationAttribute("stroke-dashoffset");
- if (sp != null && sp.getValueType() ==
+ if (sp != null && sp.getCssValueType() ==
CSSValue.CSS_PRIMITIVE_VALUE) {
currentStream.write(
((CSSPrimitiveValue) sp).getFloatValue(
@@ -1938,7 +1941,7 @@
sp = style.getPresentationAttribute("clip-path");
if (sp != null) {
String clipurl;
- if (sp.getValueType() == CSSValue.CSS_PRIMITIVE_VALUE) {
+ if (sp.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE) {
if (((CSSPrimitiveValue) sp).getPrimitiveType() ==
CSSPrimitiveValue.CSS_URI) {
clipurl = ((CSSPrimitiveValue) sp).getCssText();
@@ -1961,7 +1964,7 @@
sp = style.getPresentationAttribute("mask");
if (sp != null) {
String maskurl;
- if (sp.getValueType() == CSSValue.CSS_PRIMITIVE_VALUE) {
+ if (sp.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE) {
if (((CSSPrimitiveValue) sp).getPrimitiveType() ==
CSSPrimitiveValue.CSS_URI) {
maskurl = ((CSSPrimitiveValue) sp).getCssText();
@@ -2018,22 +2021,22 @@
currentStream.write("q\n");
if (area instanceof SVGTransformable) {
SVGTransformable tf = (SVGTransformable) area;
- SVGAnimatedTransformList trans = tf.getTransform();
- if (trans != null) {
- applyTransform(trans);
- }
+// SVGAnimatedTransformList trans = tf.getTransform();
+// if (trans != null) {
+// applyTransform(trans);
+// }
}
if (area instanceof SVGStylable) {
- di = applyStyle(area, (SVGStylable) area);
+// di = applyStyle(area, (SVGStylable) area);
}
if (area instanceof SVGRectElement) {
SVGRectElement rg = (SVGRectElement) area;
float rectx = rg.getX().getBaseVal().getValue();
float recty = rg.getY().getBaseVal().getValue();
- float rx = rg.getRx().getBaseVal().getValue();
- float ry = rg.getRy().getBaseVal().getValue();
+ float rx = 0;//rg.getRx().getBaseVal().getValue();
+ float ry = 0;//rg.getRy().getBaseVal().getValue();
float rw = rg.getWidth().getBaseVal().getValue();
float rh = rg.getHeight().getBaseVal().getValue();
addRect(rectx, recty, rw, rh, rx, ry, di);
@@ -2044,11 +2047,11 @@
float x2 = lg.getX2().getBaseVal().getValue();
float y2 = lg.getY2().getBaseVal().getValue();
addLine(x1, y1, x2, y2, di);
- } else if (area instanceof SVGTextElementImpl) {
+ } else if (area instanceof SVGTextElement) {
// currentStream.add("q\n");
// currentStream.add(1 + " " + 0 + " " + 0 + " " + 1 + " " + 0 + " " + 0 + " cm\n");
currentStream.write("BT\n");
- renderText((SVGTextElementImpl) area, 0, 0, di);
+ renderText((SVGTextElement) area, 0, 0, di);
currentStream.write("ET\n");
// currentStream.add("Q\n");
} else if (area instanceof SVGCircleElement) {
@@ -2064,19 +2067,18 @@
float rx = cg.getRx().getBaseVal().getValue();
float ry = cg.getRy().getBaseVal().getValue();
addEllipse(cx, cy, rx, ry, di);
- } else if (area instanceof SVGPathElementImpl) {
- addPath(((SVGPathElementImpl) area).pathElements, posx,
- posy, di);
- } else if (area instanceof SVGPolylineElementImpl) {
- addPolyline(((SVGPolylineElementImpl) area).points, di, false);
- } else if (area instanceof SVGPolygonElementImpl) {
- addPolyline(((SVGPolygonElementImpl) area).points, di, true);
- } else if (area instanceof SVGGElementImpl) {
- renderGArea((SVGGElementImpl) area, x, y);
- } else if (area instanceof SVGUseElementImpl) {
- SVGUseElementImpl ug = (SVGUseElementImpl) area;
- String ref = ug.link;
- // ref = ref.substring(1, ref.length());
+ } else if (area instanceof SVGPathElement) {
+// addPath(((SVGPathElement) area).getPathSegList(), posx,
+// posy, di);
+ } else if (area instanceof SVGPolylineElement) {
+// addPolyline(((SVGPolylineElement) area).getPoints(), di, false);
+ } else if (area instanceof SVGPolygonElement) {
+// addPolyline(((SVGPolygonElement) area).getPoints(), di, true);
+ } else if (area instanceof SVGGElement) {
+ renderGArea((SVGGElement) area, x, y);
+ } else if (area instanceof SVGUseElement) {
+ SVGUseElement ug = (SVGUseElement) area;
+ String ref = ug.getHref().getBaseVal();
SVGElement graph = null;
graph = locateDef(ref, ug);
if (graph != null) {
@@ -2125,14 +2127,14 @@
else {
MessageHandler.logln("Use Element: " + ref + " not found");
}
- } else if (area instanceof SVGImageElementImpl) {
- SVGImageElementImpl ig = (SVGImageElementImpl) area;
- renderImage(ig.link, ig.x, ig.y, ig.width, ig.height);
+ } else if (area instanceof SVGImageElement) {
+ SVGImageElement ig = (SVGImageElement) area;
+ renderImage(ig.getHref().getBaseVal(), ig.getX().getBaseVal().getValue(), ig.getY().getBaseVal().getValue(), ig.getWidth().getBaseVal().getValue(), ig.getHeight().getBaseVal().getValue());
} else if (area instanceof SVGSVGElement) {
currentStream.write("q\n");
SVGSVGElement svgel = (SVGSVGElement) area;
float svgx = 0;
- if (svgel.getX() != null)
+/* if (svgel.getX() != null)
svgx = svgel.getX().getBaseVal().getValue();
float svgy = 0;
if (svgel.getY() != null)
@@ -2140,7 +2142,7 @@
currentStream.write(1 + " 0 0 " + 1 + " " + svgx + " " +
svgy + " cm\n");
renderSVG(svgel, (int)(x + 1000 * svgx),
- (int)(y + 1000 * svgy));
+ (int)(y + 1000 * svgy));*/
currentStream.write("Q\n");
// } else if (area instanceof SVGSymbolElement) {
// 'symbol' element is not rendered (except by 'use')
@@ -2150,7 +2152,7 @@
for (int count = 0; count < nl.getLength(); count++) {
org.w3c.dom.Node n = nl.item(count);
if (n instanceof SVGElement) {
- if (n instanceof GraphicElement) {
+/* if (n instanceof GraphicElement) {
SVGRect rect = ((GraphicElement) n).getBBox();
if (rect != null) {
/* currentAnnotList = this.pdfDoc.makeAnnotList();
@@ -2160,8 +2162,8 @@
currentAnnotList.addLink(
this.pdfDoc.makeLink(lrect.getRectangle(), dest, linkType));
currentAnnotList = null;
- */ }
- }
+ * }
+ }*/
renderElement((SVGElement) n, posx, posy);
}
}
@@ -2176,10 +2178,10 @@
/**
* Todo: underline, linethrough, textpath
*/
- public void renderText(SVGTextElementImpl tg, float x, float y,
+ public void renderText(SVGTextElement tg, float x, float y,
DrawingInstruction di) {
SVGTextRenderer str = new SVGTextRenderer(fontState, tg, x, y);
- str.renderText(tg);
+// str.renderText(tg);
}
/**
@@ -2310,25 +2312,26 @@
float x;
float y;
- SVGTextRenderer(FontState fontState, SVGTextElementImpl tg,
+ SVGTextRenderer(FontState fontState, SVGTextElement tg,
float x, float y) {
fs = fontState;
PDFNumber pdfNumber = new PDFNumber();
- SVGTransformList trans = tg.getTransform().getBaseVal();
+/* SVGTransformList trans = tg.getTransform().getBaseVal();
matrix = trans.consolidate().getMatrix();
transstr = (pdfNumber.doubleOut(matrix.getA()) + " " +
pdfNumber.doubleOut(matrix.getB()) + " " +
pdfNumber.doubleOut(matrix.getC()) + " " +
- pdfNumber.doubleOut(-matrix.getD()) + " ");
+ pdfNumber.doubleOut(-matrix.getD()) + " ");*/
+ transstr = "1 0 0 1 ";
this.x = x;
this.y = y;
}
- void renderText(SVGTextElementImpl te) {
+ void renderText(SVGTextElement te) {
float xoffset = 0;
- if (te.anchor.getEnum() != TextAnchor.START) {
+/* if (te.anchor.getEnum() != TextAnchor.START) {
// This is a bit of a hack: The code below will update
// the current position, so all I have to do is to
// prevent that the code will write anything to the
@@ -2336,7 +2339,7 @@
StringWriter oldStream = currentStream;
currentStream = new StringWriter ();
- _renderText (te, 0f, true);
+ renderText (te, 0f, true);
float width = currentX - te.x;
currentStream = oldStream;
@@ -2346,26 +2349,26 @@
} else if (te.anchor.getEnum() == TextAnchor.MIDDLE) {
xoffset = -width/2;
}
- }
+ }*/
- _renderText (te, xoffset, false);
+ renderText (te, xoffset, false);
}
- void _renderText(SVGTextElementImpl te, float xoffset, boolean getWidthOnly) {
- DrawingInstruction di = applyStyle(te, te);
- if (di.fill) {
- if (di.stroke) {
- currentStream.write("2 Tr\n");
- } else {
+ void renderText(SVGTextElement te, float xoffset, boolean getWidthOnly) {
+// DrawingInstruction di = applyStyle(te, te);
+// if (di.fill) {
+// if (di.stroke) {
+// currentStream.write("2 Tr\n");
+// } else {
currentStream.write("0 Tr\n");
- }
- } else if (di.stroke) {
- currentStream.write("1 Tr\n");
- }
- updateFont(te, fs);
+// }
+// } else if (di.stroke) {
+// currentStream.write("1 Tr\n");
+// }
+// updateFont(te, fs);
- float tx = te.x;
- float ty = te.y;
+ float tx = te.getX().getBaseVal().getValue();
+ float ty = te.getY().getBaseVal().getValue();
currentX = x + tx + xoffset;
currentY = y + ty;
baseX = currentX;
@@ -2374,21 +2377,21 @@
// Vector list = te.textList;
for (int count = 0; count < nodel.getLength(); count++) {
Object o = nodel.item(count);
- applyStyle(te, te);
+// applyStyle(te, te);
if (o instanceof CharacterData) {
String str = ((CharacterData) o).getData();
currentStream.write(transstr +
- (currentX + matrix.getE()) + " " +
- (baseY + matrix.getF()) + " Tm " + "(");
+ (currentX/* + matrix.getE()*/) + " " +
+ (baseY/* + matrix.getF()*/) + " Tm " + "(");
boolean spacing = "preserve".equals(te.getXMLspace());
currentX = addSVGStr(fs, currentX, str, spacing);
currentStream.write(") Tj\n");
- } else if (o instanceof SVGTextPathElementImpl) {
- SVGTextPathElementImpl tpg = (SVGTextPathElementImpl) o;
- String ref = tpg.str;
+ } else if (o instanceof SVGTextPathElement) {
+ SVGTextPathElement tpg = (SVGTextPathElement) o;
+ String ref = tpg.getHref().getBaseVal();
SVGElement graph = null;
graph = locateDef(ref, tpg);
- if (graph instanceof SVGPathElementImpl) {
+ if (graph instanceof SVGPathElement) {
// probably not the best way to do this, should be able
// to render without the style being set.
// GraphicImpl parent = graph.getGraphicParent();
@@ -2397,18 +2400,18 @@
// how should this work
// graph.setParent(parent);
}
- } else if (o instanceof SVGTRefElementImpl) {
- SVGTRefElementImpl trg = (SVGTRefElementImpl) o;
- String ref = trg.ref;
+ } else if (o instanceof SVGTRefElement) {
+ SVGTRefElement trg = (SVGTRefElement) o;
+ String ref = trg.getHref().getBaseVal();
SVGElement element = locateDef(ref, trg);
- if (element instanceof SVGTextElementImpl) {
+ if (element instanceof SVGTextElement) {
// GraphicImpl parent = graph.getGraphicParent();
// graph.setParent(trg);
- SVGTextElementImpl tele =
- (SVGTextElementImpl) element;
+ SVGTextElement tele =
+ (SVGTextElement) element;
// the style should be from tele, but it needs to be placed as a child
// of trg to work
- di = applyStyle(trg, trg);
+/* di = applyStyle(trg, trg);
if (di.fill) {
if (di.stroke) {
currentStream.write("2 Tr\n");
@@ -2417,7 +2420,7 @@
}
} else if (di.stroke) {
currentStream.write("1 Tr\n");
- }
+ }*/
boolean changed = false;
FontState oldfs = fs;
changed = updateFont(te, fs);
@@ -2438,12 +2441,12 @@
}
// graph.setParent(parent);
}
- } else if (o instanceof SVGTSpanElementImpl) {
- SVGTSpanElementImpl tsg = (SVGTSpanElementImpl) o;
- applyStyle(tsg, tsg);
+ } else if (o instanceof SVGTSpanElement) {
+ SVGTSpanElement tsg = (SVGTSpanElement) o;
+// applyStyle(tsg, tsg);
boolean changed = false;
FontState oldfs = fs;
- changed = updateFont(tsg, fs);
+// changed = updateFont(tsg, fs);
boolean spacing = "preserve".equals(tsg.getXMLspace());
renderTextNodes(spacing, tsg.getChildNodes(),
tsg.getX().getBaseVal(),
@@ -2598,7 +2601,7 @@
String fontFamily = fs.getFontFamily();
CSSValue sp = style.getPresentationAttribute("font-family");
if (sp != null &&
- sp.getValueType() == CSSValue.CSS_PRIMITIVE_VALUE) {
+ sp.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE) {
if (((CSSPrimitiveValue) sp).getPrimitiveType() ==
CSSPrimitiveValue.CSS_STRING) {
fontFamily = sp.getCssText();
@@ -2610,7 +2613,7 @@
String fontStyle = fs.getFontStyle();
sp = style.getPresentationAttribute("font-style");
if (sp != null &&
- sp.getValueType() == CSSValue.CSS_PRIMITIVE_VALUE) {
+ sp.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE) {
if (((CSSPrimitiveValue) sp).getPrimitiveType() ==
CSSPrimitiveValue.CSS_STRING) {
fontStyle = sp.getCssText();
@@ -2622,7 +2625,7 @@
String fontWeight = fs.getFontWeight();
sp = style.getPresentationAttribute("font-weight");
if (sp != null &&
- sp.getValueType() == CSSValue.CSS_PRIMITIVE_VALUE) {
+ sp.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE) {
if (((CSSPrimitiveValue) sp).getPrimitiveType() ==
CSSPrimitiveValue.CSS_STRING) {
fontWeight = sp.getCssText();
@@ -2634,7 +2637,7 @@
float newSize = fs.getFontSize() / 1000f;
sp = style.getPresentationAttribute("font-size");
if (sp != null &&
- sp.getValueType() == CSSValue.CSS_PRIMITIVE_VALUE) {
+ sp.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE) {
// if(((CSSPrimitiveValue)sp).getPrimitiveType() == CSSPrimitiveValue.CSS_NUMBER) {
newSize = ((CSSPrimitiveValue) sp).getFloatValue(
CSSPrimitiveValue.CSS_PT);
No revision
No revision
1.15.2.1 +1 -3 xml-fop/src/org/apache/fop/render/xml/XMLRenderer.java
Index: XMLRenderer.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/render/xml/XMLRenderer.java,v
retrieving revision 1.15
retrieving revision 1.15.2.1
diff -u -r1.15 -r1.15.2.1
--- XMLRenderer.java 2001/01/24 00:31:38 1.15
+++ XMLRenderer.java 2001/03/01 02:20:40 1.15.2.1
@@ -1,4 +1,4 @@
-/*-- $Id: XMLRenderer.java,v 1.15 2001/01/24 00:31:38 keiron Exp $ --
+/*-- $Id: XMLRenderer.java,v 1.15.2.1 2001/03/01 02:20:40 keiron Exp $ --
============================================================================
The Apache Software License, Version 1.1
@@ -53,8 +53,6 @@
// FOP
import org.apache.fop.svg.*;
import org.apache.fop.messaging.MessageHandler;
-import org.apache.fop.dom.svg.*;
-import org.apache.fop.dom.svg.SVGArea;
import org.apache.fop.render.Renderer;
import org.apache.fop.image.ImageArea;
import org.apache.fop.layout.*;