From: Keiron Liddle Date: Mon, 18 Jun 2001 08:19:25 +0000 (+0000) Subject: PDFNumber uses static methods X-Git-Tag: PRE_CODEFORMATTING~87 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=89f620215152aff47d274ed95c169a92777116f9;p=xmlgraphics-fop.git PDFNumber uses static methods git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@194292 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/org/apache/fop/svg/PDFDocumentGraphics2D.java b/src/org/apache/fop/svg/PDFDocumentGraphics2D.java index 06bd07009..4a2e5ea0c 100644 --- a/src/org/apache/fop/svg/PDFDocumentGraphics2D.java +++ b/src/org/apache/fop/svg/PDFDocumentGraphics2D.java @@ -79,8 +79,7 @@ public class PDFDocumentGraphics2D extends PDFGraphics2D { * The result is scaled so that the svg fits correctly inside the pdf document. */ public void setSVGDimension(float w, float h) { - PDFNumber pdfNumber = new PDFNumber(); - currentStream.write("" + pdfNumber.doubleOut(width / w) + " 0 0 " + pdfNumber.doubleOut(height / h) + " 0 0 cm\n"); + currentStream.write("" + PDFNumber.doubleOut(width / w) + " 0 0 " + PDFNumber.doubleOut(height / h) + " 0 0 cm\n"); } /** diff --git a/src/org/apache/fop/svg/PDFGraphics2D.java b/src/org/apache/fop/svg/PDFGraphics2D.java index 558d80688..e6eab59b8 100644 --- a/src/org/apache/fop/svg/PDFGraphics2D.java +++ b/src/org/apache/fop/svg/PDFGraphics2D.java @@ -416,8 +416,6 @@ public class PDFGraphics2D extends AbstractGraphics2D { currentColour = new PDFColor(c.getRed(), c.getGreen(), c.getBlue()); currentStream.write(currentColour.getColorSpaceOut(false)); - PDFNumber pdfNumber = new PDFNumber(); - applyPaint(getPaint(), false); applyStroke(getStroke()); @@ -427,26 +425,26 @@ public class PDFGraphics2D extends AbstractGraphics2D { int type = iter.currentSegment(vals); switch (type) { case PathIterator.SEG_CUBICTO: - currentStream.write(pdfNumber.doubleOut(vals[0]) + - " " + pdfNumber.doubleOut(vals[1]) + " " + - pdfNumber.doubleOut(vals[2]) + " " + - pdfNumber.doubleOut(vals[3]) + " " + - pdfNumber.doubleOut(vals[4]) + " " + - pdfNumber.doubleOut(vals[5]) + " c\n"); + currentStream.write(PDFNumber.doubleOut(vals[0]) + + " " + PDFNumber.doubleOut(vals[1]) + " " + + PDFNumber.doubleOut(vals[2]) + " " + + PDFNumber.doubleOut(vals[3]) + " " + + PDFNumber.doubleOut(vals[4]) + " " + + PDFNumber.doubleOut(vals[5]) + " c\n"); break; case PathIterator.SEG_LINETO: - currentStream.write(pdfNumber.doubleOut(vals[0]) + - " " + pdfNumber.doubleOut(vals[1]) + " l\n"); + currentStream.write(PDFNumber.doubleOut(vals[0]) + + " " + PDFNumber.doubleOut(vals[1]) + " l\n"); break; case PathIterator.SEG_MOVETO: - currentStream.write(pdfNumber.doubleOut(vals[0]) + - " " + pdfNumber.doubleOut(vals[1]) + " m\n"); + currentStream.write(PDFNumber.doubleOut(vals[0]) + + " " + PDFNumber.doubleOut(vals[1]) + " m\n"); break; case PathIterator.SEG_QUADTO: - currentStream.write(pdfNumber.doubleOut(vals[0]) + - " " + pdfNumber.doubleOut(vals[1]) + " " + - pdfNumber.doubleOut(vals[2]) + " " + - pdfNumber.doubleOut(vals[3]) + " y\n"); + currentStream.write(PDFNumber.doubleOut(vals[0]) + + " " + PDFNumber.doubleOut(vals[1]) + " " + + PDFNumber.doubleOut(vals[2]) + " " + + PDFNumber.doubleOut(vals[3]) + " y\n"); break; case PathIterator.SEG_CLOSE: currentStream.write("h\n"); @@ -461,34 +459,32 @@ public class PDFGraphics2D extends AbstractGraphics2D { } protected void writeClip(Shape s) { - PDFNumber pdfNumber = new PDFNumber(); - PathIterator iter = s.getPathIterator(getTransform()); while (!iter.isDone()) { double vals[] = new double[6]; int type = iter.currentSegment(vals); switch (type) { case PathIterator.SEG_CUBICTO: - currentStream.write(pdfNumber.doubleOut(vals[0]) + - " " + pdfNumber.doubleOut(vals[1]) + " " + - pdfNumber.doubleOut(vals[2]) + " " + - pdfNumber.doubleOut(vals[3]) + " " + - pdfNumber.doubleOut(vals[4]) + " " + - pdfNumber.doubleOut(vals[5]) + " c\n"); + currentStream.write(PDFNumber.doubleOut(vals[0]) + + " " + PDFNumber.doubleOut(vals[1]) + " " + + PDFNumber.doubleOut(vals[2]) + " " + + PDFNumber.doubleOut(vals[3]) + " " + + PDFNumber.doubleOut(vals[4]) + " " + + PDFNumber.doubleOut(vals[5]) + " c\n"); break; case PathIterator.SEG_LINETO: - currentStream.write(pdfNumber.doubleOut(vals[0]) + - " " + pdfNumber.doubleOut(vals[1]) + " l\n"); + currentStream.write(PDFNumber.doubleOut(vals[0]) + + " " + PDFNumber.doubleOut(vals[1]) + " l\n"); break; case PathIterator.SEG_MOVETO: - currentStream.write(pdfNumber.doubleOut(vals[0]) + - " " + pdfNumber.doubleOut(vals[1]) + " m\n"); + currentStream.write(PDFNumber.doubleOut(vals[0]) + + " " + PDFNumber.doubleOut(vals[1]) + " m\n"); break; case PathIterator.SEG_QUADTO: - currentStream.write(pdfNumber.doubleOut(vals[0]) + - " " + pdfNumber.doubleOut(vals[1]) + " " + - pdfNumber.doubleOut(vals[2]) + " " + - pdfNumber.doubleOut(vals[3]) + " y\n"); + currentStream.write(PDFNumber.doubleOut(vals[0]) + + " " + PDFNumber.doubleOut(vals[1]) + " " + + PDFNumber.doubleOut(vals[2]) + " " + + PDFNumber.doubleOut(vals[3]) + " y\n"); break; case PathIterator.SEG_CLOSE: currentStream.write("h\n"); @@ -559,7 +555,6 @@ public class PDFGraphics2D extends AbstractGraphics2D { protected void applyStroke(Stroke stroke) { if(stroke instanceof BasicStroke) { BasicStroke bs = (BasicStroke)stroke; - PDFNumber pdfNumber = new PDFNumber(); float[] da = bs.getDashArray(); if(da != null) { @@ -600,10 +595,10 @@ public class PDFGraphics2D extends AbstractGraphics2D { break; } float lw = bs.getLineWidth(); - currentStream.write(pdfNumber.doubleOut(lw) + " w\n"); + currentStream.write(PDFNumber.doubleOut(lw) + " w\n"); float ml = bs.getMiterLimit(); - currentStream.write(pdfNumber.doubleOut(ml) + " M\n"); + currentStream.write(PDFNumber.doubleOut(ml) + " M\n"); } } @@ -706,12 +701,11 @@ public class PDFGraphics2D extends AbstractGraphics2D { trans.translate(x, y); double[] vals = new double[6]; trans.getMatrix(vals); - PDFNumber pdfNumber = new PDFNumber(); - currentStream.write(pdfNumber.doubleOut(vals[0]) + " " + pdfNumber.doubleOut(vals[1]) + " " -+ pdfNumber.doubleOut(vals[2]) + " " + pdfNumber.doubleOut(vals[3]) + " " + pdfNumber.doubleOut(vals[4]) -+ " " + pdfNumber.doubleOut(vals[5]) + " " + - pdfNumber.doubleOut(vals[6]) + " Tm [" + s + "]"); + currentStream.write(PDFNumber.doubleOut(vals[0]) + " " + PDFNumber.doubleOut(vals[1]) + " " ++ PDFNumber.doubleOut(vals[2]) + " " + PDFNumber.doubleOut(vals[3]) + " " + PDFNumber.doubleOut(vals[4]) ++ " " + PDFNumber.doubleOut(vals[5]) + " " + + PDFNumber.doubleOut(vals[6]) + " Tm [" + s + "]"); currentStream.write("ET\n"); } @@ -757,15 +751,14 @@ public class PDFGraphics2D extends AbstractGraphics2D { trans.translate(x, y); double[] vals = new double[6]; trans.getMatrix(vals); - PDFNumber pdfNumber = new PDFNumber(); for(char ch = iterator.first(); ch != CharacterIterator.DONE; ch = iterator.next()) { Map attr = iterator.getAttributes(); - currentStream.write(pdfNumber.doubleOut(vals[0]) + " " + pdfNumber.doubleOut(vals[1]) + " " -+ pdfNumber.doubleOut(vals[2]) + " " + pdfNumber.doubleOut(vals[3]) + " " + pdfNumber.doubleOut(vals[4]) -+ " " + pdfNumber.doubleOut(vals[5]) + " " + - pdfNumber.doubleOut(vals[6]) + " Tm [" + ch + "]"); + currentStream.write(PDFNumber.doubleOut(vals[0]) + " " + PDFNumber.doubleOut(vals[1]) + " " ++ PDFNumber.doubleOut(vals[2]) + " " + PDFNumber.doubleOut(vals[3]) + " " + PDFNumber.doubleOut(vals[4]) ++ " " + PDFNumber.doubleOut(vals[5]) + " " + + PDFNumber.doubleOut(vals[6]) + " Tm [" + ch + "]"); } currentStream.write("ET\n"); @@ -799,34 +792,32 @@ public class PDFGraphics2D extends AbstractGraphics2D { applyPaint(getPaint(), true); - PDFNumber pdfNumber = new PDFNumber(); - PathIterator iter = s.getPathIterator(getTransform()); while (!iter.isDone()) { double vals[] = new double[6]; int type = iter.currentSegment(vals); switch (type) { case PathIterator.SEG_CUBICTO: - currentStream.write(pdfNumber.doubleOut(vals[0]) + - " " + pdfNumber.doubleOut(vals[1]) + " " + - pdfNumber.doubleOut(vals[2]) + " " + - pdfNumber.doubleOut(vals[3]) + " " + - pdfNumber.doubleOut(vals[4]) + " " + - pdfNumber.doubleOut(vals[5]) + " c\n"); + currentStream.write(PDFNumber.doubleOut(vals[0]) + + " " + PDFNumber.doubleOut(vals[1]) + " " + + PDFNumber.doubleOut(vals[2]) + " " + + PDFNumber.doubleOut(vals[3]) + " " + + PDFNumber.doubleOut(vals[4]) + " " + + PDFNumber.doubleOut(vals[5]) + " c\n"); break; case PathIterator.SEG_LINETO: - currentStream.write(pdfNumber.doubleOut(vals[0]) + - " " + pdfNumber.doubleOut(vals[1]) + " l\n"); + currentStream.write(PDFNumber.doubleOut(vals[0]) + + " " + PDFNumber.doubleOut(vals[1]) + " l\n"); break; case PathIterator.SEG_MOVETO: - currentStream.write(pdfNumber.doubleOut(vals[0]) + - " " + pdfNumber.doubleOut(vals[1]) + " m\n"); + currentStream.write(PDFNumber.doubleOut(vals[0]) + + " " + PDFNumber.doubleOut(vals[1]) + " m\n"); break; case PathIterator.SEG_QUADTO: - currentStream.write(pdfNumber.doubleOut(vals[0]) + - " " + pdfNumber.doubleOut(vals[1]) + " " + - pdfNumber.doubleOut(vals[2]) + " " + - pdfNumber.doubleOut(vals[3]) + " y\n"); + currentStream.write(PDFNumber.doubleOut(vals[0]) + + " " + PDFNumber.doubleOut(vals[1]) + " " + + PDFNumber.doubleOut(vals[2]) + " " + + PDFNumber.doubleOut(vals[3]) + " y\n"); break; case PathIterator.SEG_CLOSE: currentStream.write("h\n"); diff --git a/src/org/apache/fop/svg/SVGElement.java b/src/org/apache/fop/svg/SVGElement.java index 0cb0bd45d..08aa8e598 100644 --- a/src/org/apache/fop/svg/SVGElement.java +++ b/src/org/apache/fop/svg/SVGElement.java @@ -1,7 +1,7 @@ /* $Id$ * Copyright (C) 2001 The Apache Software Foundation. All rights reserved. * For details on use and redistribution please refer to the - * LICENSE file included with these sources." + * LICENSE file included with these sources. */ package org.apache.fop.svg; @@ -83,10 +83,6 @@ public class SVGElement extends Svg { throw new FOPException("SVG not in fo:instream-foreign-object"); } - /*if (this.marker == BREAK_AFTER) { - return new Status(Status.OK); - }*/ - if (this.marker == START) { this.fs = area.getFontState();