diff options
author | arved <arved@unknown> | 2000-03-22 10:40:33 +0000 |
---|---|---|
committer | arved <arved@unknown> | 2000-03-22 10:40:33 +0000 |
commit | 77ac80a8c8d401436699dba82009c8c0da99bc85 (patch) | |
tree | c2737a1c752ecc44de5007445969ce28930c6eee /src/org/apache/fop/pdf/PDFResources.java | |
parent | 19382bf6b07da6f3fce1ef74d9402cc99193de0d (diff) | |
download | xmlgraphics-fop-77ac80a8c8d401436699dba82009c8c0da99bc85.tar.gz xmlgraphics-fop-77ac80a8c8d401436699dba82009c8c0da99bc85.zip |
ADD: Support for shading, patterns...
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@193311 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/org/apache/fop/pdf/PDFResources.java')
-rw-r--r-- | src/org/apache/fop/pdf/PDFResources.java | 75 |
1 files changed, 63 insertions, 12 deletions
diff --git a/src/org/apache/fop/pdf/PDFResources.java b/src/org/apache/fop/pdf/PDFResources.java index 0425f2c3b..8d5281349 100644 --- a/src/org/apache/fop/pdf/PDFResources.java +++ b/src/org/apache/fop/pdf/PDFResources.java @@ -67,8 +67,9 @@ public class PDFResources extends PDFObject { /** /Font objects keyed by their internal name */ protected Hashtable fonts = new Hashtable(); - protected Vector xObjects; - + protected Vector xObjects=null; + protected Vector patterns= new Vector(); + protected Vector shadings=new Vector(); /** * create a /Resources object. * @@ -77,7 +78,8 @@ public class PDFResources extends PDFObject { public PDFResources(int number) { /* generic creation of object */ - super(number); + super(number); + } /** @@ -88,7 +90,14 @@ public class PDFResources extends PDFObject { public void addFont(PDFFont font) { this.fonts.put(font.getName(),font); } - + + public void addShading(PDFShading theShading){ + this.shadings.addElement(theShading); + } + + public void addPattern(PDFPattern thePattern){ + this.patterns.addElement(thePattern); + } public void setXObjects(Vector xObjects) { this.xObjects = xObjects; } @@ -107,16 +116,58 @@ public class PDFResources extends PDFObject { p.append("/Font << "); /* construct PDF dictionary of font object references */ - Enumeration fontEnumeration = fonts.keys(); + Enumeration fontEnumeration = this.fonts.keys(); while (fontEnumeration.hasMoreElements()) { String fontName = (String) fontEnumeration.nextElement(); - p = p.append("/" + fontName + " " - + ((PDFFont) fonts.get(fontName)).referencePDF() - + "\n"); + p.append("/" + fontName + " " + + ((PDFFont) this.fonts.get(fontName)).referencePDF() + + " "); } - p = p.append(">>\n"); + p.append(">> \n"); + } + + PDFShading currentShading = null; + if(!this.shadings.isEmpty()) + { + p.append("/Shading << "); + + for(int currentShadingNumber=0; + currentShadingNumber < this.shadings.size(); + currentShadingNumber++) + { + currentShading = ((PDFShading)this.shadings.elementAt(currentShadingNumber)); + + p.append("/" + currentShading.getName() + " " + + currentShading.referencePDF() + + " "); // \n ?????? + } + + p.append(">> \n"); + } + //"free" the memory. Sorta. + currentShading = null; + + PDFPattern currentPattern=null; + if(!this.patterns.isEmpty()) + { + p.append("/Pattern << "); + + for(int currentPatternNumber=0; + currentPatternNumber < this.patterns.size(); + currentPatternNumber++) + { + currentPattern = ((PDFPattern)this.patterns.elementAt(currentPatternNumber)); + + p.append("/" + currentPattern.getName() + " " + + currentPattern.referencePDF() + + " "); + } + + p.append(">> \n"); } + //"free" the memory. Sorta. + currentPattern = null; p.append("/ProcSet [ /PDF /ImageC /Text ] "); @@ -133,8 +184,8 @@ public class PDFResources extends PDFObject { } } - p = p.append(">>\nendobj\n"); + p = p.append(">> \nendobj\n"); - return p.toString(); - } + return p.toString(); + } } |