diff options
author | Vincent Hennebert <vhennebert@apache.org> | 2008-05-09 12:30:40 +0000 |
---|---|---|
committer | Vincent Hennebert <vhennebert@apache.org> | 2008-05-09 12:30:40 +0000 |
commit | 5a0f93d17cc2d4cddca9f9aa0ccde76f52bb08e0 (patch) | |
tree | 94c4b4de9aec33ba9a33602d55821ebb35814f57 /src/java/org/apache/fop/svg | |
parent | 8e7dceedd34226cfe8d6fc922186d5d4c3c6c1e3 (diff) | |
download | xmlgraphics-fop-5a0f93d17cc2d4cddca9f9aa0ccde76f52bb08e0.tar.gz xmlgraphics-fop-5a0f93d17cc2d4cddca9f9aa0ccde76f52bb08e0.zip |
Checkstyle and minor typo fixes
Set svn:keywords and svn:eol-style properties on new files
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@654783 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/fop/svg')
3 files changed, 49 insertions, 49 deletions
diff --git a/src/java/org/apache/fop/svg/PDFDocumentGraphics2D.java b/src/java/org/apache/fop/svg/PDFDocumentGraphics2D.java index 513ba4587..5bdfe8c8d 100644 --- a/src/java/org/apache/fop/svg/PDFDocumentGraphics2D.java +++ b/src/java/org/apache/fop/svg/PDFDocumentGraphics2D.java @@ -56,7 +56,7 @@ public class PDFDocumentGraphics2D extends PDFGraphics2D { private int width; private int height; - + //for SVG scaling private float svgWidth; private float svgHeight; @@ -65,7 +65,7 @@ public class PDFDocumentGraphics2D extends PDFGraphics2D { public static final int NORMAL_PDF_RESOLUTION = 72; /** Default device resolution (300dpi is a resonable quality for most purposes) */ public static final int DEFAULT_NATIVE_DPI = 300; - + /** * The device resolution may be different from the normal target resolution. See * http://issues.apache.org/bugzilla/show_bug.cgi?id=37305 @@ -96,7 +96,7 @@ public class PDFDocumentGraphics2D extends PDFGraphics2D { public PDFDocumentGraphics2D(boolean textAsShapes) { super(textAsShapes); - this.pdfDoc = new PDFDocument("Apache FOP Version " + Version.getVersion() + this.pdfDoc = new PDFDocument("Apache FOP Version " + Version.getVersion() + ": PDFDocumentGraphics2D"); this.pdfContext = new PDFContext(); } @@ -150,7 +150,7 @@ public class PDFDocumentGraphics2D extends PDFGraphics2D { } /** - * Setup a default FontInfo instance if none has been setup before. + * Setup a default FontInfo instance if none has been setup before. */ public void setupDefaultFontInfo() { if (fontInfo == null) { @@ -160,7 +160,7 @@ public class PDFDocumentGraphics2D extends PDFGraphics2D { setFontInfo(fontInfo); } } - + /** * Set the device resolution for rendering. Will take effect at the * start of the next page. @@ -184,7 +184,7 @@ public class PDFDocumentGraphics2D extends PDFGraphics2D { public void setFontInfo(FontInfo fontInfo) { this.fontInfo = fontInfo; } - + /** * Get the font info for this pdf document. * @return the font information @@ -208,7 +208,7 @@ public class PDFDocumentGraphics2D extends PDFGraphics2D { public PDFContext getPDFContext() { return this.pdfContext; } - + /** * Set the dimensions of the svg document that will be drawn. * This is useful if the dimensions of the svg document are different @@ -248,9 +248,9 @@ public class PDFDocumentGraphics2D extends PDFGraphics2D { public void nextPage() { closePage(); } - + /** - * Closes the current page and adds it to the PDF file. + * Closes the current page and adds it to the PDF file. */ protected void closePage() { if (!pdfContext.isPagePending()) { @@ -270,7 +270,7 @@ public class PDFDocumentGraphics2D extends PDFGraphics2D { this.pdfDoc.addObject(pdfContext.getCurrentPage()); pdfContext.clearCurrentPage(); } - + /** {@inheritDoc} */ protected void preparePainting() { if (pdfContext.isPagePending()) { @@ -300,7 +300,7 @@ public class PDFDocumentGraphics2D extends PDFGraphics2D { if (this.initialTransform == null) { //Save initial transformation matrix this.initialTransform = getTransform(); - this.initialClip = getClip(); + this.initialClip = getClip(); } else { //Reset transformation matrix setTransform(this.initialTransform); @@ -313,7 +313,7 @@ public class PDFDocumentGraphics2D extends PDFGraphics2D { if (currentStream == null) { currentStream = new StringWriter(); } - + PDFResources pdfResources = this.pdfDoc.getResources(); PDFPage page = this.pdfDoc.getFactory().makePage(pdfResources, width, height); @@ -321,7 +321,7 @@ public class PDFDocumentGraphics2D extends PDFGraphics2D { pdfContext.setCurrentPage(page); pageRef = page.referencePDF(); - AffineTransform at = new AffineTransform(1.0, 0.0, 0.0, -1.0, + AffineTransform at = new AffineTransform(1.0, 0.0, 0.0, -1.0, 0.0, (double)height); currentStream.write("1 0 0 -1 0 " + height + " cm\n"); if (svgWidth != 0) { @@ -336,7 +336,7 @@ public class PDFDocumentGraphics2D extends PDFGraphics2D { at.scale(s, s); currentStream.write("" + PDFNumber.doubleOut(s) + " 0 0 " + PDFNumber.doubleOut(s) + " 0 0 cm\n"); - + scale(1 / s, 1 / s); } // Remember the transform we installed. @@ -344,8 +344,8 @@ public class PDFDocumentGraphics2D extends PDFGraphics2D { pdfContext.increasePageCount(); } - - + + /** * The rendering process has finished. * This should be called after the rendering has completed as there is diff --git a/src/java/org/apache/fop/svg/PDFDocumentGraphics2DConfigurator.java b/src/java/org/apache/fop/svg/PDFDocumentGraphics2DConfigurator.java index 789a7c247..cda1478bb 100644 --- a/src/java/org/apache/fop/svg/PDFDocumentGraphics2DConfigurator.java +++ b/src/java/org/apache/fop/svg/PDFDocumentGraphics2DConfigurator.java @@ -44,23 +44,23 @@ public class PDFDocumentGraphics2DConfigurator { * @param cfg the configuration * @throws ConfigurationException if an error occurs while configuring the object */ - public void configure(PDFDocumentGraphics2D graphics, Configuration cfg) + public void configure(PDFDocumentGraphics2D graphics, Configuration cfg) throws ConfigurationException { PDFDocument pdfDoc = graphics.getPDFDocument(); - + //Filter map pdfDoc.setFilterMap( PDFRendererConfigurator.buildFilterMapFromConfiguration(cfg)); - + //Fonts try { FontResolver fontResolver = FontManager.createMinimalFontResolver(); //TODO The following could be optimized by retaining the FontManager somewhere FontManager fontManager = new FontManager(); - + //TODO Make use of fontBaseURL, font substitution and referencing configuration //Requires a change to the expected configuration layout - + List/*<EmbedFontInfo>*/ embedFontInfoList = PrintRendererConfigurator.buildFontListFromConfiguration( cfg, fontResolver, false, fontManager); @@ -74,5 +74,5 @@ public class PDFDocumentGraphics2DConfigurator { throw new ConfigurationException("Error while setting up fonts", e); } } - + } diff --git a/src/java/org/apache/fop/svg/PDFGraphics2D.java b/src/java/org/apache/fop/svg/PDFGraphics2D.java index 5a147f3be..4d1ee6a6d 100644 --- a/src/java/org/apache/fop/svg/PDFGraphics2D.java +++ b/src/java/org/apache/fop/svg/PDFGraphics2D.java @@ -106,13 +106,13 @@ import org.apache.fop.util.ColorExt; public class PDFGraphics2D extends AbstractGraphics2D { private static final AffineTransform IDENTITY_TRANSFORM = new AffineTransform(); - - /** The number of decimal places. */ + + /** The number of decimal places. */ private static final int DEC = 8; /** Convenience constant for full opacity */ static final int OPAQUE = 255; - + /** * the PDF Document being created */ @@ -308,7 +308,7 @@ public class PDFGraphics2D extends AbstractGraphics2D { public String getPageReference() { return this.pageRef; } - + /** * Set the Graphics context. * @param c the graphics context to use @@ -319,10 +319,10 @@ public class PDFGraphics2D extends AbstractGraphics2D { } private void setPrivateHints() { - setRenderingHint(RenderingHintsKeyExt.KEY_AVOID_TILE_PAINTING, + setRenderingHint(RenderingHintsKeyExt.KEY_AVOID_TILE_PAINTING, RenderingHintsKeyExt.VALUE_AVOID_TILE_PAINTING_ON); } - + /** * Set the override font state for drawing text. * This is used by the PDF text painter so that it can temporarily @@ -362,7 +362,7 @@ public class PDFGraphics2D extends AbstractGraphics2D { concatMatrix(matrix); } } - + /** * This is mainly used for shading patterns which use the document-global coordinate system * instead of the local one. @@ -372,7 +372,7 @@ public class PDFGraphics2D extends AbstractGraphics2D { AffineTransform at = new AffineTransform(graphicsState.getTransform()); return at; } - + /** * This is a pdf specific method used to add a link to the * pdf document. @@ -417,7 +417,7 @@ public class PDFGraphics2D extends AbstractGraphics2D { * @param width the width to draw the image * @param height the height to draw the image */ - void addNativeImage(org.apache.xmlgraphics.image.loader.Image image, float x, float y, + void addNativeImage(org.apache.xmlgraphics.image.loader.Image image, float x, float y, float width, float height) { preparePainting(); String key = image.getInfo().getOriginalURI(); @@ -425,10 +425,10 @@ public class PDFGraphics2D extends AbstractGraphics2D { // Need to include hash code as when invoked from FO you // may have several 'independent' PDFGraphics2D so the // count is not enough. - key = "__AddNative_" + hashCode() + "_" + nativeCount; + key = "__AddNative_" + hashCode() + "_" + nativeCount; nativeCount++; } - + PDFImage pdfImage; if (image instanceof ImageRawJPEG) { pdfImage = new ImageRawJPEGAdapter((ImageRawJPEG)image, key); @@ -438,7 +438,7 @@ public class PDFGraphics2D extends AbstractGraphics2D { throw new IllegalArgumentException( "Unsupported Image subclass: " + image.getClass().getName()); } - + PDFXObject xObject = this.pdfDoc.addImage(resourceContext, pdfImage); if (outputStream != null) { try { @@ -649,7 +649,7 @@ public class PDFGraphics2D extends AbstractGraphics2D { graphicsState.pop(); } } - + /* // in theory we could set the clip using these methods // it doesn't seem to improve the file sizes much @@ -784,8 +784,8 @@ public class PDFGraphics2D extends AbstractGraphics2D { (float) gpaint.getPoint1().getX(), (float) gpaint.getPoint1().getY(), (float) gpaint.getPoint2().getX(), - (float) gpaint.getPoint2().getY(), - new float[] {0, 1}, + (float) gpaint.getPoint2().getY(), + new float[] {0, 1}, new Color[] {gpaint.getColor1(), gpaint.getColor2()}, gpaint.isCyclic() ? LinearGradientPaint.REPEAT : LinearGradientPaint.NO_CYCLE); } @@ -927,7 +927,7 @@ public class PDFGraphics2D extends AbstractGraphics2D { return false; // PDF can't do alpha } - someColors.add(new PDFColor(cc.getRed(), cc.getGreen(), + someColors.add(new PDFColor(cc.getRed(), cc.getGreen(), cc.getBlue())); } @@ -947,7 +947,7 @@ public class PDFGraphics2D extends AbstractGraphics2D { currentStream.write(myPat.getColorSpaceOut(fill)); return true; - } + } if (paint instanceof PatternPaint) { PatternPaint pp = (PatternPaint)paint; return createPattern(pp, fill); @@ -990,14 +990,14 @@ public class PDFGraphics2D extends AbstractGraphics2D { // double patMaxX = rect.getX() + rect.getWidth(); // double patMaxY = rect.getY() + rect.getHeight(); // double stepX = rect.getWidth(); - // double stepY = rect.getHeight(); - // + // double stepY = rect.getHeight(); + // // int startX = (int)((rect.getX() - gnMaxX)/stepX); // int startY = (int)((rect.getY() - gnMaxY)/stepY); - // + // // int endX = (int)((patMaxX - gnMinX)/stepX); // int endY = (int)((patMaxY - gnMinY)/stepY); - // + // // pattGraphic.translate(startX*stepX, startY*stepY); // for (int yIdx=startY; yIdx<=endY; yIdx++) { // for (int xIdx=startX; xIdx<=endX; xIdx++) { @@ -1027,14 +1027,14 @@ public class PDFGraphics2D extends AbstractGraphics2D { } /** @todo see if pdfDoc and res can be linked here, - (currently res <> PDFDocument's resources) so addFonts() + (currently res <> PDFDocument's resources) so addFonts() can be moved to PDFDocument class */ res.addFonts(pdfDoc, specialFontInfo); PDFPattern myPat = pdfDoc.getFactory().makePattern( resourceContext, 1, res, 1, 1, bbox, rect.getWidth(), rect.getHeight(), - theMatrix, null, + theMatrix, null, pattGraphic.getBuffer()); currentStream.write(myPat.getColorSpaceOut(fill)); @@ -1094,7 +1094,7 @@ public class PDFGraphics2D extends AbstractGraphics2D { (rgbCS, 32, 0x00FF0000, 0x0000FF00, 0x000000FF, 0xFF000000, false, DataBuffer.TYPE_BYTE); - PaintContext pctx = paint.createContext(rgbCM, devBounds, usrBounds, + PaintContext pctx = paint.createContext(rgbCM, devBounds, usrBounds, at, getRenderingHints()); PDFXObject imageInfo = pdfDoc.getXObject ("TempImage:" + pctx.toString()); @@ -1112,7 +1112,7 @@ public class PDFGraphics2D extends AbstractGraphics2D { final int[] line = new int[devW]; final byte[] mask; int x, y, val, rgbIdx = 0; - + if (pcm.hasAlpha()) { mask = new byte[devW * devH]; int maskIdx = 0; @@ -1611,7 +1611,7 @@ public class PDFGraphics2D extends AbstractGraphics2D { return; } } - + AffineTransform trans = getTransform(); double[] tranvals = new double[6]; trans.getMatrix(tranvals); @@ -1709,7 +1709,7 @@ public class PDFGraphics2D extends AbstractGraphics2D { iter.next(); } } - + /** * Do the PDF drawing command. * This does the PDF drawing command according to fill |