diff options
author | Mehdi Houshmand <mehdi@apache.org> | 2012-06-11 14:18:30 +0000 |
---|---|---|
committer | Mehdi Houshmand <mehdi@apache.org> | 2012-06-11 14:18:30 +0000 |
commit | 991d69ab0cb29b8efe1fa3efc72ef16a1065e450 (patch) | |
tree | 3c3e68d4b10ede8e4a0af5a836f5fa9d3be8ee63 /src/java/org/apache/fop/pdf | |
parent | eccd73c523bdda6a0634e9849141492f7b14ad63 (diff) | |
parent | e7181a7fdfa0336e688d8ed9e27f0304c741d7d2 (diff) | |
download | xmlgraphics-fop-991d69ab0cb29b8efe1fa3efc72ef16a1065e450.tar.gz xmlgraphics-fop-991d69ab0cb29b8efe1fa3efc72ef16a1065e450.zip |
Merge in trunk@1345838
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_URI_Unification@1348858 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/fop/pdf')
-rw-r--r-- | src/java/org/apache/fop/pdf/PDFColor.java | 2 | ||||
-rw-r--r-- | src/java/org/apache/fop/pdf/PDFEmbeddedFile.java | 5 | ||||
-rw-r--r-- | src/java/org/apache/fop/pdf/PDFObject.java | 6 | ||||
-rw-r--r-- | src/java/org/apache/fop/pdf/PDFResources.java | 52 |
4 files changed, 28 insertions, 37 deletions
diff --git a/src/java/org/apache/fop/pdf/PDFColor.java b/src/java/org/apache/fop/pdf/PDFColor.java index 8eea7e390..1fb544368 100644 --- a/src/java/org/apache/fop/pdf/PDFColor.java +++ b/src/java/org/apache/fop/pdf/PDFColor.java @@ -30,7 +30,7 @@ import org.apache.xmlgraphics.java2d.color.DeviceCMYKColorSpace; * image. And in this context, only RGB and Gray values are used. * <p> * Use of this class is discouraged. {@link PDFColorHandler} is now used for in-content color - * selection. For masked bitmaps, it may be wiser to switch to {@link Color} in the long run. + * selection. For masked bitmaps, it may be wiser to switch to {@link java.awt.Color} in the long run. */ public class PDFColor extends PDFPathPaint { // could be 3.0 as well. diff --git a/src/java/org/apache/fop/pdf/PDFEmbeddedFile.java b/src/java/org/apache/fop/pdf/PDFEmbeddedFile.java index dc0681405..ae6893944 100644 --- a/src/java/org/apache/fop/pdf/PDFEmbeddedFile.java +++ b/src/java/org/apache/fop/pdf/PDFEmbeddedFile.java @@ -38,7 +38,10 @@ public class PDFEmbeddedFile extends PDFStream { put("Params", params); } - /** {@inheritDoc} */ + /** + * Determine if should encode on the fly. + * @return true if should encode on the fly + */ protected boolean isEncodingOnTheFly() { //Acrobat doesn't like an indirect /Length object in this case, //but only when the embedded file is a PDF file. diff --git a/src/java/org/apache/fop/pdf/PDFObject.java b/src/java/org/apache/fop/pdf/PDFObject.java index 1b9c4eea7..e0f950154 100644 --- a/src/java/org/apache/fop/pdf/PDFObject.java +++ b/src/java/org/apache/fop/pdf/PDFObject.java @@ -22,7 +22,6 @@ package org.apache.fop.pdf; // Java import java.io.IOException; import java.io.OutputStream; -import java.io.Writer; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -211,11 +210,6 @@ public abstract class PDFObject implements PDFWritable { } /** {@inheritDoc} */ - public void outputInline(OutputStream out, Writer writer) throws IOException { - throw new UnsupportedOperationException("Don't use anymore: " + getClass().getName()); - } - - /** {@inheritDoc} */ public void outputInline(OutputStream out, StringBuilder textBuffer) throws IOException { if (hasObjectNumber()) { textBuffer.append(referencePDF()); diff --git a/src/java/org/apache/fop/pdf/PDFResources.java b/src/java/org/apache/fop/pdf/PDFResources.java index c625813b0..e7dcccabe 100644 --- a/src/java/org/apache/fop/pdf/PDFResources.java +++ b/src/java/org/apache/fop/pdf/PDFResources.java @@ -21,7 +21,8 @@ package org.apache.fop.pdf; import java.io.IOException; import java.io.OutputStream; -import java.util.Iterator; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; import java.util.LinkedHashMap; import java.util.LinkedHashSet; import java.util.Map; @@ -46,33 +47,33 @@ public class PDFResources extends PDFDictionary { /** * /Font objects keyed by their internal name */ - protected Map fonts = new LinkedHashMap(); + protected Map<String, PDFFont> fonts = new LinkedHashMap<String, PDFFont>(); /** * Set of XObjects */ - protected Set xObjects = new LinkedHashSet(); + protected Set<PDFXObject> xObjects = new LinkedHashSet<PDFXObject>(); /** * Set of patterns */ - protected Set patterns = new LinkedHashSet(); + protected Set<PDFPattern> patterns = new LinkedHashSet<PDFPattern>(); /** * Set of shadings */ - protected Set shadings = new LinkedHashSet(); + protected Set<PDFShading> shadings = new LinkedHashSet<PDFShading>(); /** * Set of ExtGStates */ - protected Set gstates = new LinkedHashSet(); + protected Set<PDFGState> gstates = new LinkedHashSet<PDFGState>(); /** Map of color spaces (key: color space name) */ - protected Map colorSpaces = new LinkedHashMap(); + protected Map<PDFName, PDFColorSpace> colorSpaces = new LinkedHashMap<PDFName, PDFColorSpace>(); /** Map of ICC color spaces (key: ICC profile description) */ - protected Map iccColorSpaces = new LinkedHashMap(); + protected Map<String, PDFICCBasedColorSpace> iccColorSpaces = new LinkedHashMap<String, PDFICCBasedColorSpace>(); /** * create a /Resources object. @@ -168,7 +169,7 @@ public class PDFResources extends PDFDictionary { PDFICCBasedColorSpace icc = (PDFICCBasedColorSpace)colorSpace; String desc = ColorProfileUtil.getICCProfileDescription( icc.getICCStream().getICCProfile()); - this.iccColorSpaces.put(desc, colorSpace); + this.iccColorSpaces.put(desc, icc); } } @@ -178,7 +179,7 @@ public class PDFResources extends PDFDictionary { * @return the requested color space or null if it wasn't found */ public PDFICCBasedColorSpace getICCColorSpaceByProfileName(String desc) { - PDFICCBasedColorSpace cs = (PDFICCBasedColorSpace)this.iccColorSpaces.get(desc); + PDFICCBasedColorSpace cs = this.iccColorSpaces.get(desc); return cs; } @@ -188,7 +189,7 @@ public class PDFResources extends PDFDictionary { * @return the requested color space or null if it wasn't found */ public PDFColorSpace getColorSpace(PDFName name) { - PDFColorSpace cs = (PDFColorSpace)this.colorSpaces.get(name); + PDFColorSpace cs = this.colorSpaces.get(name); return cs; } @@ -202,28 +203,24 @@ public class PDFResources extends PDFDictionary { if (!this.fonts.isEmpty()) { PDFDictionary dict = new PDFDictionary(this); /* construct PDF dictionary of font object references */ - Iterator fontIterator = this.fonts.keySet().iterator(); - while (fontIterator.hasNext()) { - String fontName = (String)fontIterator.next(); - dict.put(fontName, this.fonts.get(fontName)); + for (Map.Entry<String, PDFFont> entry : fonts.entrySet()) { + dict.put(entry.getKey(), entry.getValue()); } put("Font", dict); } if (!this.shadings.isEmpty()) { PDFDictionary dict = new PDFDictionary(this); - for (Iterator iter = shadings.iterator(); iter.hasNext();) { - PDFShading currentShading = (PDFShading)iter.next(); - dict.put(currentShading.getName(), currentShading); + for (PDFShading shading : shadings) { + dict.put(shading.getName(), shading); } put("Shading", dict); } if (!this.patterns.isEmpty()) { PDFDictionary dict = new PDFDictionary(this); - for (Iterator iter = patterns.iterator(); iter.hasNext();) { - PDFPattern currentPattern = (PDFPattern)iter.next(); - dict.put(currentPattern.getName(), currentPattern); + for (PDFPattern pattern : patterns) { + dict.put(pattern.getName(), pattern); } put("Pattern", dict); } @@ -237,26 +234,23 @@ public class PDFResources extends PDFDictionary { if (this.xObjects != null && !this.xObjects.isEmpty()) { PDFDictionary dict = new PDFDictionary(this); - for (Iterator iter = xObjects.iterator(); iter.hasNext();) { - PDFXObject xobj = (PDFXObject)iter.next(); - dict.put(xobj.getName().toString(), xobj); + for (PDFXObject xObject : xObjects) { + dict.put(xObject.getName().toString(), xObject); } put("XObject", dict); } if (!this.gstates.isEmpty()) { PDFDictionary dict = new PDFDictionary(this); - for (Iterator iter = gstates.iterator(); iter.hasNext();) { - PDFGState gs = (PDFGState)iter.next(); - dict.put(gs.getName(), gs); + for (PDFGState gstate : gstates) { + dict.put(gstate.getName(), gstate); } put("ExtGState", dict); } if (!this.colorSpaces.isEmpty()) { PDFDictionary dict = new PDFDictionary(this); - for (Iterator iter = colorSpaces.values().iterator(); iter.hasNext();) { - PDFColorSpace colorSpace = (PDFColorSpace)iter.next(); + for (PDFColorSpace colorSpace : colorSpaces.values()) { dict.put(colorSpace.getName(), colorSpace); } put("ColorSpace", dict); |