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 2003/01/11 20:38:54 UTC

cvs commit: xml-fop/src/org/apache/fop/pdf BitmapImage.java DCTFilter.java InMemoryStreamCache.java PDFCIDFontDescriptor.java PDFCIDSystemInfo.java PDFCMap.java PDFCharProcs.java PDFColor.java PDFColorSpace.java PDFDocument.java PDFEncoding.java PDFFileSpec.java PDFFilter.java PDFFilterException.java PDFFormXObject.java PDFFunction.java PDFGoTo.java PDFGoToRemote.java PDFImage.java PDFInfo.java PDFInternalLink.java PDFNumber.java PDFObject.java PDFOutline.java PDFPage.java PDFPages.java PDFPathPaint.java PDFPattern.java PDFRectangle.java PDFResourceContext.java PDFResources.java PDFRoot.java PDFShading.java PDFState.java PDFStream.java PDFUri.java StreamCache.java TempFileStreamCache.java TransitionDictionary.java

keiron      2003/01/11 11:38:54

  Modified:    src/org/apache/fop/pdf BitmapImage.java DCTFilter.java
                        InMemoryStreamCache.java PDFCIDFontDescriptor.java
                        PDFCIDSystemInfo.java PDFCMap.java
                        PDFCharProcs.java PDFColor.java PDFColorSpace.java
                        PDFDocument.java PDFEncoding.java PDFFileSpec.java
                        PDFFilter.java PDFFilterException.java
                        PDFFormXObject.java PDFFunction.java PDFGoTo.java
                        PDFGoToRemote.java PDFImage.java PDFInfo.java
                        PDFInternalLink.java PDFNumber.java PDFObject.java
                        PDFOutline.java PDFPage.java PDFPages.java
                        PDFPathPaint.java PDFPattern.java PDFRectangle.java
                        PDFResourceContext.java PDFResources.java
                        PDFRoot.java PDFShading.java PDFState.java
                        PDFStream.java PDFUri.java StreamCache.java
                        TempFileStreamCache.java TransitionDictionary.java
  Log:
  cleaned up some style errors
  
  Revision  Changes    Path
  1.4       +2 -2      xml-fop/src/org/apache/fop/pdf/BitmapImage.java
  
  Index: BitmapImage.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/pdf/BitmapImage.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- BitmapImage.java	22 Nov 2002 10:32:20 -0000	1.3
  +++ BitmapImage.java	11 Jan 2003 19:38:51 -0000	1.4
  @@ -1,6 +1,6 @@
   /*
    * $Id$
  - * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
  + * Copyright (C) 2001-2003 The Apache Software Foundation. All rights reserved.
    * For details on use and redistribution please refer to the
    * LICENSE file included with these sources.
    */
  
  
  
  1.5       +20 -2     xml-fop/src/org/apache/fop/pdf/DCTFilter.java
  
  Index: DCTFilter.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/pdf/DCTFilter.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- DCTFilter.java	29 Nov 2002 23:18:56 -0000	1.4
  +++ DCTFilter.java	11 Jan 2003 19:38:51 -0000	1.5
  @@ -1,6 +1,6 @@
   /*
    * $Id$
  - * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
  + * Copyright (C) 2001-2003 The Apache Software Foundation. All rights reserved.
    * For details on use and redistribution please refer to the
    * LICENSE file included with these sources.
    */
  @@ -22,14 +22,32 @@
    * @author Eric Dalquist
    */
   public class DCTFilter extends PDFFilter {
  +
  +    /**
  +     * Get filter name.
  +     * @return the pdf name for the DCT filter
  +     */
       public String getName() {
           return "/DCTDecode";
       }
   
  +    /**
  +     * Get the decode params for this filter.
  +     * @return the DCT filter has no decode params
  +     */
       public String getDecodeParms() {
           return null;
       }
   
  +    /**
  +     * Encode a stream with this filter.
  +     * Currently no encoding is performed, it is assumed that the data
  +     * is already encoded.
  +     * @param in the input data stream
  +     * @param out the output stream
  +     * @param length the length of the data
  +     * @throws IOException if there is an io error
  +     */
       public void encode(InputStream in, OutputStream out, int length) throws IOException {
           StreamUtilities.streamCopy(in, out, length);
           out.close();
  
  
  
  1.2       +20 -7     xml-fop/src/org/apache/fop/pdf/InMemoryStreamCache.java
  
  Index: InMemoryStreamCache.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/pdf/InMemoryStreamCache.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- InMemoryStreamCache.java	27 May 2002 10:59:07 -0000	1.1
  +++ InMemoryStreamCache.java	11 Jan 2003 19:38:51 -0000	1.2
  @@ -9,7 +9,6 @@
   
   import java.io.ByteArrayOutputStream;
   import java.io.ByteArrayInputStream;
  -import java.io.InputStream;
   import java.io.OutputStream;
   import java.io.IOException;
   
  @@ -32,19 +31,25 @@
       /**
        * Get the current OutputStream. Do not store it - it may change
        * from call to call.
  +     * @throws IOException if there is an error getting the output stream
  +     * @return the output stream containing the data
        */
       public OutputStream getOutputStream() throws IOException {
  -        if (output == null)
  +        if (output == null) {
               output = new ByteArrayOutputStream();
  +        }
           return output;
       }
   
       /**
        * Filter the cache with the supplied PDFFilter.
  +     * @param filter the filter to apply
  +     * @throws IOException if an IO error occurs
        */
       public void applyFilter(PDFFilter filter) throws IOException {
  -        if (output == null)
  +        if (output == null) {
               return;
  +        }
   
           output.close();
   
  @@ -64,26 +69,33 @@
   
       /**
        * Outputs the cached bytes to the given stream.
  +     * @param stream the output stream to write to
  +     * @throws IOException if there is an IO error writing to the output stream
        */
       public void outputStreamData(OutputStream stream) throws IOException {
  -        if (output == null)
  +        if (output == null) {
               return;
  +        }
   
           output.writeTo(stream);
       }
   
       /**
        * Returns the current size of the stream.
  +     * @throws IOException if there is an error getting the size
  +     * @return the length of the stream
        */
       public int getSize() throws IOException {
  -        if (output == null)
  +        if (output == null) {
               return 0;
  -        else
  +        } else {
               return output.size();
  +        }
       }
   
       /**
        * Closes the cache and frees resources.
  +     * @throws IOException if there is an error closing the stream
        */
       public void close() throws IOException {
           if (output != null) {
  @@ -94,6 +106,7 @@
   
       /**
        * Clears and resets the cache.
  +     * @throws IOException if there is an error closing the stream
        */
       public void reset() throws IOException {
           if (output != null) {
  
  
  
  1.4       +19 -3     xml-fop/src/org/apache/fop/pdf/PDFCIDFontDescriptor.java
  
  Index: PDFCIDFontDescriptor.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/pdf/PDFCIDFontDescriptor.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- PDFCIDFontDescriptor.java	30 Jul 2001 20:29:29 -0000	1.3
  +++ PDFCIDFontDescriptor.java	11 Jan 2003 19:38:52 -0000	1.4
  @@ -1,6 +1,6 @@
   /*
    * $Id$
  - * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
  + * Copyright (C) 2001-2003 The Apache Software Foundation. All rights reserved.
    * For details on use and redistribution please refer to the
    * LICENSE file included with these sources.
    */
  @@ -16,7 +16,14 @@
    */
   public class PDFCIDFontDescriptor extends PDFFontDescriptor {
   
  +    /**
  +     * The language for the font
  +     */
       protected String lang;
  +
  +    /**
  +     * The cid set stream
  +     */
       protected PDFStream cidSet;
   
       /**
  @@ -41,10 +48,19 @@
           this.lang = lang;
       }
   
  +    /**
  +     * Set the CID set stream.
  +     * @param cidSet the pdf stream cotnaining the CID set
  +     */
       public void setCIDSet(PDFStream cidSet) {
           this.cidSet = cidSet;
       }
   
  +    /**
  +     * Fill in the pdf data for this font descriptor.
  +     * The charset specific dictionary entries are output.
  +     * @param p the string buffer to append the data
  +     */
       protected void fillInPDF(StringBuffer p) {
           p.append("\n/MissingWidth 500\n");
           if (lang != null) {
  @@ -53,7 +69,7 @@
           }
           if (cidSet != null) {
               p.append("\n/CIDSet /");
  -            this.cidSet.referencePDF();
  +            p.append(this.cidSet.referencePDF());
           }
       }
   
  
  
  
  1.4       +18 -5     xml-fop/src/org/apache/fop/pdf/PDFCIDSystemInfo.java
  
  Index: PDFCIDSystemInfo.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/pdf/PDFCIDSystemInfo.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- PDFCIDSystemInfo.java	11 Dec 2001 12:11:00 -0000	1.3
  +++ PDFCIDSystemInfo.java	11 Jan 2003 19:38:52 -0000	1.4
  @@ -1,6 +1,6 @@
   /*
    * $Id$
  - * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
  + * Copyright (C) 2001-2003 The Apache Software Foundation. All rights reserved.
    * For details on use and redistribution please refer to the
    * LICENSE file included with these sources.
    */
  @@ -15,10 +15,17 @@
    * this small object is used in the CID fonts and in the CMaps.
    */
   public class PDFCIDSystemInfo extends PDFObject {
  -    protected String registry;
  -    protected String ordering;
  -    protected int supplement;
  +    private String registry;
  +    private String ordering;
  +    private int supplement;
   
  +    /**
  +     * Create a CID system info.
  +     *
  +     * @param registry the registry value
  +     * @param ordering the ordering value
  +     * @param supplement the supplement value
  +     */
       public PDFCIDSystemInfo(String registry, String ordering,
                               int supplement) {
           this.registry = registry;
  @@ -38,6 +45,12 @@
           return toPDFString().getBytes();
       }
   
  +    /**
  +     * Create a string for the CIDSystemInfo dictionary.
  +     * The entries are placed as an inline dictionary.
  +     *
  +     * @return the string for the CIDSystemInfo entry with the inline dictionary
  +     */
       public String toPDFString() {
           StringBuffer p = new StringBuffer();
           p.setLength(0);
  
  
  
  1.5       +263 -11   xml-fop/src/org/apache/fop/pdf/PDFCMap.java
  
  Index: PDFCMap.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/pdf/PDFCMap.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- PDFCMap.java	25 Oct 2002 09:29:45 -0000	1.4
  +++ PDFCMap.java	11 Jan 2003 19:38:52 -0000	1.5
  @@ -8,79 +8,322 @@
   package org.apache.fop.pdf;
   
   /**
  - * class representing the CMap encodings.
  + * Class representing the CMap encodings.
    *
  - * CMaps are defined on page 215 and onwards.
  - * The predefined CMap names are drawn from Table 7.20
  - * on pages 215, 216 and 217 .
  + * CMaps are defined in the "Predefined CJK CMap names" table.
  + * In section 5.6.4 of PDF reference 1.4.
    */
   public class PDFCMap extends PDFStream {
   
  -    /**
  +    /*
        * Chinese (simplified)
        */
  +
  +    /**
  +     * GB-EUC-H Microsoft Code Page 936 (lfCharSet 0x86), GB 2312-80
  +     * character set, EUC-CN encoding
  +     */
       public static final String GB_EUC_H = "GB-EUC-H";
  +
  +    /**
  +     * GB-EUC-V Vertical version of GB-EUC-H
  +     */
       public static final String GB_EUC_V = "GB_EUC_V";
  +
  +    /**
  +     * GBpc-EUC-H Mac OS, GB 2312-80 character set, EUC-CN encoding, Script Manager code 19
  +     */
       public static final String GBpc_EUC_H = "GBpc-EUC-H";
  +
  +    /**
  +     * GBpc-EUC-V Vertical version of GBpc-EUC-H
  +     */
       public static final String GBpc_EUC_V = "GBpc-EUC-V";
  +
  +    /**
  +     * GBK-EUC-H Microsoft Code Page 936 (lfCharSet 0x86), GBK character set, GBK encoding
  +     */
       public static final String GBK_EUC_H = "GBK-EUC-H";
  +
  +    /**
  +     * GBK-EUC-V Vertical version of GBK-EUC-H
  +     */
       public static final String GBK_EUC_V = "GBK-EUC-V";
  +
  +    /**
  +     * GBKp-EUC-H Same as GBK-EUC-H, but replaces half-width
  +     * Latin characters with proportional forms and maps character
  +     * code 0x24 to a dollar sign ($) instead of a yuan symbol
  +     */
  +    public static final String GBKp_EUC_H = "GBKp-EUC-H";
  +
  +    /**
  +     * GBKp-EUC-V Vertical version of GBKp-EUC-H
  +     */
  +    public static final String GBKp_EUC_V = "GBKp-EUC-V";
  +
  +    /**
  +     * GBK2K-H GB 18030-2000 character set, mixed 1-, 2-, and 4-byte encoding
  +     */
  +    public static final String GBK2K_H = "GBK2K-H";
  +
  +    /**
  +     * GBK2K-V Vertical version of GBK2K-H
  +     */
  +    public static final String GBK2K_V = "GBK2K-V";
  +
  +    /**
  +     * UniGB-UCS2-H Unicode (UCS-2) encoding for the Adobe-GB1 character collection
  +     */
       public static final String UniGB_UCS2_H = "UniGB-UCS2-H";
  +
  +    /**
  +     * UniGB-UCS2-V Vertical version of UniGB-UCS2-H
  +     */
       public static final String UniGB_UCS2_V = "UniGB-UCS2-V";
   
  +
  +    /*
  +     * Chinese (Traditional)
  +     */
  +
       /**
  -     * Chinese (traditional)
  +     * B5pc-H Mac OS, Big Five character set, Big Five encoding, Script Manager code 2
        */
       public static final String B5pc_H = "B5pc-H";
  +
  +    /**
  +     * B5pc-V Vertical version of B5pc-H
  +     */
       public static final String B5pc_V = "B5pc-V";
  +
  +    /**
  +     * HKscs-B5-H Hong Kong SCS, an extension to the Big Five
  +     * character set and encoding
  +     */
  +    public static final String HKscs_B5_H = "HKscs-B5-H";
  +
  +    /**
  +     * HKscs-B5-V Vertical version of HKscs-B5-H
  +     */
  +    public static final String HKscs_B5_V = "HKscs-B5-V";
  +
  +    /**
  +     * ETen-B5-H Microsoft Code Page 950 (lfCharSet 0x88), Big Five
  +     * character set with ETen extensions
  +     */
       public static final String ETen_B5_H = "ETen-B5-H";
  +
  +    /**
  +     * ETen-B5-V Vertical version of ETen-B5-H
  +     */
       public static final String ETen_B5_V = "ETen-B5-V";
  +
  +    /**
  +     * ETenms-B5-H Same as ETen-B5-H, but replaces half-width
  +     * Latin characters with proportional forms
  +     */
       public static final String ETenms_B5_H = "ETenms-B5-H";
  +
  +    /**
  +     * ETenms-B5-V Vertical version of ETenms-B5-H
  +     */
       public static final String ETenms_B5_V = "ETenms-B5-V";
  +
  +    /**
  +     * CNS-EUC-H CNS 11643-1992 character set, EUC-TW encoding
  +     */
       public static final String CNS_EUC_H = "CNS-EUC-H";
  +
  +    /**
  +     * CNS-EUC-V Vertical version of CNS-EUC-H
  +     */
       public static final String CNS_EUC_V = "CNS-EUC-V";
  +
  +    /**
  +     * UniCNS-UCS2-H Unicode (UCS-2) encoding for the
  +     * Adobe-CNS1 character collection
  +     */
       public static final String UniCNS_UCS2_H = "UniCNS-UCS2-H";
  -    public static final String UniCNS_UCS2_V = "UniCNS-UCS2-V";
   
       /**
  +     * UniCNS-UCS2-V Vertical version of UniCNS-UCS2-H
  +     */
  +    public static final String UniCNS_UCS2_V = "UniCNS-UCS2-V";
  +
  +    /*
        * Japanese
        */
  +
  +    /**
  +     * 83pv-RKSJ-H Mac OS, JIS X 0208 character set with KanjiTalk6
  +     * extensions, Shift-JIS encoding, Script Manager code 1
  +     */
       public static final String _83pv_RKSJ_H = "83pv-RKSJ-H";    // no V version
  +
  +    /**
  +     * 90ms-RKSJ-H Microsoft Code Page 932 (lfCharSet 0x80), JIS X 0208
  +     * character set with NEC and IBM extensions
  +     */
       public static final String _90ms_RKSJ_H = "90ms-RKSJ-H";
  +
  +    /**
  +     * 90ms-RKSJ-V Vertical version of 90ms-RKSJ-H
  +     */
       public static final String _90ms_RKSJ_V = "90ms-RKSJ-V";
  +
  +    /**
  +     * 90msp-RKSJ-H Same as 90ms-RKSJ-H, but replaces half-width Latin
  +     * characters with proportional forms
  +     */
       public static final String _90msp_RKSJ_H = "90msp-RKSJ-H";
  +
  +    /**
  +     * 90msp-RKSJ-V Vertical version of 90msp-RKSJ-H
  +     */
       public static final String _90msp_RKSJ_V = "90msp-RKSJ-V";
  +
  +    /**
  +     * 90pv-RKSJ-H Mac OS, JIS X 0208 character set with KanjiTalk7
  +     * extensions, Shift-JIS encoding, Script Manager code 1
  +     */
       public static final String _90pv_RKSJ_H = "90pv-RKSJ-H";    // no V version
  +
  +    /**
  +     * Add-RKSJ-H JIS X 0208 character set with Fujitsu FMR
  +     * extensions, Shift-JIS encoding
  +     */
       public static final String Add_RKSJ_H = "Add-RKSJ-H";
  +
  +    /**
  +     * Add-RKSJ-V Vertical version of Add-RKSJ-H
  +     */
       public static final String Add_RKSJ_V = "Add-RKSJ-V";
  +
  +    /**
  +     * EUC-H JIS X 0208 character set, EUC-JP encoding
  +     */
       public static final String EUC_H = "EUC-H";
  +
  +    /**
  +     * EUC-V Vertical version of EUC-H
  +     */
       public static final String EUC_V = "EUC-V";
  +
  +    /**
  +     * Ext-RKSJ-H JIS C 6226 (JIS78) character set with
  +     * NEC extensions, Shift-JIS encoding
  +     */
       public static final String Ext_RKSJ_H = "Ext-RKSJ-H";
  +
  +    /**
  +     * Ext-RKSJ-V Vertical version of Ext-RKSJ-H
  +     */
       public static final String Ext_RKSJ_V = "Ext-RKSJ-V";
  +
  +    /**
  +     * H JIS X 0208 character set, ISO-2022-JP encoding
  +     */
       public static final String H = "H";
  +
  +    /**
  +     * V Vertical version of H
  +     */
       public static final String V = "V";
  +
  +    /**
  +     * UniJIS-UCS2-H Unicode (UCS-2) encoding for the
  +     * Adobe-Japan1 character collection
  +     */
       public static final String UniJIS_UCS2_H = "UniJIS-UCS2-H";
  +
  +    /**
  +     * UniJIS-UCS2-V Vertical version of UniJIS-UCS2-H
  +     */
       public static final String UniJIS_UCS2_V = "UniJIS-UCS2-V";
  +
  +    /**
  +     * UniJIS-UCS2-HW-H Same as UniJIS-UCS2-H, but replaces proportional
  +     * Latin characters with half-width forms
  +     */
       public static final String UniJIS_UCS2_HW_H = "UniJIS-UCS2-HW-H";
  -    public static final String UniJIS_UCS2_HW_V = "UniJIS-UCS2-HW-V";
   
       /**
  +     * UniJIS-UCS2-HW-V Vertical version of UniJIS-UCS2-HW-H
  +     */
  +    public static final String UniJIS_UCS2_HW_V = "UniJIS-UCS2-HW-V";
  +
  +    /*
        * Korean
        */
  +
  +    /**
  +     * KSC-EUC-H KS X 1001:1992 character set, EUC-KR encoding
  +     */
       public static final String KSC_EUC_H = "KSC-EUC-H";
  +
  +    /**
  +     * KSC-EUC-V Vertical version of KSC-EUC-H
  +     */
       public static final String KSC_EUC_V = "KSC-EUC-V";
  +
  +    /**
  +     * KSCms-UHC-H Microsoft Code Page 949 (lfCharSet 0x81), KS X 1001:1992
  +     * character set plus 8822 additional hangul,
  +     * Unified Hangul Code (UHC) encoding
  +     */
       public static final String KSCms_UHC_H = "KSCms-UHC-H";
  +
  +    /**
  +     * KSCms-UHC-V Vertical version of KSCms-UHC-H
  +     */
       public static final String KSCms_UHC_V = "KSCms-UHC-V";
  +
  +    /**
  +     * KSCms-UHC-HW-H Same as KSCms-UHC-H, but replaces proportional
  +     * Latin characters with half-width forms
  +     */
       public static final String KSCms_UHC_HW_H = "KSCms-UHC-HW-H";
  +
  +    /**
  +     * KSCms-UHC-HW-V Vertical version of KSCms-UHC-HW-H
  +     */
       public static final String KSCms_UHC_HW_V = "KSCms-UHC-HW-V";
  +
  +    /**
  +     * KSCpc-EUC-H Mac OS, KS X 1001:1992 character set with
  +     * Mac OS KH extensions, Script Manager Code 3
  +     */
       public static final String KSCpc_EUC_H = "KSCpc-EUC-H";    // no V version
  +
  +    /**
  +     * UniKS-UCS2-H Unicode (UCS-2) encoding for the
  +     * Adobe-Korea1 character collection
  +     */
       public static final String UniKSC_UCS2_H = "UniKSC-UCS2-H";
  -    public static final String UniKSC_UCS2_V = "UniKSC-UCS2-V";
   
       /**
  +     * UniKS-UCS2-V Vertical version of UniKS-UCS2-H
  +     */
  +    public static final String UniKSC_UCS2_V = "UniKSC-UCS2-V";
  +
  +    /*
        * Generic
        */
  +
  +    /**
  +     * Identity-H The horizontal identity mapping for 2-byte CIDs;
  +     * may be used with CIDFonts using any Registry, Ordering, and
  +     * Supplement values. It maps 2-byte character codes ranging from
  +     * 0 to 65,535 to the same 2-byte CID value, interpreted
  +     * high-order byte first.
  +     */
       public static final String Identity_H = "Identity-H";
  +
  +    /**
  +     * Identity-V Vertical version of Identity-H. The mapping
  +     * is the same as for Identity-H.
  +     */
       public static final String Identity_V = "Identity-V";
   
       /**
  @@ -116,6 +359,7 @@
       /**
        * create the /CMap object
        *
  +     * @param number the pdf object number
        * @param name one the registered names (see Table 7.20 on p 215)
        * @param sysInfo the attributes of the character collection of the CIDFont
        */
  @@ -136,6 +380,9 @@
           this.wMode = mode;
       }
   
  +    /**
  +     * Add the contents of this pdf object to the PDF stream.
  +     */
       public void addContents() {
           StringBuffer p = new StringBuffer();
           fillInPDF(p);
  @@ -145,7 +392,7 @@
       /**
        * set the base CMap
        *
  -     * @param base the name of the base CMap (see Table 7.20)
  +     * @param base the name of the base CMap
        */
       public void setUseCMap(String base) {
           this.base = base;
  @@ -160,6 +407,11 @@
           this.base = base;
       }
   
  +    /**
  +     * Fill in the pdf string for this CMap.
  +     *
  +     * @param p the string buffer to add the pdf data to
  +     */
       public void fillInPDF(StringBuffer p) {
           // p.append("/Type /CMap\n");
           // p.append(sysInfo.toPDFString());
  
  
  
  1.3       +11 -6     xml-fop/src/org/apache/fop/pdf/PDFCharProcs.java
  
  Index: PDFCharProcs.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/pdf/PDFCharProcs.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- PDFCharProcs.java	30 Jul 2001 20:29:29 -0000	1.2
  +++ PDFCharProcs.java	11 Jan 2003 19:38:52 -0000	1.3
  @@ -1,13 +1,14 @@
   /*
    * $Id$
  - * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
  + * Copyright (C) 2001-2003 The Apache Software Foundation. All rights reserved.
    * For details on use and redistribution please refer to the
    * LICENSE file included with these sources.
    */
   
   package org.apache.fop.pdf;
   
  -import java.util.Hashtable;
  +import java.util.Map;
  +import java.util.HashMap;     
   
   /**
    * class representing a /CharProcs dictionary for Type3 fonts.
  @@ -23,10 +24,13 @@
       /**
        * the (character name, drawing stream) pairs for a Type3 font
        */
  -    protected Hashtable keys;
  +    protected Map keys;
   
  +    /**
  +     * Create a new PDF char proc store.
  +     */
       public PDFCharProcs() {
  -        keys = new Hashtable();
  +        keys = new HashMap();
       }
   
       /**
  @@ -41,9 +45,10 @@
   
       /**
        * not done yet
  +     * @return the pdf byte array
        */
       public byte[] toPDF() {
  -        // TODO: implement this org.apache.fop.pdf.PDFObject abstract method
  +        // todo implement this org.apache.fop.pdf.PDFObject abstract method
           return new byte[0];
       }
   
  
  
  
  1.15      +180 -49   xml-fop/src/org/apache/fop/pdf/PDFColor.java
  
  Index: PDFColor.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/pdf/PDFColor.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- PDFColor.java	25 Oct 2002 09:29:46 -0000	1.14
  +++ PDFColor.java	11 Jan 2003 19:38:52 -0000	1.15
  @@ -1,6 +1,6 @@
   /*
    * $Id$
  - * Copyright (C) 2001-2002 The Apache Software Foundation. All rights reserved.
  + * Copyright (C) 2001-2003 The Apache Software Foundation. All rights reserved.
    * For details on use and redistribution please refer to the
    * LICENSE file included with these sources.
    */
  @@ -8,19 +8,32 @@
   package org.apache.fop.pdf;
   
   // Java
  +import java.util.List;
   import java.util.ArrayList;
   
  +/**
  + * PDF Color object.
  + * This is used to output color to a PDF content stream.
  + */
   public class PDFColor extends PDFPathPaint {
  -    protected static double blackFactor = 2.0;    // could be 3.0 as well.
  -    protected double red = -1.0;
  -    protected double green = -1.0;
  -    protected double blue = -1.0;
  -
  -    protected double cyan = -1.0;
  -    protected double magenta = -1.0;
  -    protected double yellow = -1.0;
  -    protected double black = -1.0;
  -
  +    // could be 3.0 as well.
  +    private static double blackFactor = 2.0;
  +    private double red = -1.0;
  +    private double green = -1.0;
  +    private double blue = -1.0;
  +
  +    private double cyan = -1.0;
  +    private double magenta = -1.0;
  +    private double yellow = -1.0;
  +    private double black = -1.0;
  +
  +    /**
  +     * Create a PDF color with double values ranging from 0 to 1
  +     *
  +     * @param theRed the red double value
  +     * @param theGreen the green double value
  +     * @param theBlue the blue double value
  +     */
       public PDFColor(double theRed, double theGreen, double theBlue) {
           // super(theNumber);
           this.colorSpace = new PDFColorSpace(PDFColorSpace.DEVICE_RGB);
  @@ -30,13 +43,27 @@
           this.blue = theBlue;
       }
   
  -    // components from 0 to 255
  +    /**
  +     * Create a PDF color with int values ranging from 0 to 255
  +     *
  +     * @param theRed the red integer value
  +     * @param theGreen the green integer value
  +     * @param theBlue the blue integer value
  +     */
       public PDFColor(int theRed, int theGreen, int theBlue) {
           this(((double)theRed) / 255d, ((double)theGreen) / 255d,
                ((double)theBlue) / 255d);
   
       }
   
  +    /**
  +     * Create a PDF color with CMYK values.
  +     *
  +     * @param theCyan the cyan value
  +     * @param theMagenta the magenta value
  +     * @param theYellow the yellow value
  +     * @param theBlack the black value
  +     */
       public PDFColor(double theCyan, double theMagenta, double theYellow,
                       double theBlack) {
           // super(theNumber);//?
  @@ -49,90 +76,153 @@
           this.black = theBlack;
       }
   
  -
  -    public ArrayList getVector() {    // return a vector representation of the color
  -        // in the appropriate colorspace.
  -        ArrayList theColorVector = new ArrayList();
  -        if (this.colorSpace.getColorSpace() == PDFColorSpace.DEVICE_RGB) {    // RGB
  +    /**
  +     * Return a vector representation of the color
  +     * in the appropriate colorspace.
  +     *
  +     * @return a list containing the Double values of the color
  +     */
  +    public List getVector() {
  +        List theColorVector = new ArrayList();
  +        if (this.colorSpace.getColorSpace() == PDFColorSpace.DEVICE_RGB) {
  +            // RGB
               theColorVector.add(new Double(this.red));
               theColorVector.add(new Double(this.green));
               theColorVector.add(new Double(this.blue));
           } else if (this.colorSpace.getColorSpace()
  -                   == PDFColorSpace.DEVICE_CMYK) {    // CMYK
  +                   == PDFColorSpace.DEVICE_CMYK) {
  +            // CMYK
               theColorVector.add(new Double(this.cyan));
               theColorVector.add(new Double(this.magenta));
               theColorVector.add(new Double(this.yellow));
               theColorVector.add(new Double(this.black));
  -        } else {                                   // GRAY
  +        } else {
  +            // GRAY
               theColorVector.add(new Double(this.black));
           }
           return (theColorVector);
       }
   
  +    /**
  +     * Get the red component.
  +     *
  +     * @return the red double value
  +     */
       public double red() {
           return (this.red);
       }
   
  +    /**
  +     * Get the green component.
  +     *
  +     * @return the green double value
  +     */
       public double green() {
           return (this.green);
       }
   
  +    /**
  +     * Get the blue component.
  +     *
  +     * @return the blue double value
  +     */
       public double blue() {
           return (this.blue);
       }
   
  +    /**     
  +     * Get the red integer component.
  +     *  
  +     * @return the red integer value    
  +     */     
       public int red255() {
           return (int)(this.red * 255d);
       }
   
  +    /**
  +     * Get the green integer component.
  +     *
  +     * @return the green integer value           
  +     */
       public int green255() {
           return (int)(this.green * 255d);
       }
   
  +    /**
  +     * Get the blue integer component.
  +     *
  +     * @return the blue integer value           
  +     */
       public int blue255() {
           return (int)(this.blue * 255d);
       }
   
  +    /**
  +     * Get the cyan component.
  +     *
  +     * @return the cyan double value 
  +     */
       public double cyan() {
           return (this.cyan);
       }
   
  +    /**
  +     * Get the magenta component.
  +     *
  +     * @return the magenta double value 
  +     */
       public double magenta() {
           return (this.magenta);
       }
   
  +    /**
  +     * Get the yellow component.
  +     *
  +     * @return the yellow double value 
  +     */
       public double yellow() {
           return (this.yellow);
       }
   
  +    /**
  +     * Get the black component.
  +     *
  +     * @return the black double value 
  +     */
       public double black() {
           return (this.black);
       }
   
  +    /**
  +     * Set the color space for this color.
  +     * If the new color space is different the values are converted
  +     * to the new color space.
  +     *
  +     * @param theColorSpace the new color space
  +     */
       public void setColorSpace(int theColorSpace) {
           int theOldColorSpace = this.colorSpace.getColorSpace();
           if (theOldColorSpace != theColorSpace) {
               if (theOldColorSpace == PDFColorSpace.DEVICE_RGB) {
                   if (theColorSpace == PDFColorSpace.DEVICE_CMYK) {
                       this.convertRGBtoCMYK();
  -                } else    // convert to Gray?
  -                 {
  +                } else  {
  +                    // convert to Gray?
                       this.convertRGBtoGRAY();
                   }
  -
               } else if (theOldColorSpace == PDFColorSpace.DEVICE_CMYK) {
                   if (theColorSpace == PDFColorSpace.DEVICE_RGB) {
                       this.convertCMYKtoRGB();
  -                } else    // convert to Gray?
  -                 {
  +                } else {
  +                    // convert to Gray?
                       this.convertCMYKtoGRAY();
                   }
  -            } else        // used to be Gray
  -             {
  +            } else {
  +                // used to be Gray
                   if (theColorSpace == PDFColorSpace.DEVICE_RGB) {
                       this.convertGRAYtoRGB();
  -                } else    // convert to CMYK?
  -                 {
  +                } else {
  +                    // convert to CMYK?
                       this.convertGRAYtoCMYK();
                   }
               }
  @@ -140,6 +230,14 @@
           }
       }
   
  +    /**
  +     * Get the PDF output string for this color.
  +     * This returns the string to be inserted into PDF for setting
  +     * the current color.
  +     *
  +     * @param fillNotStroke whether to return fill or stroke command
  +     * @return the PDF string for setting the fill/stroke color
  +     */
       public String getColorSpaceOut(boolean fillNotStroke) {
           StringBuffer p = new StringBuffer("");
   
  @@ -154,7 +252,8 @@
                   same = true;
               }
               // output RGB
  -            if (fillNotStroke) {                  // fill
  +            if (fillNotStroke) {
  +                // fill
                   if (same) {
                       p.append(PDFNumber.doubleOut(this.red) + " g\n");
                   } else {
  @@ -163,7 +262,8 @@
                                + PDFNumber.doubleOut(this.blue)
                                + " rg\n");
                   }
  -            } else {                              // stroke/border
  +            } else {
  +                // stroke/border
                   if (same) {
                       p.append(PDFNumber.doubleOut(this.red) + " G\n");
                   } else {
  @@ -173,24 +273,26 @@
                                + " RG\n");
                   }
               }
  -        }                                         // end of output RGB
  -         else if (this.colorSpace.getColorSpace()
  -                  == PDFColorSpace.DEVICE_CMYK) {    // colorspace is CMYK
  +        } else if (this.colorSpace.getColorSpace()
  +                  == PDFColorSpace.DEVICE_CMYK) {
  +            // colorspace is CMYK
   
  -            if (fillNotStroke) {                  // fill
  +            if (fillNotStroke) {
  +                // fill
                   p.append(PDFNumber.doubleOut(this.cyan) + " "
                            + PDFNumber.doubleOut(this.magenta) + " "
                            + PDFNumber.doubleOut(this.yellow) + " "
                            + PDFNumber.doubleOut(this.black) + " k\n");
  -            } else {                              // fill
  +            } else {
  +                // stroke
                   p.append(PDFNumber.doubleOut(this.cyan) + " "
                            + PDFNumber.doubleOut(this.magenta) + " "
                            + PDFNumber.doubleOut(this.yellow) + " "
                            + PDFNumber.doubleOut(this.black) + " K\n");
               }
   
  -        }                                         // end of if CMYK
  -         else {                                   // means we're in DeviceGray or Unknown.
  +        } else {
  +            // means we're in DeviceGray or Unknown.
               // assume we're in DeviceGray, because otherwise we're screwed.
   
               if (fillNotStroke) {
  @@ -203,9 +305,9 @@
           return (p.toString());
       }
   
  -
  -
  -
  +    /**
  +     * Convert the color from CMYK to RGB.
  +     */
       protected void convertCMYKtoRGB() {
           // convert CMYK to RGB
           this.red = 1.0 - this.cyan;
  @@ -218,6 +320,9 @@
   
       }
   
  +    /**
  +     * Convert the color from RGB to CMYK.
  +     */
       protected void convertRGBtoCMYK() {
           // convert RGB to CMYK
           this.cyan = 1.0 - this.red;
  @@ -240,12 +345,18 @@
            */
       }
   
  +    /**
  +     * Convert the color from Gray to RGB.
  +     */
       protected void convertGRAYtoRGB() {
           this.red = 1.0 - this.black;
           this.green = 1.0 - this.black;
           this.blue = 1.0 - this.black;
       }
   
  +    /**
  +     * Convert the color from Gray to CMYK.
  +     */
       protected void convertGRAYtoCMYK() {
           this.cyan = this.black;
           this.magenta = this.black;
  @@ -253,43 +364,63 @@
           // this.black=0.0;//?
       }
   
  +    /**
  +     * Convert the color from CMYK to Gray.
  +     */
       protected void convertCMYKtoGRAY() {
           double tempDouble = 0.0;
   
           // pick the lowest color
           tempDouble = this.cyan;
   
  -        if (this.magenta < tempDouble)
  +        if (this.magenta < tempDouble) {
               tempDouble = this.magenta;
  +        }
   
  -        if (this.yellow < tempDouble)
  +        if (this.yellow < tempDouble) {
               tempDouble = this.yellow;
  +        }
   
           this.black = (tempDouble / this.blackFactor);
   
       }
   
  +    /**
  +     * Convert the color from RGB to Gray.
  +     */
       protected void convertRGBtoGRAY() {
           double tempDouble = 0.0;
   
           // pick the lowest color
           tempDouble = this.red;
   
  -        if (this.green < tempDouble)
  +        if (this.green < tempDouble) {
               tempDouble = this.green;
  +        }
   
  -        if (this.blue < tempDouble)
  +        if (this.blue < tempDouble) {
               tempDouble = this.blue;
  +        }
   
           this.black = 1.0 - (tempDouble / this.blackFactor);
  -
       }
   
  -    byte[] toPDF() {
  +    /**
  +     * Create pdf.
  +     * Not used for this object.
  +     *
  +     * @return the bytes for the pdf
  +     */
  +    public byte[] toPDF() {
           return (new byte[0]);
  +    }
   
  -    }    // end of toPDF
  -
  +    /**
  +     * Check for equality of color with another object.
  +     *
  +     * @param obj the object to compare
  +     * @return true if colors are equal
  +     */
       public boolean equals(Object obj) {
           if (!(obj instanceof PDFColor)) {
               return false;
  
  
  
  1.4       +83 -18    xml-fop/src/org/apache/fop/pdf/PDFColorSpace.java
  
  Index: PDFColorSpace.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/pdf/PDFColorSpace.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- PDFColorSpace.java	29 Nov 2002 23:18:56 -0000	1.3
  +++ PDFColorSpace.java	11 Jan 2003 19:38:52 -0000	1.4
  @@ -1,12 +1,15 @@
   /*
    * $Id$
  - * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
  + * Copyright (C) 2001-2003 The Apache Software Foundation. All rights reserved.
    * For details on use and redistribution please refer to the
    * LICENSE file included with these sources.
    */
   
   package org.apache.fop.pdf;
   
  +/**
  + * PDF Color space.
  + */
   public class PDFColorSpace {
       private boolean hasICCProfile;
       private byte[] iccProfile;
  @@ -15,17 +18,38 @@
       // Ok... so I had some grand purpose for this, but I can't recall.
       // I'm just writing it
   
  -    public static int DEVICE_UNKNOWN = -1;
  -    public static int DEVICE_GRAY = 1;
  -    // what's the *official* spelling?
  -    // public static int DEVICE_GREY = 1;
  -    public static int DEVICE_RGB = 2;
  -    public static int DEVICE_CMYK = 3;
  +    /**
  +     * Unknown colorspace
  +     */
  +    public static final int DEVICE_UNKNOWN = -1;
  +
  +    /**
  +     * Gray colorspace
  +     */
  +    public static final int DEVICE_GRAY = 1;
  +
  +    /**
  +     * RGB colorspace
  +     */
  +    public static final int DEVICE_RGB = 2;
  +
  +    /**
  +     * CMYK colorspace
  +     */
  +    public static final int DEVICE_CMYK = 3;
   
       // Are there any others?
   
  +    /**
  +     * Current color space value.
  +     */
       protected int currentColorSpace = DEVICE_UNKNOWN;
   
  +    /**
  +     * Create a PDF colorspace object.
  +     *
  +     * @param theColorSpace the current colorspace
  +     */
       public PDFColorSpace(int theColorSpace) {
           this.currentColorSpace = theColorSpace;
           hasICCProfile = false;
  @@ -44,46 +68,87 @@
           }
       }
   
  +    /**
  +     * Set the current colorspace.
  +     *
  +     * @param theColorSpace the new color space value
  +     */
       public void setColorSpace(int theColorSpace) {
           this.currentColorSpace = theColorSpace;
           numComponents = calculateNumComponents();
       }
   
  +    /**
  +     * Check if this colorspace has an ICC profile.
  +     *
  +     * @return true if this has an ICC profile
  +     */
       public boolean hasICCProfile() {
           return hasICCProfile;
       }
   
  +    /**
  +     * Get the ICC profile for this colorspace
  +     *
  +     * @return the byte array containing the ICC profile data
  +     */
       public byte[] getICCProfile() {
  -        if (hasICCProfile)
  +        if (hasICCProfile) {
               return iccProfile;
  -        else
  +        } else {
               return new byte[0];
  +        }
       }
   
  +    /**
  +     * Set the ICC profile for this colorspace.
  +     *
  +     * @param iccProfile the ICC profile data
  +     */
       public void setICCProfile(byte[] iccProfile) {
           this.iccProfile = iccProfile;
           hasICCProfile = true;
       }
   
  +    /**
  +     * Get the colorspace value
  +     *
  +     * @return the colorspace value
  +     */
       public int getColorSpace() {
           return (this.currentColorSpace);
       }
   
  +    /**
  +     * Get the number of color components for this colorspace
  +     *
  +     * @return the number of components
  +     */
       public int getNumComponents() {
           return numComponents;
       }
   
  +    /**
  +     * Get the PDF string for this colorspace.
  +     *
  +     * @return the PDF string for the colorspace
  +     */
       public String getColorSpacePDFString() {
           // shouldn't this be a select-case? I can never remember
           // the syntax for that.
  -        if (this.currentColorSpace == this.DEVICE_RGB) {
  -            return ("DeviceRGB");
  -        } else if (this.currentColorSpace == this.DEVICE_CMYK) {
  -            return ("DeviceCMYK");
  -        } else if (this.currentColorSpace == this.DEVICE_GRAY) {
  -            return ("DeviceGray");
  -        } else {    // unknown... Error. Tell them it's RGB and hope they don't notice.
  -            return ("DeviceRGB");
  +        switch (currentColorSpace) {
  +            case DEVICE_CMYK:
  +                return "DeviceCMYK";
  +            //break;
  +            case DEVICE_GRAY:
  +                return "DeviceGray";
  +            //break;
  +            case DEVICE_RGB:
  +            default:
  +                // unknown... Error. Tell them it's RGB and hope they
  +                // don't notice.
  +                return ("DeviceRGB");
  +            //break;
           }
       }
   
  
  
  
  1.62      +187 -61   xml-fop/src/org/apache/fop/pdf/PDFDocument.java
  
  Index: PDFDocument.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/pdf/PDFDocument.java,v
  retrieving revision 1.61
  retrieving revision 1.62
  diff -u -r1.61 -r1.62
  --- PDFDocument.java	8 Jan 2003 13:57:23 -0000	1.61
  +++ PDFDocument.java	11 Jan 2003 19:38:52 -0000	1.62
  @@ -273,6 +273,15 @@
       }
   
       /**
  +     * Get the PDF root object.
  +     *
  +     * @return the PDFRoot object
  +     */
  +    public PDFRoot getRoot() {
  +        return this.root;
  +    }
  +
  +    /**
        * Make a /Pages object. This object is written in the trailer.
        *
        * @return a new PDF Pages object for adding pages to
  @@ -375,9 +384,9 @@
        * This is not documented in the Function section of the PDF 1.3 spec,
        * it was deduced from samples that this is sometimes used, even if we may never
        * use it in FOP. It is added for completeness sake.
  -     * @param theNumber The object number of this PDF object.
        * @param theFunctionType This is the type of function (0,2,3, or 4).
        * It should be 0 as this is the constructor for sampled functions.
  +     * @return the PDF function that was created
        */
       public PDFFunction makeFunction(int theFunctionType, List theDomain,
                                       List theRange, List theSize,
  @@ -430,6 +439,7 @@
        * This attribute is required.
        * PDF Spec page 268
        * @param theFunctionType The type of the function, which should be 2.
  +     * @return the PDF function that was created
        */
       public PDFFunction makeFunction(int theFunctionType, List theDomain,
                                       List theRange, List theCZero,
  @@ -513,6 +523,7 @@
        * See page 270 in the PDF 1.3 spec.
        * @param theFunctionType This is the function type. It should be 3,
        * for a stitching function.
  +     * @return the PDF function that was created
        */
       public PDFFunction makeFunction(int theFunctionType, List theDomain,
                                       List theRange, List theFunctions,
  @@ -540,15 +551,17 @@
       /**
        * make a postscript calculator function
        *
  -     * @param theNumber
  -     * @param theFunctionType
  -     * @param theDomain
  -     * @param theRange
  -     * @param theFunctionDataStream
  +     * @param theNumber the PDF object number
  +     * @param theFunctionType the type of function to make
  +     * @param theDomain the domain values
  +     * @param theRange the range values of the function
  +     * @param theFunctionDataStream a string containing the pdf drawing
  +     * @return the PDF function that was created
        */
       public PDFFunction makeFunction(int theNumber, int theFunctionType,
                                       List theDomain, List theRange,
  -                                    StringBuffer theFunctionDataStream) {    // Type 4
  +                                    StringBuffer theFunctionDataStream) {
  +        // Type 4
           PDFFunction function = new PDFFunction(++this.objectcount,
                                                  theFunctionType, theDomain,
                                                  theRange,
  @@ -570,6 +583,7 @@
       /**
        * make a function based shading object
        *
  +     * @param res the PDF resource context to add the shading, may be null
        * @param theShadingType The type of shading object, which should be 1 for function
        * based shading.
        * @param theColorSpace The colorspace is 'DeviceRGB' or something similar.
  @@ -587,6 +601,7 @@
        * If it's a shading, then it maps it to current user space.
        * It's optional, the default is the identity matrix
        * @param theFunction The PDF Function that maps an (x,y) location to a color
  +     * @return the PDF shading that was created
        */
       public PDFShading makeShading(PDFResourceContext res, int theShadingType,
                                     PDFColorSpace theColorSpace,
  @@ -626,6 +641,7 @@
       /**
        * Make an axial or radial shading object.
        *
  +     * @param res the PDF resource context to add the shading, may be null
        * @param theShadingType 2 or 3 for axial or radial shading
        * @param theColorSpace "DeviceRGB" or similar.
        * @param theBackground theBackground An array of color components appropriate to the
  @@ -643,6 +659,7 @@
        * @param theExtend List of Booleans of whether to extend the
        *                  start and end colors past the start and end points
        * The default is [false, false]
  +     * @return the PDF shading that was created
        */
       public PDFShading makeShading(PDFResourceContext res, int theShadingType,
                                     PDFColorSpace theColorSpace,
  @@ -683,6 +700,7 @@
        * Make a free-form gouraud shaded triangle mesh, coons patch mesh, or tensor patch mesh
        * shading object
        *
  +     * @param res the PDF resource context to add the shading, may be null
        * @param theShadingType 4, 6, or 7 depending on whether it's
        * Free-form gouraud-shaded triangle meshes, coons patch meshes,
        * or tensor product patch meshes, respectively.
  @@ -700,6 +718,7 @@
        * @param theBitsPerFlag 2,4,8.
        * @param theDecode List of Doubles see PDF 1.3 spec pages 303 to 312.
        * @param theFunction the PDFFunction
  +     * @return the PDF shading that was created
        */
       public PDFShading makeShading(PDFResourceContext res, int theShadingType,
                                     PDFColorSpace theColorSpace,
  @@ -743,6 +762,7 @@
       /**
        * make a Lattice-Form Gouraud mesh shading object
        *
  +     * @param res the PDF resource context to add the shading, may be null
        * @param theShadingType 5 for lattice-Form Gouraud shaded-triangle mesh
        * without spaces. "Shading1" or "Sh1" are good examples.
        * @param theColorSpace "DeviceRGB" or similar.
  @@ -759,6 +779,7 @@
        * @param theDecode List of Doubles. See page 305 in PDF 1.3 spec.
        * @param theVerticesPerRow number of vertices in each "row" of the lattice.
        * @param theFunction The PDFFunction that's mapped on to this shape
  +     * @return the PDF shading that was created
        */
       public PDFShading makeShading(PDFResourceContext res, int theShadingType,
                                     PDFColorSpace theColorSpace,
  @@ -801,6 +822,7 @@
       /**
        * Make a tiling pattern
        *
  +     * @param res the PDF resource context to add the shading, may be null
        * @param thePatternType the type of pattern, which is 1 for tiling.
        * @param theResources the resources associated with this pattern
        * @param thePaintType 1 or 2, colored or uncolored.
  @@ -811,6 +833,7 @@
        * @param theMatrix Optional List of Doubles transformation matrix
        * @param theXUID Optional vector of Integers that uniquely identify the pattern
        * @param thePatternDataStream The stream of pattern data to be tiled.
  +     * @return the PDF pattern that was created
        */
       public PDFPattern makePattern(PDFResourceContext res, int thePatternType,    // 1
                                     PDFResources theResources, int thePaintType, int theTilingType,
  @@ -849,11 +872,13 @@
       /**
        * Make a smooth shading pattern
        *
  +     * @param res the PDF resource context to add the shading, may be null
        * @param thePatternType the type of the pattern, which is 2, smooth shading
        * @param theShading the PDF Shading object that comprises this pattern
        * @param theXUID optional:the extended unique Identifier if used.
        * @param theExtGState optional: the extended graphics state, if used.
        * @param theMatrix Optional:List of Doubles that specify the matrix.
  +     * @return the PDF pattern that was created       
        */
       public PDFPattern makePattern(PDFResourceContext res,
                                     int thePatternType, PDFShading theShading,
  @@ -884,15 +909,37 @@
           return (pattern);
       }
   
  +    /**
  +     * Get the color space.
  +     *
  +     * @return the color space
  +     */
       public int getColorSpace() {
           return (this.colorspace.getColorSpace());
       }
   
  +    /**
  +     * Set the color space.
  +     * This is used when creating gradients.
  +     *
  +     * @param theColorspace the new color space
  +     */
       public void setColorSpace(int theColorspace) {
           this.colorspace.setColorSpace(theColorspace);
           return;
       }
   
  +    /**
  +     * Make a gradient
  +     *  
  +     * @param res the PDF resource context to add the shading, may be null
  +     * @param radial if true a radial gradient will be created
  +     * @param theColorspace the colorspace of the gradient
  +     * @param theColors the list of colors for the gradient
  +     * @param theBounds the list of bounds associated with the colors
  +     * @param theCoords the coordinates for the gradient
  +     * @return the PDF pattern that was created
  +     */
       public PDFPattern createGradient(PDFResourceContext res, boolean radial,
                                        PDFColorSpace theColorspace,
                                        List theColors, List theBounds,
  @@ -995,12 +1042,13 @@
           return encoding;
       }
   
  -        /**
  -         * Create a PDFICCStream
  -         @see PDFXObject
  -         @see org.apache.fop.image.JpegImage
  -         @see org.apache.fop.pdf.PDFColorSpace
  -        */
  +    /**
  +     * Create a PDFICCStream
  +     * @see PDFXObject
  +     * @see org.apache.fop.image.JpegImage
  +     * @see org.apache.fop.pdf.PDFColorSpace
  +     * @return the new PDF ICC stream object
  +     */
       public PDFICCStream makePDFICCStream() {
           PDFICCStream iccStream = new PDFICCStream(++this.objectcount);
           this.objects.add(iccStream);
  @@ -1119,6 +1167,9 @@
   
       /**
        * make a /FontDescriptor object
  +     *
  +     * @param desc the font descriptor
  +     * @return the new PDF font descriptor
        */
       public PDFFontDescriptor makeFontDescriptor(FontDescriptor desc) {
           PDFFontDescriptor font = null;
  @@ -1156,6 +1207,13 @@
           return font;
       }
   
  +    /**
  +     * Resolve a URI.
  +     *
  +     * @param uri the uri to resolve
  +     * @throws java.io.FileNotFoundException if the URI could not be resolved
  +     * @return the InputStream from the URI.
  +     */
       protected InputStream resolveURI(String uri) 
                   throws java.io.FileNotFoundException {
           try {
  @@ -1175,10 +1233,13 @@
        */
       public PDFStream makeFontFile(int obj, FontDescriptor desc) {
           if (desc.getFontType() == FontType.OTHER) {
  -            throw new IllegalArgumentException("Trying to embed unsupported font type: " + desc.getFontType());
  +            throw new IllegalArgumentException("Trying to embed unsupported font type: "
  +                                                + desc.getFontType());
           } 
           if (!(desc instanceof CustomFont)) {
  -            throw new IllegalArgumentException("FontDescriptor must be instance of CustomFont, but is a " + desc.getClass().getName());
  +            throw new IllegalArgumentException(
  +                      "FontDescriptor must be instance of CustomFont, but is a "
  +                       + desc.getClass().getName());
           }
           
           CustomFont font = (CustomFont)desc;
  @@ -1186,52 +1247,59 @@
           InputStream in = null;
           try {
               // Get file first
  -            if (font.getEmbedFileName() != null) try {
  -                in = resolveURI(font.getEmbedFileName());
  -            } catch (Exception e) {
  -                System.out.println("Failed to embed fontfile: "
  -                                   + font.getEmbedFileName());
  +            if (font.getEmbedFileName() != null) {
  +                try {
  +                    in = resolveURI(font.getEmbedFileName());
  +                } catch (Exception e) {
  +                    System.out.println("Failed to embed fontfile: "
  +                                       + font.getEmbedFileName());
  +                }
               }
       
               // Get resource
  -            if (in == null && font.getEmbedResourceName() != null) try {
  -                in = new java.io.BufferedInputStream(
  -                        this.getClass().getResourceAsStream(font.getEmbedResourceName()));
  -            } catch (Exception e) {
  -                System.out.println("Failed to embed fontresource: "
  -                                   + font.getEmbedResourceName());
  +            if (in == null && font.getEmbedResourceName() != null) {
  +                try {
  +                    in = new java.io.BufferedInputStream(
  +                            this.getClass().getResourceAsStream(font.getEmbedResourceName()));
  +                } catch (Exception e) {
  +                    System.out.println("Failed to embed fontresource: "
  +                                       + font.getEmbedResourceName());
  +                }
               }
       
               if (in == null) {
                   return null;
  -            } else try {
  -                PDFStream embeddedFont;
  -                if (desc.getFontType() == FontType.TYPE0) {
  -                    MultiByteFont mbfont = (MultiByteFont)font;
  -                    FontFileReader reader = new FontFileReader(in);
  -                
  -                    TTFSubSetFile subset = new TTFSubSetFile();
  -        
  -                    byte[] subsetFont = subset.readFont(reader, mbfont.getTTCName(), mbfont.getUsedGlyphs());
  -                    // Only TrueType CID fonts are supported now
  +            } else {
  +                try {
  +                    PDFStream embeddedFont;
  +                    if (desc.getFontType() == FontType.TYPE0) {
  +                        MultiByteFont mbfont = (MultiByteFont)font;
  +                        FontFileReader reader = new FontFileReader(in);
  +
  +                        TTFSubSetFile subset = new TTFSubSetFile();
           
  -                    embeddedFont = new PDFTTFStream(obj, subsetFont.length);
  -                    ((PDFTTFStream)embeddedFont).setData(subsetFont, subsetFont.length);
  -                } else if (desc.getFontType() == FontType.TYPE1) {
  -                    PFBParser parser = new PFBParser();
  -                    PFBData pfb = parser.parsePFB(in);
  -                    embeddedFont = new PDFT1Stream(obj);
  -                    ((PDFT1Stream)embeddedFont).setData(pfb);
  -                } else {
  -                    byte[] file = StreamUtilities.toByteArray(in, 128000);
  -                    embeddedFont = new PDFTTFStream(obj, file.length);
  -                    ((PDFTTFStream)embeddedFont).setData(file, file.length);
  +                        byte[] subsetFont = subset.readFont(reader,
  +                                             mbfont.getTTCName(), mbfont.getUsedGlyphs());
  +                        // Only TrueType CID fonts are supported now
  +
  +                        embeddedFont = new PDFTTFStream(obj, subsetFont.length);
  +                        ((PDFTTFStream)embeddedFont).setData(subsetFont, subsetFont.length);
  +                    } else if (desc.getFontType() == FontType.TYPE1) {
  +                        PFBParser parser = new PFBParser();
  +                        PFBData pfb = parser.parsePFB(in);
  +                        embeddedFont = new PDFT1Stream(obj);
  +                        ((PDFT1Stream)embeddedFont).setData(pfb);
  +                    } else {
  +                        byte[] file = StreamUtilities.toByteArray(in, 128000);
  +                        embeddedFont = new PDFTTFStream(obj, file.length);
  +                        ((PDFTTFStream)embeddedFont).setData(file, file.length);
  +                    }
  +                    embeddedFont.addFilter("flate");
  +                    embeddedFont.addFilter("ascii-85");
  +                    return embeddedFont;
  +                } finally {
  +                    in.close();
                   }
  -                embeddedFont.addFilter("flate");
  -                embeddedFont.addFilter("ascii-85");
  -                return embeddedFont;
  -            } finally {
  -                in.close();
               }
           } catch (IOException ioe) {
               //log.error("Failed to embed font [" + obj + "] "
  @@ -1239,8 +1307,6 @@
               return (PDFStream) null;
           }
       }
  -    
  -
   
   /*
       public PDFStream getFontFile(int i) {
  @@ -1259,9 +1325,11 @@
   
       /**
        * make an Array object (ex. Widths array for a font)
  +     *
  +     * @param values the int array values
  +     * @return the PDF Array with the int values
        */
       public PDFArray makeArray(int[] values) {
  -
           PDFArray array = new PDFArray(++this.objectcount, values);
           this.objects.add(array);
           return array;
  @@ -1269,6 +1337,13 @@
   
       /**
        * make an ExtGState for extra graphics options
  +     * This tries to find a GState that will setup the correct values
  +     * for the current context. If there is no suitable GState it will
  +     * create a new one.
  +     *
  +     * @param settings the settings required by the caller
  +     * @param current the current GState of the current PDF context
  +     * @return a PDF GState, either an existing GState or a new one
        */
       public PDFGState makeGState(Map settings, PDFGState current) {
   
  @@ -1298,11 +1373,27 @@
           return gstate;
       }
   
  +    /**
  +     * Get an image from the image map.
  +     *
  +     * @param key the image key to look for
  +     * @return the image or PDFXObject for the key if found
  +     */
       public PDFXObject getImage(String key) {
           PDFXObject xObject = (PDFXObject)xObjectsMap.get(key);
           return xObject;
       }
   
  +    /**
  +     * Add an image to the PDF document.
  +     * This adds an image to the PDF objects.
  +     * If an image with the same key already exists it will return the
  +     * old PDFXObject.
  +     *
  +     * @param res the PDF resource context to add to, may be null
  +     * @param img the PDF image to add
  +     * @return the PDF XObject that references the PDF image data
  +     */
       public PDFXObject addImage(PDFResourceContext res, PDFImage img) {
           // check if already created
           String key = img.getKey();
  @@ -1328,7 +1419,20 @@
           return xObject;
       }
   
  -    public PDFFormXObject addFormXObject(PDFResourceContext res, PDFStream cont, PDFResources formres, String key) {
  +    /** 
  +     * Add a form XObject to the PDF document.
  +     * This adds a Form XObject to the PDF objects.
  +     * If a Form XObject with the same key already exists it will return the
  +     * old PDFFormXObject.
  +     *  
  +     * @param res the PDF resource context to add to, may be null
  +     * @param cont the PDF Stream contents of the Form XObject
  +     * @param formres the PDF Resources for the Form XObject data
  +     * @param key the key for the object
  +     * @return the PDF Form XObject that references the PDF data
  +     */
  +    public PDFFormXObject addFormXObject(PDFResourceContext res, PDFStream cont,
  +                                         PDFResources formres, String key) {
           PDFFormXObject xObject;
           xObject = new PDFFormXObject(++this.objectcount, ++this.xObjectCount,
                                    cont, formres.referencePDF());
  @@ -1338,14 +1442,12 @@
               res.getPDFResources().addXObject(xObject);
           }
           return xObject;
  -
       }
   
       /**
        * make a /Page object
        *
        * @param resources resources object to use
  -     * @param contents stream object with content
        * @param pagewidth width of the page in points
        * @param pageheight height of the page in points
        *
  @@ -1366,6 +1468,12 @@
           return page;
       }
   
  +    /**
  +     * Add a completed page to the PDF document.
  +     * The page is added to the object list.
  +     *
  +     * @param page the page to add
  +     */
       public void addPage(PDFPage page) {
           /* add it to the list of objects */
           this.objects.add(page);
  @@ -1393,6 +1501,7 @@
        * @param rect   the clickable rectangle
        * @param destination  the destination file
        * @param linkType the link type
  +     * @param yoffset the yoffset on the page for an internal link
        * @return the PDFLink object created
        */
       public PDFLink makeLink(Rectangle2D rect, String destination,
  @@ -1502,10 +1611,24 @@
           return goToReference;
       }
   
  +    /**
  +     * Add trailer object.
  +     * Adds an object to the list of trailer objects.
  +     *
  +     * @param object the PDF object to add
  +     */
       public void addTrailerObject(PDFObject object) {
           this.trailerObjects.add(object);
       }
   
  +    /**
  +     * Make an internal link.
  +     *
  +     * @param rect the hotspot position in absolute coordinates
  +     * @param page the target page reference value
  +     * @param dest the position destination
  +     * @return the new PDF link object
  +     */
       public PDFLink makeLink(Rectangle2D rect, String page, String dest) {
           PDFLink link = new PDFLink(++this.objectcount, rect);
           this.objects.add(link);
  @@ -1520,8 +1643,8 @@
       }
   
       /**
  -      Ensure there is room in the locations xref for the number of
  -      objects that have been created.
  +     * Ensure there is room in the locations xref for the number of
  +     * objects that have been created.
        */
       private void prepareLocations() {
           while (location.size() < objectcount) {
  @@ -1532,6 +1655,8 @@
       /**
        * make a stream object
        *
  +     * @param type the type of stream to be created
  +     * @param add if true then the stream will be added immediately
        * @return the stream object created
        */
       public PDFStream makeStream(String type, boolean add) {
  @@ -1607,6 +1732,7 @@
        * @param parent parent PDFOutline object which may be null
        * @param label the title for the new outline object
        * @param destination the reference string for the action to go to
  +     * @param yoffset the yoffset on the destination page
        * @return the new PDF outline object
        */
       public PDFOutline makeOutline(PDFOutline parent, String label,
  
  
  
  1.5       +8 -7      xml-fop/src/org/apache/fop/pdf/PDFEncoding.java
  
  Index: PDFEncoding.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/pdf/PDFEncoding.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- PDFEncoding.java	2 Nov 2001 11:06:07 -0000	1.4
  +++ PDFEncoding.java	11 Jan 2003 19:38:52 -0000	1.5
  @@ -1,6 +1,6 @@
   /*
    * $Id$
  - * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
  + * Copyright (C) 2001-2003 The Apache Software Foundation. All rights reserved.
    * For details on use and redistribution please refer to the
    * LICENSE file included with these sources.
    */
  @@ -8,9 +8,10 @@
   package org.apache.fop.pdf;
   
   // Java
  +import java.util.List;
  +import java.util.Map;
   import java.util.Iterator;
   import java.util.HashMap;
  -import java.util.ArrayList;
   
   /**
    * class representing an /Encoding object.
  @@ -20,7 +21,7 @@
    *
    * The three base encodings are given by their name.
    *
  - * Encodings are specified on page 213 and onwards of the PDF 1.3 spec.
  + * Encodings are specified in section 5.5.5 of the PDF 1.4 spec.
    */
   public class PDFEncoding extends PDFObject {
   
  @@ -49,7 +50,7 @@
       /**
        * the differences from the base encoding
        */
  -    protected HashMap differences;
  +    protected Map differences;
   
       /**
        * create the /Encoding object
  @@ -73,7 +74,7 @@
        * @param code the first index of the sequence to be changed
        * @param sequence the sequence of glyph names (as String)
        */
  -    public void addDifferences(int code, ArrayList sequence) {
  +    public void addDifferences(int code, List sequence) {
           differences.put(new Integer(code), sequence);
       }
   
  @@ -97,7 +98,7 @@
                   code = codes.next();
                   p.append(" ");
                   p.append(code);
  -                ArrayList sequence = (ArrayList)differences.get(code);
  +                List sequence = (List)differences.get(code);
                   for (int i = 0; i < sequence.size(); i++) {
                       p.append(" /");
                       p.append((String)sequence.get(i));
  
  
  
  1.5       +2 -2      xml-fop/src/org/apache/fop/pdf/PDFFileSpec.java
  
  Index: PDFFileSpec.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/pdf/PDFFileSpec.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- PDFFileSpec.java	22 Nov 2002 10:32:20 -0000	1.4
  +++ PDFFileSpec.java	11 Jan 2003 19:38:52 -0000	1.5
  @@ -1,6 +1,6 @@
   /*
    * $Id$
  - * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
  + * Copyright (C) 2001-2003 The Apache Software Foundation. All rights reserved.
    * For details on use and redistribution please refer to the
    * LICENSE file included with these sources.
    */
  
  
  
  1.5       +32 -12    xml-fop/src/org/apache/fop/pdf/PDFFilter.java
  
  Index: PDFFilter.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/pdf/PDFFilter.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- PDFFilter.java	27 May 2002 10:59:07 -0000	1.4
  +++ PDFFilter.java	11 Jan 2003 19:38:52 -0000	1.5
  @@ -1,18 +1,23 @@
   /*
    * $Id$
  - * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
  + * Copyright (C) 2001-2003 The Apache Software Foundation. All rights reserved.
    * For details on use and redistribution please refer to the
    * LICENSE file included with these sources.
    */
   
  -
  -// Author:       Eric SCHAEFFER, Kelly A. Campbell
  -// Description:  represent a PDF filter object
  -
   package org.apache.fop.pdf;
   
  -import java.io.*;
  -
  +import java.io.InputStream;
  +import java.io.OutputStream; 
  +import java.io.IOException;
  +
  +/**
  + * PDF Filter class.
  + * This represents a PDF filter object.
  + * Filter implementations should extend this class.
  + *
  + * @author Eric SCHAEFFER, Kelly A. Campbell
  + */
   public abstract class PDFFilter {
       /*
        * These are no longer needed, but are here as a reminder about what
  @@ -29,10 +34,15 @@
       /**
        * Marker to know if this filter has already been applied to the data
        */
  -    private boolean _applied = false;
  +    private boolean applied = false;
   
  +    /**
  +     * Check if this filter has been applied.
  +     *
  +     * @return true if this filter has been applied
  +     */
       public boolean isApplied() {
  -        return _applied;
  +        return applied;
       }
   
       /**
  @@ -43,24 +53,34 @@
        * out of an image file in it's compressed format, then this
        * should be set to true and the filter options should be set to
        * those which the raw data was encoded with.
  +     *
  +     * @param b set the applied value to this
        */
       public void setApplied(boolean b) {
  -        _applied = b;
  +        applied = b;
       }
   
  -
       /**
        * return a PDF string representation of the filter, e.g. /FlateDecode
  +     *
  +     * @return the filter PDF name
        */
       public abstract String getName();
   
       /**
        * return a parameter dictionary for this filter, or null
  +     *
  +     * @return the decode params for the filter
        */
       public abstract String getDecodeParms();
   
       /**
        * encode the given data with the filter
  +     *
  +     * @param in the input data stream to encode
  +     * @param out the output stream to write the result
  +     * @param length the length of data to read from the input stream
  +     * @throws IOException if there is an error reading or writing the data
        */
       public abstract void encode(InputStream in, OutputStream out, int length) throws IOException;
   
  
  
  
  1.4       +17 -8     xml-fop/src/org/apache/fop/pdf/PDFFilterException.java
  
  Index: PDFFilterException.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/pdf/PDFFilterException.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- PDFFilterException.java	30 Jul 2001 20:29:29 -0000	1.3
  +++ PDFFilterException.java	11 Jan 2003 19:38:52 -0000	1.4
  @@ -1,23 +1,32 @@
   /*
    * $Id$
  - * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
  + * Copyright (C) 2001-2003 The Apache Software Foundation. All rights reserved.
    * For details on use and redistribution please refer to the
    * LICENSE file included with these sources.
    */
   
  -// Author:       Eric SCHAEFFER
  -// Description:  Filter Exception
  -
   package org.apache.fop.pdf;
   
  +/**
  + * PDF Filter exception.
  + * This is used for exceptions relating to use a PDF filter.
  + *
  + * @author Eric SCHAEFFER
  + */
   public class PDFFilterException extends Exception {
  -
  +    /**
  +     * Create a basic filter exception.
  +     */
       public PDFFilterException() {
  -        super();
       }
   
  +    /**
  +     * Create a filter exception with a message.
  +     *
  +     * @param message the error message
  +     */
       public PDFFilterException(String message) {
           super(message);
       }
  -
   }
  +
  
  
  
  1.2       +2 -1      xml-fop/src/org/apache/fop/pdf/PDFFormXObject.java
  
  Index: PDFFormXObject.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/pdf/PDFFormXObject.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- PDFFormXObject.java	11 Nov 2002 08:50:51 -0000	1.1
  +++ PDFFormXObject.java	11 Jan 2003 19:38:52 -0000	1.2
  @@ -28,6 +28,7 @@
        * @param number the pdf object number
        * @param xnumber the pdf object X number
        * @param cont the pdf stream contents
  +     * @param ref the resource PDF reference
        */
       public PDFFormXObject(int number, int xnumber, PDFStream cont, String ref) {
           super(number, xnumber, null);
  
  
  
  1.14      +47 -18    xml-fop/src/org/apache/fop/pdf/PDFFunction.java
  
  Index: PDFFunction.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/pdf/PDFFunction.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- PDFFunction.java	29 Nov 2002 23:18:56 -0000	1.13
  +++ PDFFunction.java	11 Jan 2003 19:38:52 -0000	1.14
  @@ -1,6 +1,6 @@
   /*
    * $Id$
  - * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
  + * Copyright (C) 2001-2003 The Apache Software Foundation. All rights reserved.
    * For details on use and redistribution please refer to the
    * LICENSE file included with these sources.
    */
  @@ -13,7 +13,8 @@
   /**
    * class representing a PDF Function.
    *
  - * PDF Functions represent parameterized mathematical formulas and sampled representations with
  + * PDF Functions represent parameterized mathematical formulas and
  + * sampled representations with
    * arbitrary resolution. Functions are used in two areas: device-dependent
    * rasterization information for halftoning and transfer
    * functions, and color specification for smooth shading (a PDF 1.3 feature).
  @@ -49,25 +50,32 @@
       protected List size = null;
   
       /**
  -     * Required for Type 0: Number of Bits used to represent each sample value. Limited to 1,2,4,8,12,16,24, or 32
  +     * Required for Type 0: Number of Bits used to represent each sample value.
  +     * Limited to 1,2,4,8,12,16,24, or 32
        */
       protected int bitsPerSample = 1;
   
       /**
  -     * Optional for Type 0: order of interpolation between samples. Limited to linear (1) or cubic (3). Default is 1
  +     * Optional for Type 0: order of interpolation between samples.
  +     * Limited to linear (1) or cubic (3). Default is 1
        */
       protected int order = 1;
   
       /**
  -     * Optional for Type 0: A 2 * m array of Doubles which provides a linear mapping of input values to the domain.
  +     * Optional for Type 0: A 2 * m array of Doubles which provides a
  +     * linear mapping of input values to the domain.
        *
  -     * Required for Type 3: A 2 * k array of Doubles that, taken in pairs, map each subset of the domain defined by Domain and the Bounds array to the domain of the corresponding function.
  -     * Should be two values per function, usually (0,1), as in [0 1 0 1] for 2 functions.
  +     * Required for Type 3: A 2 * k array of Doubles that, taken
  +     * in pairs, map each subset of the domain defined by Domain
  +     * and the Bounds array to the domain of the corresponding function.
  +     * Should be two values per function, usually (0,1),
  +     * as in [0 1 0 1] for 2 functions.
        */
       protected List encode = null;
   
       /**
  -     * Optinoal for Type 0: A 2 * n array of Doubles which provides a linear mapping of sample values to the range. Defaults to Range.
  +     * Optional for Type 0: A 2 * n array of Doubles which provides
  +     * a linear mapping of sample values to the range. Defaults to Range.
        */
       protected List decode = null;
   
  @@ -76,24 +84,28 @@
        */
   
       /**
  -     * Required For Type 4: Postscript Calculator function composed of arithmetic, boolean, and stack operators + boolean constants
  +     * Required For Type 4: Postscript Calculator function
  +     * composed of arithmetic, boolean, and stack operators + boolean constants
        */
       protected StringBuffer functionDataStream = null;
   
       /**
  -     * Required (?) For Type 0: A vector of Strings for the various filters to be used to decode the stream.
  +     * Required (?) For Type 0: A vector of Strings for the
  +     * various filters to be used to decode the stream.
        * These are how the string is compressed. Flate, LZW, etc.
        */
       protected List filter = null;
       /* *************************TYPE 2************************** */
   
       /**
  -     * Required For Type 2: An Array of n Doubles defining the function result when x=0. Default is [0].
  +     * Required For Type 2: An Array of n Doubles defining
  +     * the function result when x=0. Default is [0].
        */
       protected List cZero = null;
   
       /**
  -     * Required For Type 2: An Array of n Doubles defining the function result when x=1. Default is [1].
  +     * Required For Type 2: An Array of n Doubles defining
  +     * the function result when x=1. Default is [1].
        */
       protected List cOne = null;
   
  @@ -107,12 +119,18 @@
       /* *************************TYPE 3************************** */
   
       /**
  -     * Required for Type 3: An vector of PDFFunctions which form an array of k single input functions making up the stitching function.
  +     * Required for Type 3: An vector of PDFFunctions which
  +     * form an array of k single input functions making up
  +     * the stitching function.
        */
       protected List functions = null;
   
       /**
  -     * Optional for Type 3: An array of (k-1) Doubles that, in combination with Domain, define the intervals to which each function from the Functions array apply. Bounds elements must be in order of increasing magnitude, and each value must be within the value of Domain.
  +     * Optional for Type 3: An array of (k-1) Doubles that,
  +     * in combination with Domain, define the intervals to which
  +     * each function from the Functions array apply. Bounds
  +     * elements must be in order of increasing magnitude,
  +     * and each value must be within the value of Domain.
        * k is the number of functions.
        * If you pass null, it will output (1/k) in an array of k-1 elements.
        * This makes each function responsible for an equal amount of the stitching function.
  @@ -142,7 +160,8 @@
        * so maybe this should be an array of length 2.
        *
        * See page 265 of the PDF 1.3 Spec.
  -     * @param theBitsPerSample An int specifying the number of bits user to represent each sample value.
  +     * @param theBitsPerSample An int specifying the number of bits
  +                               used to represent each sample value.
        * Limited to 1,2,4,8,12,16,24 or 32.
        * See page 265 of the 1.3 PDF Spec.
        * @param theOrder The order of interpolation between samples. Default is 1 (one). Limited
  @@ -164,7 +183,8 @@
        *
        * This attribute is optional.
        * Read about it on page 265 of the PDF 1.3 spec.
  -     * @param theFunctionDataStream The sample values that specify the function are provided in a stream.
  +     * @param theFunctionDataStream The sample values that specify
  +     *                     the function are provided in a stream.
        *
        * This is optional, but is almost always used.
        *
  @@ -310,7 +330,8 @@
        * @param theRange List object of Double objects.
        * This is the Range of the function.
        * See page 264 of the PDF 1.3 Spec.
  -     * @param theFunctionDataStream This is a stream of arithmetic, boolean, and stack operators and boolean constants.
  +     * @param theFunctionDataStream This is a stream of arithmetic,
  +     *            boolean, and stack operators and boolean constants.
        * I end up enclosing it in the '{' and '}' braces for you, so don't do it
        * yourself.
        *
  @@ -667,6 +688,14 @@
   
       }
   
  +    /**
  +     * Check if this function is equal to another object.
  +     * This is used to find if a particular function already exists
  +     * in a document.
  +     *
  +     * @param obj the obj to compare
  +     * @return true if the functions are equal
  +     */
       public boolean equals(Object obj) {
           if (obj == null) {
               return false;
  
  
  
  1.9       +21 -15    xml-fop/src/org/apache/fop/pdf/PDFGoTo.java
  
  Index: PDFGoTo.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/pdf/PDFGoTo.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- PDFGoTo.java	22 Nov 2002 10:32:20 -0000	1.8
  +++ PDFGoTo.java	11 Jan 2003 19:38:52 -0000	1.9
  @@ -1,6 +1,6 @@
   /*
    * $Id$
  - * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
  + * Copyright (C) 2001-2003 The Apache Software Foundation. All rights reserved.
    * For details on use and redistribution please refer to the
    * LICENSE file included with these sources.
    */
  @@ -9,16 +9,18 @@
   
   /**
    * class representing a /GoTo object.
  - *
  + * This can either have a Goto to a page reference and location
  + * or to a specified PDF reference string.
    */
   public class PDFGoTo extends PDFAction {
   
       /**
        * the pageReference
        */
  -    protected String pageReference;
  -    protected String destination = null;
  -    protected float xPosition = 0, yPosition = 0;
  +    private String pageReference;
  +    private String destination = null;
  +    private float xPosition = 0;
  +    private float yPosition = 0;
   
       /**
        * create a /GoTo object.
  @@ -27,26 +29,21 @@
        * @param pageReference the pageReference represented by this object
        */
       public PDFGoTo(int number, String pageReference) {
  -
           /* generic creation of object */
           super(number);
   
           this.pageReference = pageReference;
       }
   
  -
       /**
        * Sets page reference after object has been created
        *
  -     * @param pageReference
  -     * the new page reference to use
  +     * @param pageReference the new page reference to use
        */
       public void setPageReference(String pageReference) {
           this.pageReference = pageReference;
       }
   
  -
  -
       /**
        * Sets the Y position to jump to
        *
  @@ -56,6 +53,11 @@
           this.yPosition = yPosition;
       }
   
  +    /**
  +     * Set the destination string for this Goto.
  +     *
  +     * @param dest the PDF destination string
  +     */
       public void setDestination(String dest) {
           destination = dest;
       }
  @@ -69,11 +71,15 @@
           this.xPosition = (xPosition / 1000f);
       }
   
  +    /**
  +     * Get the PDF reference for the GoTo action.
  +     *
  +     * @return the PDF reference for the action
  +     */
       public String getAction() {
           return referencePDF();
       }
   
  -
       /**
        * represent the object in PDF
        *
  @@ -81,7 +87,7 @@
        */
       public byte[] toPDF() {
           String dest;
  -        if(destination == null) {
  +        if (destination == null) {
               dest = "/D [" + this.pageReference + " /XYZ " + xPosition
                             + " " + yPosition + " null]\n";
           } else {
  @@ -130,7 +136,7 @@
               }
           }
   
  -        if(destination == null) {
  +        if (destination == null) {
               if (!(gt.destination == null && gt.xPosition == xPosition
                   && gt.yPosition == yPosition)) {
                   return false;
  
  
  
  1.6       +8 -11     xml-fop/src/org/apache/fop/pdf/PDFGoToRemote.java
  
  Index: PDFGoToRemote.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/pdf/PDFGoToRemote.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- PDFGoToRemote.java	22 Nov 2002 10:32:20 -0000	1.5
  +++ PDFGoToRemote.java	11 Jan 2003 19:38:52 -0000	1.6
  @@ -1,6 +1,6 @@
   /*
    * $Id$
  - * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
  + * Copyright (C) 2001-2003 The Apache Software Foundation. All rights reserved.
    * For details on use and redistribution please refer to the
    * LICENSE file included with these sources.
    */
  @@ -15,18 +15,17 @@
       /**
        * the file specification
        */
  -    protected PDFFileSpec pdfFileSpec;
  -    protected int pageReference = 0;
  -    protected String destination = null;
  +    private PDFFileSpec pdfFileSpec;
  +    private int pageReference = 0;
  +    private String destination = null;
   
       /**
        * create an GoToR object.
        *
        * @param number the object's number
  -     * @param fileSpec the fileSpec associated with the action
  +     * @param pdfFileSpec the fileSpec associated with the action
        */
       public PDFGoToRemote(int number, PDFFileSpec pdfFileSpec) {
  -
           /* generic creation of object */
           super(number);
   
  @@ -37,11 +36,10 @@
        * create an GoToR object.
        *
        * @param number the object's number
  -     * @param fileSpec the fileSpec associated with the action
  +     * @param pdfFileSpec the fileSpec associated with the action
        * @param page a page reference within the remote document
        */
       public PDFGoToRemote(int number, PDFFileSpec pdfFileSpec, int page) {
  -
           /* generic creation of object */
           super(number);
   
  @@ -53,11 +51,10 @@
        * create an GoToR object.
        *
        * @param number the object's number
  -     * @param fileSpec the fileSpec associated with the action
  +     * @param pdfFileSpec the fileSpec associated with the action
        * @param dest a named destination within the remote document
        */
       public PDFGoToRemote(int number, PDFFileSpec pdfFileSpec, String dest) {
  -
           /* generic creation of object */
           super(number);
   
  
  
  
  1.2       +99 -27    xml-fop/src/org/apache/fop/pdf/PDFImage.java
  
  Index: PDFImage.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/pdf/PDFImage.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- PDFImage.java	27 Jun 2002 11:45:54 -0000	1.1
  +++ PDFImage.java	11 Jan 2003 19:38:52 -0000	1.2
  @@ -1,6 +1,6 @@
   /*
    * $Id$
  - * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
  + * Copyright (C) 2001-2003 The Apache Software Foundation. All rights reserved.
    * For details on use and redistribution please refer to the
    * LICENSE file included with these sources.
    */
  @@ -9,36 +9,108 @@
   
   import java.io.IOException;
   
  +/**
  + * Interface for a PDF image.
  + * This is used for inserting an image into PDF.
  + */
   public interface PDFImage {
   
  -    // key to look up XObject
  -    public String getKey();
  -
  -    public void setup(PDFDocument doc);
  -
  -    // image size
  -    public int getWidth();
  -    public int getHeight();
  -
  -    // DeviceGray, DeviceRGB, or DeviceCMYK
  -    public PDFColorSpace getColorSpace();
  -
  -    // bits per pixel
  -    public int getBitsPerPixel();
  -
  -    public boolean isPS();
  -
  -    // For transparent images
  -    public boolean isTransparent();
  -    public PDFColor getTransparentColor();
  -    public String getMask();
  -    public String getSoftMask();
  +    /**
  +     * Key to look up XObject.
  +     * This should be a unique key to refer to the image.
  +     *
  +     * @return the key for this image
  +     */
  +    String getKey();
  +
  +    /**
  +     * Setup the PDF image for the current document.
  +     * Some image formats may need to access the document.
  +     *
  +     * @param doc the PDF parent document
  +     */
  +    void setup(PDFDocument doc);
  +
  +    /**
  +     * Get the image width in pixels.
  +     *
  +     * @return the image width
  +     */
  +    int getWidth();
  +
  +    /**
  +     * Get the image height in pixels.
  +     *
  +     * @return the image height
  +     */
  +    int getHeight();
  +
  +    /**
  +     * Get the color space for this image.
  +     * Possible results are: DeviceGray, DeviceRGB, or DeviceCMYK
  +     *
  +     * @return the color space
  +     */
  +    PDFColorSpace getColorSpace();
  +
  +    /**
  +     * Get the bits per pixel for this image.
  +     *
  +     * @return the bits per pixel
  +     */
  +    int getBitsPerPixel();
  +
  +    /**
  +     * Check if this image is a PostScript image.
  +     *
  +     * @return true if this is a PostScript image
  +     */
  +    boolean isPS();
  +
  +    /**
  +     * Check if this image has a transparent color transparency.
  +     *
  +     * @return true if it has transparency
  +     */
  +    boolean isTransparent();
  +
  +    /**
  +     * Get the transparent color.
  +     *
  +     * @return the transparent color for this image
  +     */
  +    PDFColor getTransparentColor();
  +
  +    /**
  +     * Get the PDF reference for a bitmap mask.
  +     *
  +     * @return the PDF reference for the mask image
  +     */
  +    String getMask();
  +
  +    /**
  +     * Get the PDF reference for a soft mask.
  +     *
  +     * @return the PDF reference for a soft mask image
  +     */
  +    String getSoftMask();
   
       // get the image bytes, and bytes properties
   
  -    public PDFStream getDataStream() throws IOException;
  -
  -    public PDFICCStream getICCStream();
  +    /**
  +     * Get the data stream containing the image contents.
  +     *
  +     * @throws IOException if there creating stream
  +     * @return the PDFStream containing the image data
  +     */
  +    PDFStream getDataStream() throws IOException;
  +
  +    /**
  +     * Get the ICC stream for this image.
  +     *
  +     * @return the ICC stream for this image if any
  +     */
  +    PDFICCStream getICCStream();
   
   }
   
  
  
  
  1.11      +28 -8     xml-fop/src/org/apache/fop/pdf/PDFInfo.java
  
  Index: PDFInfo.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/pdf/PDFInfo.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- PDFInfo.java	20 Nov 2002 07:51:35 -0000	1.10
  +++ PDFInfo.java	11 Jan 2003 19:38:52 -0000	1.11
  @@ -1,6 +1,6 @@
   /*
    * $Id$
  - * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
  + * Copyright (C) 2001-2003 The Apache Software Foundation. All rights reserved.
    * For details on use and redistribution please refer to the
    * LICENSE file included with these sources.
    */
  @@ -18,16 +18,16 @@
       /**
        * the application producing the PDF
        */
  -    protected String producer;
  +    private String producer;
   
  -    protected String title = null;
  -    protected String author = null;
  -    protected String subject = null;
  -    protected String keywords = null;
  +    private String title = null;
  +    private String author = null;
  +    private String subject = null;
  +    private String keywords = null;
   
       // the name of the application that created the
       // original document before converting to PDF
  -    protected String creator;
  +    private String creator;
   
       /**
        * create an Info object
  @@ -56,18 +56,38 @@
           this.creator = creator;
       }
   
  +    /**
  +     * set the title string
  +     *
  +     * @param t the document title
  +     */
       public void setTitle(String t) {
           this.title = t;
       }
   
  +    /**
  +     * set the author string
  +     *
  +     * @param a the document author
  +     */
       public void setAuthor(String a) {
           this.author = a;
       }
   
  +    /**
  +     * set the subject string
  +     *
  +     * @param s the document subject
  +     */
       public void setSubject(String s) {
           this.subject = s;
       }
   
  +    /**
  +     * set the keywords string
  +     *
  +     * @param k the keywords for this document
  +     */
       public void setKeywords(String k) {
           this.keywords = k;
       }
  
  
  
  1.4       +3 -4      xml-fop/src/org/apache/fop/pdf/PDFInternalLink.java
  
  Index: PDFInternalLink.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/pdf/PDFInternalLink.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- PDFInternalLink.java	30 Jul 2001 20:29:30 -0000	1.3
  +++ PDFInternalLink.java	11 Jan 2003 19:38:52 -0000	1.4
  @@ -1,6 +1,6 @@
   /*
    * $Id$
  - * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
  + * Copyright (C) 2001-2003 The Apache Software Foundation. All rights reserved.
    * For details on use and redistribution please refer to the
    * LICENSE file included with these sources.
    */
  @@ -12,8 +12,7 @@
    */
   public class PDFInternalLink extends PDFAction {
   
  -
  -    String goToReference;
  +    private String goToReference;
   
       /**
        * create an internal link instance.
  
  
  
  1.8       +28 -29    xml-fop/src/org/apache/fop/pdf/PDFNumber.java
  
  Index: PDFNumber.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/pdf/PDFNumber.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- PDFNumber.java	25 Oct 2002 09:29:46 -0000	1.7
  +++ PDFNumber.java	11 Jan 2003 19:38:52 -0000	1.8
  @@ -1,47 +1,37 @@
   /*
    * $Id$
  - * Copyright (C) 2001-2002 The Apache Software Foundation. All rights reserved.
  + * Copyright (C) 2001-2003 The Apache Software Foundation. All rights reserved.
    * For details on use and redistribution please refer to the
    * LICENSE file included with these sources.
    */
   
   package org.apache.fop.pdf;
   
  +/**
  + * This class contains some utility methods for outputing numbers to PDF.
  + */
   public class PDFNumber {
   
  +    /** prevent instantiation */
       private PDFNumber() { }
   
  +    /**
  +     * Output a Double value to a string suitable for PDF.
  +     *
  +     * @param doubleDown the Double value
  +     * @return the value as a string
  +     */
       public static String doubleOut(Double doubleDown) {
  -        StringBuffer p = new StringBuffer();
  -        if (doubleDown.doubleValue() < 0) {
  -            doubleDown = new Double(-doubleDown.doubleValue());
  -            p.append("-");
  -        }
  -        double trouble = doubleDown.doubleValue() % 1;
  -        if (trouble > 0.950) {
  -            p.append(doubleDown.intValue() + 1);
  -        } else if (trouble < 0.050) {
  -            p.append(doubleDown.intValue());
  -        } else {
  -            String doubleString = new String(doubleDown + "");
  -            int decimal = doubleString.indexOf(".");
  -            if (decimal != -1) {
  -                p.append(doubleString.substring(0, decimal));
  -
  -                if ((doubleString.length() - decimal) > 6) {
  -                    p.append(doubleString.substring(decimal, decimal + 6));
  -                } else {
  -                    p.append(doubleString.substring(decimal));
  -                }
  -            } else {
  -                p.append(doubleString);
  -            }
  -        }
  -        return (p.toString());
  +        return doubleOut(doubleDown.doubleValue());
       }
   
  +    /**
  +     * Output a double value to a string suitable for PDF.
  +     *
  +     * @param doubleDown the double value
  +     * @return the value as a string
  +     */
       public static String doubleOut(double doubleDown) {
  -
           StringBuffer p = new StringBuffer();
           if (doubleDown < 0) {
               doubleDown = -doubleDown;
  @@ -71,6 +61,15 @@
           return (p.toString());
       }
   
  +    /**
  +     * Output a double value to a string suitable for PDF.
  +     * In this method it is possible to set the maximum
  +     * number of decimal places to output.
  +     *
  +     * @param doubleDown the Double value
  +     * @param dec the number of decimal places to output
  +     * @return the value as a string
  +     */
       public static String doubleOut(double doubleDown, int dec) {
           StringBuffer p = new StringBuffer();
           if (doubleDown < 0) {
  
  
  
  1.11      +6 -2      xml-fop/src/org/apache/fop/pdf/PDFObject.java
  
  Index: PDFObject.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/pdf/PDFObject.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- PDFObject.java	30 Jul 2001 20:29:30 -0000	1.10
  +++ PDFObject.java	11 Jan 2003 19:38:52 -0000	1.11
  @@ -1,6 +1,6 @@
   /*
    * $Id$
  - * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
  + * Copyright (C) 2001-2003 The Apache Software Foundation. All rights reserved.
    * For details on use and redistribution please refer to the
    * LICENSE file included with these sources.
    */
  @@ -39,6 +39,9 @@
           this.number = number;
       }
   
  +    /**
  +     * Create a PDFObject
  +     */
       public PDFObject() {
           // do nothing
       }
  @@ -54,6 +57,7 @@
        * write the PDF represention of this object
        *
        * @param stream the stream to write the PDF to
  +     * @throws IOException if there is an error writing to the stream
        * @return the number of bytes written
        */
       protected int output(OutputStream stream) throws IOException {
  
  
  
  1.5       +72 -64    xml-fop/src/org/apache/fop/pdf/PDFOutline.java
  
  Index: PDFOutline.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/pdf/PDFOutline.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- PDFOutline.java	29 Nov 2002 23:18:56 -0000	1.4
  +++ PDFOutline.java	11 Jan 2003 19:38:52 -0000	1.5
  @@ -1,14 +1,14 @@
   /*
    * $Id$
  - * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
  + * Copyright (C) 2001-2003 The Apache Software Foundation. All rights reserved.
    * For details on use and redistribution please refer to the
    * LICENSE file included with these sources.
    */
   
   package org.apache.fop.pdf;
   
  -import java.util.Vector;
  -
  +import java.util.List;
  +import java.util.ArrayList;
   
   /**
    * This represents a single Outline object in a PDF, including the root Outlines
  @@ -18,125 +18,133 @@
    * @author Kelly A. Campbell
    *
    */
  -
   public class PDFOutline extends PDFObject {
   
       /**
        * list of sub-entries (outline objects)
        */
  -    private Vector _subentries;
  +    private List subentries;
   
       /**
        * parent outline object. Root Outlines parent is null
        */
  -    private PDFOutline _parent;
  +    private PDFOutline parent;
   
  -    private PDFOutline _prev;
  -    private PDFOutline _next;
  +    private PDFOutline prev;
  +    private PDFOutline next;
   
  -    private PDFOutline _first;
  -    private PDFOutline _last;
  -
  -    private int _count;
  +    private PDFOutline first;
  +    private PDFOutline last;
   
  +    private int count;
   
       /**
        * title to display for the bookmark entry
        */
  -    private String _title;
  -
  -    String _actionRef;
  -
  +    private String title;
   
  +    private String actionRef;
   
       /**
  +     * Create a PDF outline with the title and action.
  +     *
        * @param number the object id number
        * @param title the title of the outline entry (can only be null for root Outlines obj)
  -     * @param page the page which this outline refers to.
  +     * @param action the action for this outline
        */
       public PDFOutline(int number, String title, String action) {
           super(number);
  -        _subentries = new Vector();
  -        _count = 0;
  -        _parent = null;
  -        _prev = null;
  -        _next = null;
  -        _first = null;
  -        _last = null;
  -        _title = title;
  -        _actionRef = action;
  -
  -
  +        subentries = new ArrayList();
  +        count = 0;
  +        parent = null;
  +        prev = null;
  +        next = null;
  +        first = null;
  +        last = null;
  +        title = title;
  +        actionRef = action;
       }
   
  -    public void setTitle(String title) {
  -        _title = title;
  +    /**
  +     * Set the title of this Outline object.
  +     *
  +     * @param t the title of the outline
  +     */
  +    public void setTitle(String t) {
  +        title = t;
       }
   
       /**
  -     * Add a sub element to this outline
  +     * Add a sub element to this outline.
  +     *
  +     * @param outline a sub outline
        */
       public void addOutline(PDFOutline outline) {
  -        if (_subentries.size() > 0) {
  -            outline._prev =
  -                (PDFOutline)_subentries.elementAt(_subentries.size() - 1);
  -            outline._prev._next = outline;
  +        if (subentries.size() > 0) {
  +            outline.prev =
  +                (PDFOutline)subentries.get(subentries.size() - 1);
  +            outline.prev.next = outline;
           } else {
  -            _first = outline;
  +            first = outline;
           }
   
  -        _subentries.addElement(outline);
  -        outline._parent = this;
  -
  -        incrementCount();    // note: count is not just the immediate children
  +        subentries.add(outline);
  +        outline.parent = this;
   
  -        _last = outline;
  +        // note: count is not just the immediate children
  +        incrementCount();
   
  +        last = outline;
       }
   
  +    /**
  +     * Increment the number of subentries and descendants.
  +     */
       private void incrementCount() {
  -        // count is a total of our immediate subentries and all descendent subentries
  -        _count++;
  -        if (_parent != null) {
  -            _parent.incrementCount();
  +        // count is a total of our immediate subentries
  +        // and all descendent subentries
  +        count++;
  +        if (parent != null) {
  +            parent.incrementCount();
           }
       }
   
  -
       /**
        * represent the object in PDF
  +     *
  +     * @return the PDF for this outline
        */
       protected byte[] toPDF() {
           StringBuffer result = new StringBuffer(this.number + " "
                                                  + this.generation
                                                  + " obj\n<<\n");
  -        if (_parent == null) {
  +        if (parent == null) {
               // root Outlines object
  -            if (_first != null && _last != null) {
  -                result.append(" /First " + _first.referencePDF() + "\n");
  -                result.append(" /Last " + _last.referencePDF() + "\n");
  +            if (first != null && last != null) {
  +                result.append(" /First " + first.referencePDF() + "\n");
  +                result.append(" /Last " + last.referencePDF() + "\n");
                   // no count... we start with the outline completely closed for now
               }
           } else {
               // subentry Outline object
  -            result.append(" /Title (" + escapeString(_title) + ")\n");
  -            result.append(" /Parent " + _parent.referencePDF() + "\n");
  -            if (_first != null && _last != null) {
  -                result.append(" /First " + _first.referencePDF() + "\n");
  -                result.append(" /Last " + _last.referencePDF() + "\n");
  +            result.append(" /Title (" + escapeString(title) + ")\n");
  +            result.append(" /Parent " + parent.referencePDF() + "\n");
  +            if (first != null && last != null) {
  +                result.append(" /First " + first.referencePDF() + "\n");
  +                result.append(" /Last " + last.referencePDF() + "\n");
               }
  -            if (_prev != null) {
  -                result.append(" /Prev " + _prev.referencePDF() + "\n");
  +            if (prev != null) {
  +                result.append(" /Prev " + prev.referencePDF() + "\n");
               }
  -            if (_next != null) {
  -                result.append(" /Next " + _next.referencePDF() + "\n");
  +            if (next != null) {
  +                result.append(" /Next " + next.referencePDF() + "\n");
               }
  -            if (_count > 0) {
  -                result.append(" /Count -" + _count + "\n");
  +            if (count > 0) {
  +                result.append(" /Count -" + count + "\n");
               }
   
  -            if (_actionRef != null) {
  -                result.append(" /A " + _actionRef + "\n");
  +            if (actionRef != null) {
  +                result.append(" /A " + actionRef + "\n");
               }
   
   
  
  
  
  1.20      +12 -2     xml-fop/src/org/apache/fop/pdf/PDFPage.java
  
  Index: PDFPage.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/pdf/PDFPage.java,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- PDFPage.java	29 Nov 2002 23:18:56 -0000	1.19
  +++ PDFPage.java	11 Jan 2003 19:38:52 -0000	1.20
  @@ -1,6 +1,6 @@
   /*
    * $Id$
  - * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
  + * Copyright (C) 2001-2003 The Apache Software Foundation. All rights reserved.
    * For details on use and redistribution please refer to the
    * LICENSE file included with these sources.
    */
  @@ -56,6 +56,7 @@
       /**
        * create a /Page object
        *
  +     * @param doc the PDF document holding this page
        * @param number the object's number
        * @param resources the /Resources object
        * @param contents the content stream
  @@ -77,6 +78,7 @@
       /**
        * create a /Page object
        *
  +     * @param doc the PDF document holding this page
        * @param number the object's number
        * @param resources the /Resources object
        * @param pagewidth the page's width in points
  @@ -111,6 +113,14 @@
           this.parent = parent.referencePDF();
       }
   
  +    /**
  +     * Set the transition dictionary and duration.
  +     * This sets the duration of the page and the transition
  +     * dictionary used when going to the next page.
  +     *
  +     * @param dur the duration in seconds
  +     * @param tr the transition dictionary
  +     */
       public void setTransition(int dur, TransitionDictionary tr) {
           duration = dur;
           trDictionary = tr;
  
  
  
  1.15      +4 -4      xml-fop/src/org/apache/fop/pdf/PDFPages.java
  
  Index: PDFPages.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/pdf/PDFPages.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- PDFPages.java	22 Nov 2001 07:11:40 -0000	1.14
  +++ PDFPages.java	11 Jan 2003 19:38:52 -0000	1.15
  @@ -1,6 +1,6 @@
   /*
    * $Id$
  - * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
  + * Copyright (C) 2001-2003 The Apache Software Foundation. All rights reserved.
    * For details on use and redistribution please refer to the
    * LICENSE file included with these sources.
    */
  @@ -8,7 +8,7 @@
   package org.apache.fop.pdf;
   
   // Java
  -import java.io.PrintWriter;
  +import java.util.List;
   import java.util.ArrayList;
   
   /**
  @@ -23,7 +23,7 @@
       /**
        * the /Page objects
        */
  -    protected ArrayList kids = new ArrayList();
  +    protected List kids = new ArrayList();
   
       /**
        * the number of /Page objects
  
  
  
  1.7       +34 -5     xml-fop/src/org/apache/fop/pdf/PDFPathPaint.java
  
  Index: PDFPathPaint.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/pdf/PDFPathPaint.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- PDFPathPaint.java	27 Jun 2002 11:45:54 -0000	1.6
  +++ PDFPathPaint.java	11 Jan 2003 19:38:52 -0000	1.7
  @@ -1,36 +1,65 @@
   /*
    * $Id$
  - * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
  + * Copyright (C) 2001-2003 The Apache Software Foundation. All rights reserved.
    * For details on use and redistribution please refer to the
    * LICENSE file included with these sources.
    */
   
   package org.apache.fop.pdf;
   
  +/**
  + * Base class for PDF painting operations.
  + *
  + */
   public abstract class PDFPathPaint extends PDFObject {
   
  -    // protected int colorspace = 0; //default is 0:RGB, not 1:CMYK
  +    /**
  +     * The color space for this paint
  +     */
       protected PDFColorSpace colorSpace;
   
  +    /**
  +     * Create a path paint with a PDF object number.
  +     *
  +     * @param theNumber the PDF object number
  +     */
       public PDFPathPaint(int theNumber) {
           super(theNumber);
  -
       }
   
  +    /**
  +     * Create an emty path paint.
  +     */
       public PDFPathPaint() {
           // do nothing
       }
   
  +    /**
  +     * Get the PDF string for setting the path paint.
  +     *
  +     * @param fillNotStroke if true fill otherwise stroke
  +     * @return the PDF instruction string
  +     */
       public String getColorSpaceOut(boolean fillNotStroke) {
           return ("");
       }
   
  +    /**
  +     * Set the color space for this paint.
  +     *
  +     * @param theColorSpace the color space value
  +     */
       public void setColorSpace(int theColorSpace) {
           this.colorSpace.setColorSpace(theColorSpace);
       }
   
  +    /**
  +     * Get the current color space value for this paint.
  +     *
  +     * @return the color space value
  +     */
       public int getColorSpace() {
  -        return (this.colorSpace.getColorSpace());
  +        return this.colorSpace.getColorSpace();
       }
   
   }
  
  
  
  1.17      +23 -9     xml-fop/src/org/apache/fop/pdf/PDFPattern.java
  
  Index: PDFPattern.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/pdf/PDFPattern.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- PDFPattern.java	22 Nov 2002 10:32:20 -0000	1.16
  +++ PDFPattern.java	11 Jan 2003 19:38:52 -0000	1.17
  @@ -1,6 +1,6 @@
   /*
    * $Id$
  - * Copyright (C) 2001-2002 The Apache Software Foundation. All rights reserved.
  + * Copyright (C) 2001-2003 The Apache Software Foundation. All rights reserved.
    * For details on use and redistribution please refer to the
    * LICENSE file included with these sources.
    */
  @@ -28,8 +28,6 @@
       /**
        * The resources associated with this pattern
        */
  -    // Guts common to all function types
  -
       protected PDFResources resources = null;
   
       /**
  @@ -170,6 +168,12 @@
           return (this.patternName);
       }
   
  +    /**
  +     * Get the PDF command for setting to this pattern.
  +     *
  +     * @param fillNotStroke if true fill otherwise stroke
  +     * @return the PDF string for setting the pattern
  +     */
       public String getColorSpaceOut(boolean fillNotStroke) {
           if (fillNotStroke) {    // fill but no stroke
               return ("/Pattern cs /" + this.getName() + " scn \n");
  @@ -178,7 +182,6 @@
           }
       }
   
  -
       /**
        * represent as PDF. Whatever the FunctionType is, the correct
        * representation spits out. The sets of required and optional
  @@ -188,6 +191,8 @@
        * by the construction is dutifully output.
        * This policy should be reviewed.
        *
  +     * @param stream the stream to write to
  +     * @throws IOException if there is an error writing to the stream
        * @return the PDF string.
        */
       protected int output(OutputStream stream) throws IOException {
  @@ -254,8 +259,9 @@
                            + " \n");
               }
   
  -        } else    // if (this.patternType ==2)
  -         {        // Smooth Shading...
  +        } else {
  +            // if (this.patternType ==2)
  +            // Smooth Shading...
               if (this.shading != null) {
                   p.append("/Shading " + this.shading.referencePDF() + " \n");
               }
  @@ -300,13 +306,21 @@
           stream.write(end.getBytes());
           length += end.length();
   
  -
           return length;
  -
       }
   
  +    /**
  +     * Output PDF bytes, not used.
  +     * @return returns null
  +     */
       public byte[] toPDF() { return null; }
   
  +    /**
  +     * Check if this pattern is equal to another.
  +     *
  +     * @param obj the object to compare against
  +     * @return true if the patterns are equal
  +     */
       public boolean equals(Object obj) {
           if (obj == null) {
               return false;
  
  
  
  1.5       +7 -2      xml-fop/src/org/apache/fop/pdf/PDFRectangle.java
  
  Index: PDFRectangle.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/pdf/PDFRectangle.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- PDFRectangle.java	30 Jul 2001 20:29:30 -0000	1.4
  +++ PDFRectangle.java	11 Jan 2003 19:38:52 -0000	1.5
  @@ -1,6 +1,6 @@
   /*
    * $Id$
  - * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
  + * Copyright (C) 2001-2003 The Apache Software Foundation. All rights reserved.
    * For details on use and redistribution please refer to the
    * LICENSE file included with these sources.
    */
  @@ -70,6 +70,11 @@
           return toPDFString().getBytes();
       }
   
  +    /**
  +     * Create a PDF string for this rectangle.
  +     *
  +     * @return the pdf string
  +     */
       public String toPDFString() {
           return new String(" [" + llx + " " + lly + " " + urx + " " + ury
                             + "] ");
  
  
  
  1.4       +35 -9     xml-fop/src/org/apache/fop/pdf/PDFResourceContext.java
  
  Index: PDFResourceContext.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/pdf/PDFResourceContext.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- PDFResourceContext.java	29 Nov 2002 23:18:56 -0000	1.3
  +++ PDFResourceContext.java	11 Jan 2003 19:38:52 -0000	1.4
  @@ -1,6 +1,6 @@
   /*
    * $Id$
  - * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
  + * Copyright (C) 2001-2003 The Apache Software Foundation. All rights reserved.
    * For details on use and redistribution please refer to the
    * LICENSE file included with these sources.
    */
  @@ -8,7 +8,7 @@
   package org.apache.fop.pdf;
   
   /**
  - * class representing a /Page object.
  + * The PDF resource context.
    *
    * There is one of these for every page in a PDF document. The object
    * specifies the dimensions of the page and references a /Resources
  @@ -32,18 +32,19 @@
        * the list of annotation objects for this page
        */
       protected PDFAnnotList annotList;
  +
  +    /**
  +     * Reference to document used when creating annotation list
  +     */
       protected PDFDocument document;
   
       /**
        *
        * @param number the object's number
  +     * @param doc the PDF document this belongs to
        * @param resources the /Resources object
  -     * @param contents the content stream
  -     * @param pagewidth the page's width in points
  -     * @param pageheight the page's height in points
        */
       public PDFResourceContext(int number, PDFDocument doc, PDFResources resources) {
  -
           /* generic creation of object */
           super(number);
   
  @@ -53,6 +54,11 @@
           this.annotList = null;
       }
   
  +    /**
  +     * Get the resources for this resource context.
  +     *
  +     * @return the resources in this resource context
  +     */
       public PDFResources getPDFResources() {
           return this.resources;
       }
  @@ -60,27 +66,47 @@
       /**
        * set this page's annotation list
        *
  -     * @param annotList a PDFAnnotList list of annotations
  +     * @param annot a PDFAnnotList list of annotations
        */
       public void addAnnotation(PDFObject annot) {
  -        if(this.annotList == null) {
  +        if (this.annotList == null) {
               this.annotList = document.makeAnnotList();
           }
           this.annotList.addAnnot(annot);
       }
   
  +    /**
  +     * Get the current annotations.
  +     *
  +     * @return the current annotation list
  +     */
       public PDFAnnotList getAnnotations() {
           return this.annotList;
       }
   
  +    /**
  +     * A a GState to this resource context.
  +     *
  +     * @param gstate the GState to add
  +     */
       public void addGState(PDFGState gstate) {
           this.resources.addGState(gstate);
       }
   
  +    /**
  +     * Add the shading tot he current resource context.
  +     *
  +     * @param shading the shading to add
  +     */
       public void addShading(PDFShading shading) {
           this.resources.addShading(shading);
       }
   
  +    /**
  +     * Get the PDF, unused.
  +     *
  +     * @return null value
  +     */
       public byte[] toPDF() {
           return null;
       }
  
  
  
  1.16      +50 -13    xml-fop/src/org/apache/fop/pdf/PDFResources.java
  
  Index: PDFResources.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/pdf/PDFResources.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- PDFResources.java	19 Jul 2002 07:16:21 -0000	1.15
  +++ PDFResources.java	11 Jan 2003 19:38:52 -0000	1.16
  @@ -1,6 +1,6 @@
   /*
    * $Id$
  - * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
  + * Copyright (C) 2001-2003 The Apache Software Foundation. All rights reserved.
    * For details on use and redistribution please refer to the
    * LICENSE file included with these sources.
    */
  @@ -8,9 +8,9 @@
   package org.apache.fop.pdf;
   
   // Java
  -import java.io.PrintWriter;
   import java.util.Iterator;
  -import java.util.ArrayList;
  +import java.util.Map;
  +import java.util.Set;
   import java.util.HashMap;
   import java.util.HashSet;
   
  @@ -25,12 +25,27 @@
       /**
        * /Font objects keyed by their internal name
        */
  -    protected HashMap fonts = new HashMap();
  +    protected Map fonts = new HashMap();
   
  -    protected HashSet xObjects = new HashSet();
  -    protected HashSet patterns = new HashSet();
  -    protected HashSet shadings = new HashSet();
  -    protected HashSet gstates = new HashSet();
  +    /**
  +     * Set of XObjects
  +     */
  +    protected Set xObjects = new HashSet();
  +
  +    /**
  +     * Set of patterns
  +     */
  +    protected Set patterns = new HashSet();
  +
  +    /**
  +     * Set of shadings
  +     */
  +    protected Set shadings = new HashSet();
  +
  +    /**
  +     * Set of ExtGStates
  +     */
  +    protected Set gstates = new HashSet();
   
       /**
        * create a /Resources object.
  @@ -51,24 +66,46 @@
           this.fonts.put(font.getName(), font);
       }
   
  +    /**
  +     * Add a PDFGState to the resources.
  +     *
  +     * @param gs the PDFGState to add
  +     */
       public void addGState(PDFGState gs) {
           this.gstates.add(gs);
       }
   
  +    /**
  +     * Add a Shading to the resources.
  +     *
  +     * @param theShading the shading to add
  +     */
       public void addShading(PDFShading theShading) {
           this.shadings.add(theShading);
       }
   
  +    /**
  +     * Add the pattern to the resources.
  +     *
  +     * @param thePattern the pattern to add
  +     */
       public void addPattern(PDFPattern thePattern) {
           this.patterns.add(thePattern);
       }
   
  +    /**
  +     * Add an XObject to the resources.
  +     *
  +     * @param xObject the XObject to add
  +     */
       public void addXObject(PDFXObject xObject) {
           this.xObjects.add(xObject);
       }
   
       /**
        * represent the object in PDF
  +     * This adds the references to all the objects in the current
  +     * resource context.
        *
        * @return the PDF
        */
  @@ -94,7 +131,7 @@
           if (!this.shadings.isEmpty()) {
               p.append("/Shading << ");
   
  -            for (Iterator iter = shadings.iterator(); iter.hasNext(); ) {
  +            for (Iterator iter = shadings.iterator(); iter.hasNext();) {
                   currentShading = (PDFShading)iter.next();
                   p.append("/" + currentShading.getName() + " "
                            + currentShading.referencePDF() + " ");    // \n ??????
  @@ -109,7 +146,7 @@
           if (!this.patterns.isEmpty()) {
               p.append("/Pattern << ");
   
  -            for (Iterator iter = patterns.iterator(); iter.hasNext(); ) {
  +            for (Iterator iter = patterns.iterator(); iter.hasNext();) {
                   currentPattern = (PDFPattern)iter.next();
                   p.append("/" + currentPattern.getName() + " "
                            + currentPattern.referencePDF() + " ");
  @@ -124,7 +161,7 @@
   
           if (this.xObjects != null && !this.xObjects.isEmpty()) {
               p = p.append("/XObject <<");
  -            for (Iterator iter = xObjects.iterator(); iter.hasNext(); ) {
  +            for (Iterator iter = xObjects.iterator(); iter.hasNext();) {
                   PDFXObject xobj = (PDFXObject)iter.next();
                   p = p.append("/Im" + xobj.getXNumber() + " "
                                + xobj.referencePDF()
  @@ -135,7 +172,7 @@
   
           if (!this.gstates.isEmpty()) {
               p = p.append("/ExtGState <<");
  -            for (Iterator iter = gstates.iterator(); iter.hasNext(); ) {
  +            for (Iterator iter = gstates.iterator(); iter.hasNext();) {
                   PDFGState gs = (PDFGState)iter.next();
                   p = p.append("/" + gs.getName() + " "
                                + gs.referencePDF()
  
  
  
  1.12      +17 -13    xml-fop/src/org/apache/fop/pdf/PDFRoot.java
  
  Index: PDFRoot.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/pdf/PDFRoot.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- PDFRoot.java	11 Nov 2002 08:50:51 -0000	1.11
  +++ PDFRoot.java	11 Jan 2003 19:38:52 -0000	1.12
  @@ -1,16 +1,12 @@
   /*
    * $Id$
  - * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
  + * Copyright (C) 2001-2003 The Apache Software Foundation. All rights reserved.
    * For details on use and redistribution please refer to the
    * LICENSE file included with these sources.
    */
   
   package org.apache.fop.pdf;
   
  -// Java
  -import java.io.IOException;
  -import java.io.PrintWriter;
  -
   /**
    * class representing a Root (/Catalog) object
    */
  @@ -34,6 +30,7 @@
        * table as part of the trsailer). (mark-fop@inomial.com)
        *
        * @param number the object's number
  +     * @param pages the PDFPages object
        */
       public PDFRoot(int number, PDFPages pages) {
           super(number);
  @@ -45,9 +42,9 @@
        * make sure it's object number is set. Package-private access
        * only; outsiders should not be fiddling with this stuff.
        */
  -    void setNumber(int number) {
  +    /*void setNumber(int number) {
           this.number = number;
  -    }
  +    }*/
   
       /**
        * add a /Page object to the root /Pages object
  @@ -67,10 +64,20 @@
           this.rootPages = pages;
       }
   
  +    /**
  +     * Set the root outline for the PDF document.
  +     *
  +     * @param out the root PDF Outline
  +     */
       public void setRootOutline(PDFOutline out) {
           outline = out;
       }
   
  +    /**
  +     * Get the root PDF outline for the document.
  +     *
  +     * @return the root PDF Outline
  +     */
       public PDFOutline getRootOutline() {
           return outline;
       }
  @@ -78,13 +85,9 @@
       /**
        * represent the object as PDF.
        *
  -     * @throws IllegalStateException if the setNumber() method has
  -     * not been called.
  -     *
        * @return the PDF string
        */
  -    public byte[] toPDF()
  -    throws IllegalStateException {
  +    public byte[] toPDF() {
           StringBuffer p = new StringBuffer(this.number + " " + this.generation
                                             + " obj\n<< /Type /Catalog\n/Pages "
                                             + this.rootPages.referencePDF()
  @@ -93,6 +96,7 @@
               p.append(" /Outlines " + outline.referencePDF() + "\n");
               p.append(" /PageMode /UseOutlines\n");
           }
  +        p.append(" /PageMode /FullScreen\n");
           p.append(" >>\nendobj\n");
           return p.toString().getBytes();
       }
  
  
  
  1.13      +47 -22    xml-fop/src/org/apache/fop/pdf/PDFShading.java
  
  Index: PDFShading.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/pdf/PDFShading.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- PDFShading.java	22 Nov 2002 10:32:20 -0000	1.12
  +++ PDFShading.java	11 Jan 2003 19:38:52 -0000	1.13
  @@ -1,6 +1,6 @@
   /*
    * $Id$
  - * Copyright (C) 2001-2002 The Apache Software Foundation. All rights reserved.
  + * Copyright (C) 2001-2003 The Apache Software Foundation. All rights reserved.
    * For details on use and redistribution please refer to the
    * LICENSE file included with these sources.
    */
  @@ -36,7 +36,6 @@
       /**
        * A ColorSpace representing the colorspace. "DeviceRGB" is an example.
        */
  -    // protected StringBuffer colorSpace = null;
       protected PDFColorSpace colorSpace = null;
   
       /**
  @@ -57,11 +56,13 @@
       protected boolean antiAlias = false;
   
       /**
  -     * Optional for Type 1: Array of four numbers, xmin, xmax, ymin, ymax. Default is [0 1 0 1]
  -     * Optional for Type 2: An array of two numbers between which the blend varies between start and end points. Default is 0, 1.
  -     * Optional for Type 3: An array of two numbers between which the blend varies between start and end points. Default is 0, 1.
  +     * Optional for Type 1: Array of four numbers, xmin, xmax, ymin, ymax.
  +     *                      Default is [0 1 0 1]
  +     * Optional for Type 2: An array of two numbers between which the blend
  +     *                      varies between start and end points. Default is 0, 1.
  +     * Optional for Type 3: An array of two numbers between which the blend
  +     *                      varies between start and end points. Default is 0, 1.
        */
  -
       protected List domain = null;
   
       /**
  @@ -77,46 +78,56 @@
       protected PDFFunction function = null;
   
       /**
  -     * Required for Type 2: An Array of four numbers specifying the starting and ending coordinate pairs
  -     * Required for Type 3: An Array of six numbers [x0,y0,r0,x1,y1,r1] specifying the centers and radii of
  -     * the starting and ending circles.
  +     * Required for Type 2: An Array of four numbers specifying
  +     *                      the starting and ending coordinate pairs
  +     * Required for Type 3: An Array of six numbers [x0,y0,r0,x1,y1,r1]
  +     *                      specifying the centers and radii of
  +     *                      the starting and ending circles.
        */
       protected List coords = null;
   
       /**
  -     * Required for Type 2+3: An Array of two boolean values specifying whether to extend the
  -     * start and end colors past the start and end points,
  -     * respectively. Default is false, false.
  +     * Required for Type 2+3: An Array of two boolean values specifying
  +     * whether to extend the start and end colors past the start
  +     * and end points, respectively.
  +     * Default is false, false.
        */
       protected List extend = null;
   
       /**
  -     * Required for Type 4,5,6, and 7: Specifies the number of bits used to represent each vertex coordinate.
  +     * Required for Type 4,5,6, and 7: Specifies the number of bits used
  +     * to represent each vertex coordinate.
        * Allowed to be 1,2,4,8,12,16,24, or 32.
        */
       protected int bitsPerCoordinate = 0;
   
       /**
  -     * Required for Type 4,5,6, and 7: Specifies the number of bits used to represent the edge flag for each vertex.
  -     * Allowed to be 2,4,or 8, while the Edge flag itself is allowed to be 0,1 or 2.
  +     * Required for Type 4,5,6, and 7: Specifies the number of bits used
  +     * to represent the edge flag for each vertex.
  +     * Allowed to be 2,4,or 8, while the Edge flag itself is allowed to
  +     * be 0,1 or 2.
        */
       protected int bitsPerFlag = 0;
   
       /**
  -     * Required for Type 4,5,6, and 7: Array of Doubles which specifies how to decode coordinate and color component values.
  -     * Each type has a differing number of decode array members, so check the spec.
  +     * Required for Type 4,5,6, and 7: Array of Doubles which specifies
  +     * how to decode coordinate and color component values.
  +     * Each type has a differing number of decode array members, so check
  +     * the spec.
        * Page 303 in PDF Spec 1.3
        */
       protected List decode = null;
   
       /**
  -     * Required for Type 4,5,6, and 7: Specifies the number of bits used to represent each color coordinate.
  +     * Required for Type 4,5,6, and 7: Specifies the number of bits used
  +     * to represent each color coordinate.
        * Allowed to be 1,2,4,8,12, or 16
        */
       protected int bitsPerComponent = 0;
   
       /**
  -     * Required for Type 5:The number of vertices in each "row" of the lattice; it must be greater than or equal to 2.
  +     * Required for Type 5:The number of vertices in each "row" of
  +     * the lattice; it must be greater than or equal to 2.
        */
       protected int verticesPerRow = 0;
   
  @@ -181,8 +192,10 @@
        * @param theAntiAlias Default is false
        * @param theCoords List of four (type 2) or 6 (type 3) Double
        * @param theDomain List of Doubles specifying the domain
  -     * @param theFunction the Stitching (PDFfunction type 3) function, even if it's stitching a single function
  -     * @param theExtend List of Booleans of whether to extend teh start and end colors past the start and end points
  +     * @param theFunction the Stitching (PDFfunction type 3) function,
  +     *                    even if it's stitching a single function
  +     * @param theExtend List of Booleans of whether to extend the start
  +     *                  and end colors past the start and end points
        * The default is [false, false]
        */
       public PDFShading(int theNumber, String theShadingName,
  @@ -295,6 +308,11 @@
   
       }
   
  +    /**
  +     * Get the name of this shading.
  +     *
  +     * @return the name of the shading
  +     */
       public String getName() {
           return (this.shadingName);
       }
  @@ -505,6 +523,13 @@
           return (p.toString().getBytes());
       }
   
  +    /**
  +     * Check if this shading is equal to another shading.
  +     * This is used to check if a shading already exists.
  +     *
  +     * @param obj the object to compare against
  +     * @return true if the shadings are equal
  +     */
       public boolean equals(Object obj) {
           if (obj == null) {
               return false;
  
  
  
  1.8       +95 -8     xml-fop/src/org/apache/fop/pdf/PDFState.java
  
  Index: PDFState.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/pdf/PDFState.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- PDFState.java	25 Oct 2002 09:29:46 -0000	1.7
  +++ PDFState.java	11 Jan 2003 19:38:52 -0000	1.8
  @@ -1,6 +1,6 @@
   /*
    * $Id$
  - * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
  + * Copyright (C) 2001-2003 The Apache Software Foundation. All rights reserved.
    * For details on use and redistribution please refer to the
    * LICENSE file included with these sources.
    */
  @@ -21,6 +21,8 @@
   /**
    * This keeps information about the current state when writing to pdf.
    * It allows for creating new graphics states with the q operator.
  + * This class is only used to store the information about the state
  + * the caller needs to handle the actual pdf operators.
    *
    * When setting the state for pdf there are three possible ways of
    * handling the situation.
  @@ -68,14 +70,20 @@
       private Shape clip = null;
       private PDFGState gstate = null;
   
  -    ArrayList stateStack = new ArrayList();
  +    private ArrayList stateStack = new ArrayList();
   
  +    /**
  +     * PDF State for storing graphics state.
  +     */
       public PDFState() {
   
       }
   
  -    // this call should be used when the q operator is used
  -    // so that the state is known when popped
  +    /**
  +     * Push the current state onto the stack.
  +     * This call should be used when the q operator is used
  +     * so that the state is known when popped.
  +     */
       public void push() {
           HashMap saveMap = new HashMap();
           saveMap.put(COLOR, color);
  @@ -100,6 +108,11 @@
           transform = new AffineTransform();
       }
   
  +    /**
  +     * Pop the state from the stack and set current values to popped state.
  +     * This should be called when a Q operator is used so
  +     * the state is restored to the correct values.
  +     */
       public void pop() {
           if (getStackLevel() > 0) {
               HashMap saveMap = (HashMap)stateStack.get(stateStack.size() - 1);
  @@ -123,13 +136,25 @@
           }
       }
   
  +    /**
  +     * Get the current stack level.
  +     *
  +     * @return the current stack level
  +     */
       public int getStackLevel() {
           return stateStack.size();
       }
   
  +    /**
  +     * Restore the state to a particular level.
  +     * this can be used to restore to a known level without making
  +     * multiple pop calls.
  +     *
  +     * @param stack the level to restore to
  +     */
       public void restoreLevel(int stack) {
           int pos = stack;
  -        while(stateStack.size() > pos + 1) {
  +        while (stateStack.size() > pos + 1) {
               stateStack.remove(stateStack.size() - 1);
           }
           if (stateStack.size() > pos) {
  @@ -137,10 +162,26 @@
           }
       }
   
  +    /**
  +     * Set the current line dash.
  +     * Check if setting the line dash to the given values
  +     * will make a change and then set the state to the new values.
  +     *
  +     * @param array the line dash array
  +     * @param offset the line dash start offset
  +     * @return true if the line dash has changed
  +     */
       public boolean setLineDash(int[] array, int offset) {
           return false;
       }
   
  +    /**
  +     * Set the current color.
  +     * Check if the new color is a change and then set the current color.
  +     *
  +     * @param col the color to set
  +     * @return true if the color has changed
  +     */
       public boolean setColor(Color col) {
           if (!col.equals(color)) {
               color = col;
  @@ -149,6 +190,13 @@
           return false;
       }
   
  +    /**
  +     * Set the current background color.
  +     * Check if the background color will change and then set the new color.
  +     *
  +     * @param col the new background color
  +     * @return true if the background color has changed
  +     */
       public boolean setBackColor(Color col) {
           if (!col.equals(backcolor)) {
               backcolor = col;
  @@ -157,6 +205,13 @@
           return false;
       }
   
  +    /**
  +     * Set the current paint.
  +     * This checks if the paint will change and then sets the current paint.
  +     *
  +     * @param p the new paint
  +     * @return true if the new paint changes the current paint
  +     */
       public boolean setPaint(Paint p) {
           if (paint == null) {
               if (p != null) {
  @@ -171,7 +226,16 @@
       }
   
       /**
  -     * For clips it can start a new state
  +     * Check if the clip will change the current state.
  +     * A clip is assumed to be used in a situation where it will add
  +     * to any clip in the current or parent states.
  +     * A clip cannot be cleared, this can only be achieved by going to
  +     * a parent level with the correct clip.
  +     * If the clip is different then it may start a new state so that
  +     * it can return to the previous clip.
  +     *
  +     * @param cl the clip shape to check
  +     * @return true if the clip will change the current clip.
        */
       public boolean checkClip(Shape cl) {
           if (clip == null) {
  @@ -181,9 +245,17 @@
           } else if (!new Area(clip).equals(new Area(cl))) {
               return true;
           }
  +        // todo check for clips that are larger than the current
           return false;
       }
   
  +    /**
  +     * Set the current clip.
  +     * This either sets a new clip or sets the clip to the intersect of
  +     * the old clip and the new clip.
  +     *
  +     * @param cl the new clip in the current state
  +     */
       public void setClip(Shape cl) {
           if (clip != null) {
               Area newClip = new Area(clip);
  @@ -194,6 +266,15 @@
           }
       }
   
  +    /**
  +     * Check the current transform.
  +     * The transform for the current state is the combination of all
  +     * transforms in the current state. The parameter is compared
  +     * against this current transform.
  +     *
  +     * @param tf the transform the check against
  +     * @return true if the new transform is different then the current transform
  +     */
       public boolean checkTransform(AffineTransform tf) {
           return !tf.equals(transform);
       }
  @@ -202,6 +283,8 @@
        * Set a new transform.
        * This transform is appended to the transform of
        * the current graphic state.
  +     *
  +     * @param tf the transform to concatonate to the current level transform
        */
       public void setTransform(AffineTransform tf) {
           transform.concatenate(tf);
  @@ -211,6 +294,8 @@
        * Get the current transform.
        * This gets the combination of all transforms in the
        * current state.
  +     *
  +     * @return the calculate combined transform for the current state
        */
       public AffineTransform getTransform() {
           AffineTransform tf;
  @@ -231,6 +316,8 @@
        * the current context.
        * This is the graphic state set with the gs operator not
        * the other graphic state changes.
  +     *
  +     * @return the calculated ExtGState in the current context
        */
       public PDFGState getGState() {
           PDFGState defaultState = PDFGState.DEFAULT;
  @@ -238,7 +325,7 @@
           PDFGState state;
           PDFGState newstate = new PDFGState(0);
           newstate.addValues(defaultState);
  -        for (Iterator iter = stateStack.iterator(); iter.hasNext(); ) {
  +        for (Iterator iter = stateStack.iterator(); iter.hasNext();) {
               HashMap map = (HashMap)iter.next();
               state = (PDFGState)map.get(GSTATE);
               if (state != null) {
  
  
  
  1.19      +2 -2      xml-fop/src/org/apache/fop/pdf/PDFStream.java
  
  Index: PDFStream.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/pdf/PDFStream.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- PDFStream.java	8 Jan 2003 13:57:23 -0000	1.18
  +++ PDFStream.java	11 Jan 2003 19:38:52 -0000	1.19
  @@ -123,7 +123,7 @@
           }
           if (filterset == null || filterset.size() == 0) {
               // built-in default to flate
  -            addFilter(new FlateFilter());
  +            //addFilter(new FlateFilter());
           } else {
               for (int i = 0; i < filterset.size(); i++) {
                   String v = (String)filterset.get(i);
  
  
  
  1.4       +6 -7      xml-fop/src/org/apache/fop/pdf/PDFUri.java
  
  Index: PDFUri.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/pdf/PDFUri.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- PDFUri.java	30 Jul 2001 20:29:30 -0000	1.3
  +++ PDFUri.java	11 Jan 2003 19:38:52 -0000	1.4
  @@ -1,6 +1,6 @@
   /*
    * $Id$
  - * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
  + * Copyright (C) 2001-2003 The Apache Software Foundation. All rights reserved.
    * For details on use and redistribution please refer to the
    * LICENSE file included with these sources.
    */
  @@ -12,8 +12,7 @@
    */
   public class PDFUri extends PDFAction {
   
  -
  -    String uri;
  +    private String uri;
   
       /**
        * create a Uri instance.
  @@ -21,7 +20,6 @@
        * @param uri the uri to which the link should point
        */
       public PDFUri(String uri) {
  -
           this.uri = uri;
       }
   
  @@ -35,9 +33,10 @@
       }
   
       /**
  -     * there is nothing to return for the toPDF method, as it should not be called
  +     * There is nothing to return for the toPDF method
  +     * as it should not be called.
        *
  -     * @return an empty string
  +     * @return an empty array
        */
       public byte[] toPDF() {
           return new byte[0];
  
  
  
  1.2       +28 -6     xml-fop/src/org/apache/fop/pdf/StreamCache.java
  
  Index: StreamCache.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/pdf/StreamCache.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- StreamCache.java	27 May 2002 10:59:07 -0000	1.1
  +++ StreamCache.java	11 Jan 2003 19:38:52 -0000	1.2
  @@ -1,16 +1,14 @@
   /*
    * $Id$
  - * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
  + * Copyright (C) 2001-2003 The Apache Software Foundation. All rights reserved.
    * For details on use and redistribution please refer to the
    * LICENSE file included with these sources.
    */
   
   package org.apache.fop.pdf;
   
  -import java.io.ByteArrayOutputStream;
   import java.io.OutputStream;
   import java.io.IOException;
  -import java.util.ArrayList;
   
   /**
    * class used to store the bytes for a PDFStream. It's actually a generic
  @@ -27,6 +25,8 @@
   
       /**
        * Change the global cacheToFile flag.
  +     *
  +     * @param tizit true if cache to file
        */
       public static void setCacheToFile(boolean tizit) {
           cacheToFile = tizit;
  @@ -34,6 +34,8 @@
   
       /**
        * Get the value of the global cacheToFile flag.
  +     *
  +     * @return the current cache to file flag
        */
       public static boolean getCacheToFile() {
           return cacheToFile;
  @@ -42,42 +44,62 @@
       /**
        * Get the correct implementation (based on cacheToFile) of
        * StreamCache.
  +     *
  +     * @throws IOException if there is an IO error
  +     * @return a new StreamCache for caching streams
        */
       public static StreamCache createStreamCache() throws IOException {
  -        if (cacheToFile)
  +        if (cacheToFile) {
               return new TempFileStreamCache();
  -        else
  +        } else {
               return new InMemoryStreamCache();
  +        }
       }
   
       /**
        * Get the current OutputStream. Do not store it - it may change
        * from call to call.
  +     *
  +     * @throws IOException if there is an IO error
  +     * @return an output stream for this cache
        */
       public abstract OutputStream getOutputStream() throws IOException;
   
       /**
        * Filter the cache with the supplied PDFFilter.
  +     *
  +     * @param filter the filter to apply
  +     * @throws IOException if there is an IO error
        */
       public abstract void applyFilter(PDFFilter filter) throws IOException;
   
       /**
        * Outputs the cached bytes to the given stream.
  +     *
  +     * @param stream the stream to write to
  +     * @throws IOException if there is an IO error
        */
       public abstract void outputStreamData(OutputStream stream) throws IOException;
   
       /**
        * Returns the current size of the stream.
  +     *
  +     * @throws IOException if there is an IO error
  +     * @return the size of the cache
        */
       public abstract int getSize() throws IOException;
   
       /**
        * Closes the cache and frees resources.
  +     *
  +     * @throws IOException if there is an IO error
        */
       public abstract void close() throws IOException;
   
       /**
        * Clears and resets the cache.
  +     *
  +     * @throws IOException if there is an IO error
        */
       public abstract void reset() throws IOException;
   }
  
  
  
  1.2       +32 -9     xml-fop/src/org/apache/fop/pdf/TempFileStreamCache.java
  
  Index: TempFileStreamCache.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/pdf/TempFileStreamCache.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TempFileStreamCache.java	27 May 2002 10:59:07 -0000	1.1
  +++ TempFileStreamCache.java	11 Jan 2003 19:38:52 -0000	1.2
  @@ -1,6 +1,6 @@
   /*
    * $Id$
  - * Copyright (C) 2002 The Apache Software Foundation. All rights reserved.
  + * Copyright (C) 2002-2003 The Apache Software Foundation. All rights reserved.
    * For details on use and redistribution please refer to the
    * LICENSE file included with these sources.
    */
  @@ -13,7 +13,6 @@
   import java.io.BufferedOutputStream;
   import java.io.FileInputStream;
   import java.io.FileOutputStream;
  -import java.io.InputStream;
   import java.io.OutputStream;
   import java.io.IOException;
   import java.io.File;
  @@ -35,6 +34,8 @@
   
       /**
        * Creates a new TempFileStreamCache.
  +     *
  +     * @throws IOException if there is an IO error
        */
       public TempFileStreamCache() throws IOException {
           tempFile = File.createTempFile("org.apache.fop.pdf.StreamCache-",
  @@ -45,20 +46,28 @@
       /**
        * Get the current OutputStream. Do not store it - it may change
        * from call to call.
  +     *
  +     * @throws IOException if there is an IO error
  +     * @return the output stream for this cache
        */
       public OutputStream getOutputStream() throws IOException {
  -        if (output == null)
  +        if (output == null) {
               output = new BufferedOutputStream(
                          new FileOutputStream(tempFile));
  +        }
           return output;
       }
   
       /**
        * Filter the cache with the supplied PDFFilter.
  +     *
  +     * @param filter the filter to apply
  +     * @throws IOException if there is an IO error
        */
       public void applyFilter(PDFFilter filter) throws IOException {
  -        if (output == null)
  +        if (output == null) {
               return;
  +        }
   
           output.close();
           output = null;
  @@ -83,10 +92,14 @@
   
       /**
        * Outputs the cached bytes to the given stream.
  +     *
  +     * @param stream the output stream to write to
  +     * @throws IOException if there is an IO error
        */
       public void outputStreamData(OutputStream stream) throws IOException {
  -        if (output == null)
  +        if (output == null) {
               return;
  +        }
   
           output.close();
           output = null;
  @@ -99,34 +112,44 @@
   
       /**
        * Returns the current size of the stream.
  +     *
  +     * @throws IOException if there is an IO error
  +     * @return the size of the cache
        */
       public int getSize() throws IOException {
  -        if (output != null)
  +        if (output != null) {
               output.flush();
  +        }
           return (int) tempFile.length();
       }
   
       /**
        * Closes the cache and frees resources.
  +     *
  +     * @throws IOException if there is an IO error
        */
       public void close() throws IOException {
           if (output != null) {
               output.close();
               output = null;
           }
  -        if (tempFile.exists())
  +        if (tempFile.exists()) {
               tempFile.delete();
  +        }
       }
   
       /**
        * Clears and resets the cache.
  +     *
  +     * @throws IOException if there is an IO error
        */
       public void reset() throws IOException {
           if (output != null) {
               output.close();
               output = null;
           }
  -        if (tempFile.exists())
  +        if (tempFile.exists()) {
               tempFile.delete();
  +        }
       }
   }
  
  
  
  1.2       +5 -2      xml-fop/src/org/apache/fop/pdf/TransitionDictionary.java
  
  Index: TransitionDictionary.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/pdf/TransitionDictionary.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TransitionDictionary.java	11 Nov 2002 08:50:51 -0000	1.1
  +++ TransitionDictionary.java	11 Jan 2003 19:38:52 -0000	1.2
  @@ -1,6 +1,6 @@
   /*
    * $Id$
  - * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
  + * Copyright (C) 2001-2003 The Apache Software Foundation. All rights reserved.
    * For details on use and redistribution please refer to the
    * LICENSE file included with these sources.
    */
  @@ -31,9 +31,12 @@
       /**
        * Get the dictionary.
        * This returns the string containing the dictionary values.
  +     *
  +     * @return the string with the dictionary values
        */
       public String getDictionary() {
           StringBuffer sb = new StringBuffer();
  +        sb.append("/Type /Trans\n");
           for (Iterator iter = dictionaryValues.keySet().iterator(); iter.hasNext();) {
               Object key = iter.next();
               sb.append(key + " " + dictionaryValues.get(key) + "\n");
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-cvs-help@xml.apache.org