cvs commit: xml-fop/src/org/apache/fop/svg PDFDocumentGraphics2D.java PDFGraphics2D.java

2002-11-11 Thread keiron
keiron  2002/11/11 00:50:55

  Modified:src/org/apache/fop/pdf PDFDocument.java PDFPage.java
PDFResourceContext.java PDFRoot.java
   src/org/apache/fop/render/pdf PDFRenderer.java
PDFXMLHandler.java
   src/org/apache/fop/svg PDFDocumentGraphics2D.java
PDFGraphics2D.java
  Added:   src/org/apache/fop/pdf TransitionDictionary.java
PDFFormXObject.java
  Log:
  fixes problem of links not working after data output
  annotations now explicitly added
  fixed font name lookup error so now font output only once
  pdf renderer uses context to output things better
  added Form XObject
  add transition dictionary
  
  Revision  ChangesPath
  1.57  +25 -4 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.56
  retrieving revision 1.57
  diff -u -r1.56 -r1.57
  --- PDFDocument.java  3 Nov 2002 16:24:21 -   1.56
  +++ PDFDocument.java  11 Nov 2002 08:50:50 -  1.57
  @@ -1004,7 +1004,7 @@
   PDFFont font = new PDFFont(++this.objectcount, fontname,
  PDFFont.TYPE1, basefont, encoding);
   this.objects.add(font);
  -fontMap.put(basefont, font);
  +fontMap.put(fontname, font);
   return font;
   } else {
   byte subtype = PDFFont.TYPE1;
  @@ -1071,7 +1071,7 @@
makeArray(metrics.getWidths(1)));
   }
   
  -fontMap.put(basefont, font);
  +fontMap.put(fontname, font);
   
   return font;
   }
  @@ -1190,6 +1190,19 @@
   return xObject;
   }
   
  +public PDFFormXObject addFormXObject(PDFResourceContext res, PDFStream cont, 
PDFResources formres, String key) {
  +PDFFormXObject xObject;
  +xObject = new PDFFormXObject(++this.objectcount, ++this.xObjectCount,
  + cont, formres.referencePDF());
  +this.objects.add(xObject);
  +this.resources.addXObject(xObject);
  +if (res != null) {
  +res.getPDFResources().addXObject(xObject);
  +}
  +return xObject;
  +
  +}
  +
   /**
* make a /Page object
*
  @@ -1357,8 +1370,16 @@
* to the list of objects
*/
   PDFAnnotList obj = new PDFAnnotList(++this.objectcount);
  -this.objects.add(obj);
   return obj;
  +}
  +
  +/**
  + * Add an annotation list object to the pdf document
  + *
  + * @param obj the annotation list to add 
  + */ 
  +public void addAnnotList(PDFAnnotList obj) {
  +this.objects.add(obj);
   }
   
   /**
  
  
  
  1.18  +22 -1 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.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- PDFPage.java  3 Nov 2002 16:24:22 -   1.17
  +++ PDFPage.java  11 Nov 2002 08:50:51 -  1.18
  @@ -44,6 +44,16 @@
   protected int pageheight;
   
   /**
  + * Duration to display page
  + */
  +protected int duration = -1;
  +
  +/**
  + * Transition dictionary
  + */
  +protected TransitionDictionary trDictionary = null;
  +
  +/**
* create a /Page object
*
* @param number the object's number
  @@ -101,6 +111,11 @@
   this.parent = parent.referencePDF();
   }
   
  +public void setTransition(int dur, TransitionDictionary tr) {
  +duration = dur;
  +trDictionary = tr;
  +}
  +
   /**
* represent this object as PDF
*
  @@ -118,6 +133,12 @@
  + this.contents.referencePDF() + "\n");
   if (this.annotList != null) {
   sb = sb.append("/Annots " + this.annotList.referencePDF() + "\n");
  +}
  +if (this.duration != -1) {
  +sb = sb.append("/Dur " + this.duration + "\n");
  +}
  +if (this.trDictionary != null) {
  +sb = sb.append("/Trans << " + this.trDictionary.getDictionary() + " 
>>\n");
   }
   
   sb = sb.append(">>\nendobj\n");
  
  
  
  1.2   +5 -1  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.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- PDFResourceContext.java   28 Jun 2002 10:09:

cvs commit: xml-fop/src/org/apache/fop/svg PDFDocumentGraphics2D.java PDFGraphics2D.java

2002-07-31 Thread keiron

keiron  2002/07/31 01:20:41

  Modified:src/org/apache/fop/render/pdf FontSetup.java
PDFRenderer.java
   src/org/apache/fop/configuration ConfigurationParser.java
   src/org/apache/fop/mif MIFHandler.java
   src/org/apache/fop/pdf PDFDocument.java
   src/org/apache/fop/render PrintRenderer.java
   src/org/apache/fop/render/ps PSRenderer.java
   src/org/apache/fop/render/xml XMLRenderer.java
   src/org/apache/fop/svg PDFDocumentGraphics2D.java
PDFGraphics2D.java
  Added:   src/org/apache/fop/render/pdf FontTriplet.java
EmbedFontInfo.java
  Removed: src/org/apache/fop/configuration FontInfo.java
FontTriplet.java
  Log:
  moved embed font info into the render.pdf package
  reduced dependancy on Configuration
  
  Revision  ChangesPath
  1.19  +9 -19 xml-fop/src/org/apache/fop/render/pdf/FontSetup.java
  
  Index: FontSetup.java
  ===
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/render/pdf/FontSetup.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- FontSetup.java23 Jul 2002 11:06:51 -  1.18
  +++ FontSetup.java31 Jul 2002 08:20:40 -  1.19
  @@ -13,8 +13,6 @@
   import org.apache.fop.layout.FontDescriptor;
   import org.apache.fop.pdf.PDFDocument;
   import org.apache.fop.pdf.PDFResources;
  -import org.apache.fop.configuration.Configuration;
  -import org.apache.fop.configuration.FontTriplet;
   
   // Java
   import java.util.HashMap;
  @@ -37,7 +35,7 @@
*
* @param fontInfo the font info object to set up
*/
  -public static void setup(FontInfo fontInfo) {
  +public static void setup(FontInfo fontInfo, ArrayList embedList) {
   
   fontInfo.addMetrics("F1", new Helvetica());
   fontInfo.addMetrics("F2", new HelveticaOblique());
  @@ -129,27 +127,24 @@
  "normal", FontInfo.NORMAL);
   
   /* Add configured fonts */
  -addConfiguredFonts(fontInfo, 15);
  +addConfiguredFonts(fontInfo, embedList, 15);
   }
   
   /**
* Add fonts from configuration file starting with
* internalnames F
*/
  -public static void addConfiguredFonts(FontInfo fontInfo, int num) {
  +public static void addConfiguredFonts(FontInfo fontInfo, ArrayList fontInfos, 
int num) {
  +if (fontInfos == null)
  +return;
   
   String internalName = null;
   FontReader reader = null;
   
  -ArrayList fontInfos = Configuration.getFonts();
  -if (fontInfos == null)
  -return;
  -
   for (int count = 0; count < fontInfos.size(); count++) {
  -org.apache.fop.configuration.FontInfo configFontInfo =
  -(org.apache.fop.configuration.FontInfo)fontInfos.get(count);
  +EmbedFontInfo configFontInfo =
  +(EmbedFontInfo)fontInfos.get(count);
   
  -try {
   String metricsFile = configFontInfo.getMetricsFile();
   if (metricsFile != null) {
   internalName = "F" + num;
  @@ -184,11 +179,6 @@
  weight);
   }
   }
  -} catch (Exception ex) {
  -//log.error("Failed to read font metrics file "
  -// + configFontInfo.getMetricsFile()
  -// + " : " + ex.getMessage());
  -}
   }
   }
   
  @@ -212,5 +202,5 @@
  font.encoding(), font, desc));
   }
   }
  -
   }
  +
  
  
  
  1.113 +3 -2  xml-fop/src/org/apache/fop/render/pdf/PDFRenderer.java
  
  Index: PDFRenderer.java
  ===
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/render/pdf/PDFRenderer.java,v
  retrieving revision 1.112
  retrieving revision 1.113
  diff -u -r1.112 -r1.113
  --- PDFRenderer.java  30 Jul 2002 13:04:05 -  1.112
  +++ PDFRenderer.java  31 Jul 2002 08:20:40 -  1.113
  @@ -14,6 +14,7 @@
   import org.apache.fop.fo.FOUserAgent;
   import org.apache.fop.image.*;
   import org.apache.fop.apps.FOPException;
  +import org.apache.fop.apps.Version;
   import org.apache.fop.fo.properties.*;
   import org.apache.fop.datatypes.*;
   import org.apache.fop.pdf.*;
  @@ -158,7 +159,7 @@
   
   public void startRenderer(OutputStream stream) throws IOException {
   ostream = stream;
  -this.pdfDoc = new PDFDocument();
  +this.pdfDoc = new PDFDocument(Version.getVersion());
   this.pdfDoc.setProducer(producer);
   pdfDoc.outputHeader(stream);
   }
  

cvs commit: xml-fop/src/org/apache/fop/svg PDFDocumentGraphics2D.java PDFGraphics2D.java

2002-07-09 Thread keiron

keiron  2002/07/09 07:59:03

  Modified:src/org/apache/fop/svg PDFDocumentGraphics2D.java
PDFGraphics2D.java
  Log:
  improved linear and radial gradients
  
  Revision  ChangesPath
  1.19  +4 -3  xml-fop/src/org/apache/fop/svg/PDFDocumentGraphics2D.java
  
  Index: PDFDocumentGraphics2D.java
  ===
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/svg/PDFDocumentGraphics2D.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- PDFDocumentGraphics2D.java1 Jul 2002 14:42:43 -   1.18
  +++ PDFDocumentGraphics2D.java9 Jul 2002 14:59:03 -   1.19
  @@ -20,6 +20,7 @@
   import java.awt.Shape;
   import java.awt.font.FontRenderContext;
   import java.awt.font.GlyphVector;
  +import java.awt.geom.AffineTransform;
   import java.io.OutputStream;
   import java.io.IOException;
   
  @@ -92,7 +93,7 @@
   resourceContext = currentPage;
   pageRef = currentPage.referencePDF();
   currentStream.write("1 0 0 -1 0 " + height + " cm\n");
  -
  +graphicsState.setTransform(new AffineTransform(1.0, 0.0, 0.0, -1.0, 0.0, 
(double)height));
   pdfDoc.outputHeader(stream);
   
   setOutputStream(stream);
  
  
  
  1.36  +38 -28xml-fop/src/org/apache/fop/svg/PDFGraphics2D.java
  
  Index: PDFGraphics2D.java
  ===
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/svg/PDFGraphics2D.java,v
  retrieving revision 1.35
  retrieving revision 1.36
  diff -u -r1.35 -r1.36
  --- PDFGraphics2D.java4 Jul 2002 14:08:20 -   1.35
  +++ PDFGraphics2D.java9 Jul 2002 14:59:03 -   1.36
  @@ -639,10 +639,16 @@
   if (paint instanceof LinearGradientPaint) {
   LinearGradientPaint gp = (LinearGradientPaint)paint;
   Color[] cols = gp.getColors();
  +float[] fractions = gp.getFractions();
   Point2D p1 = gp.getStartPoint();
   Point2D p2 = gp.getEndPoint();
   MultipleGradientPaint.CycleMethodEnum cycenum = gp.getCycleMethod();
   boolean cyclic = cycenum == MultipleGradientPaint.REPEAT;
  +AffineTransform transform = graphicsState.getTransform();
  +transform.concatenate(gp.getTransform());
  +
  +p1 = transform.transform(p1, null);
  +p2 = transform.transform(p2, null);
   
   ArrayList theCoords = new ArrayList();
   theCoords.add(new Double(p1.getX()));
  @@ -665,44 +671,51 @@
   theEncode.add(new Double(1));
   
   ArrayList theBounds = new ArrayList();
  -theBounds.add(new Double(0));
  -theBounds.add(new Double(1));
  -
  -ArrayList theFunctions = new ArrayList();
   
   ArrayList someColors = new ArrayList();
   
  -Color c1 = cols[0];
  -Color c2 = cols[1];
  -
  -PDFColor color1 = new PDFColor(c1.getRed(), c1.getGreen(),
  -   c1.getBlue());
  -someColors.add(color1);
  -PDFColor color2 = new PDFColor(c2.getRed(), c2.getGreen(),
  -   c2.getBlue());
  -someColors.add(color2);
  -
  -PDFFunction myfunc = this.pdfDoc.makeFunction(2, theDomain, null,
  -color1.getVector(), color2.getVector(), 1.0);
  +for(int count = 0; count < cols.length; count++) {
  +Color c1 = cols[count];
  +PDFColor color1 = new PDFColor(c1.getRed(), c1.getGreen(),
  +   c1.getBlue());
  +someColors.add(color1);
  +if(count > 0 && count < cols.length - 1) {
  +theBounds.add(new Double(fractions[count]));
  +}
  +}
   
   PDFColorSpace aColorSpace = new PDFColorSpace(PDFColorSpace.DEVICE_RGB);
  -PDFPattern myPat = this.pdfDoc.createGradient(resourceContext, false, 
aColorSpace,
  -someColors, null, theCoords);
  +PDFPattern myPat = pdfDoc.createGradient(resourceContext, false, 
aColorSpace,
  +someColors, theBounds, theCoords);
   currentStream.write(myPat.getColorSpaceOut(fill));
   
   } else if (paint instanceof RadialGradientPaint) {
   RadialGradientPaint rgp = (RadialGradientPaint)paint;
   
  -float ar = rgp.getRadius();
  +double ar = rgp.getRadius();
   Point2D ac = rgp.getCenterPoint();
   Point2D af = rgp.getFocusPoint();
  +AffineTransform transform = graphicsState.getTransform();
  +AffineTransform gradt = rgp.getTransform();
  +transform.concatenate(gradt);
  +
  + 

cvs commit: xml-fop/src/org/apache/fop/svg PDFDocumentGraphics2D.java PDFGraphics2D.java PDFTranscoder.java

2002-07-01 Thread keiron

keiron  2002/07/01 07:42:43

  Modified:src/org/apache/fop/pdf PDFDocument.java
   src/org/apache/fop/render/pdf PDFRenderer.java
PDFXMLHandler.java
   src/org/apache/fop/svg PDFDocumentGraphics2D.java
PDFGraphics2D.java PDFTranscoder.java
  Log:
  progressively output pdf objects to reduce memory usage
  
  Revision  ChangesPath
  1.44  +11 -41xml-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.43
  retrieving revision 1.44
  diff -u -r1.43 -r1.44
  --- PDFDocument.java  1 Jul 2002 10:39:29 -   1.43
  +++ PDFDocument.java  1 Jul 2002 14:42:42 -   1.44
  @@ -140,11 +140,6 @@
*/
   protected HashMap fontMap = new HashMap();
   
  -/**
  - * the objects themselves
  - */
  -protected ArrayList pendingLinks = null;
  -
   protected HashMap filterMap = new HashMap();
   
   /**
  @@ -1015,20 +1010,6 @@
   public void addPage(PDFPage page) {
   /* add it to the list of objects */
   this.objects.add(page);
  -
  -if(pendingLinks != null) {
  -for(Iterator iter = pendingLinks.iterator(); iter.hasNext(); ) {
  -PendingLink pl = (PendingLink)iter.next();
  -PDFGoTo gt = new PDFGoTo(++this.objectcount,
  - page.referencePDF());
  -gt.setDestination(pl.dest);
  -addTrailerObject(gt);
  -PDFInternalLink internalLink =
  - new PDFInternalLink(gt.referencePDF());
  -pl.link.setAction(internalLink);
  -}
  -pendingLinks = null;
  -}
   }
   
   /**
  @@ -1096,25 +1077,6 @@
   this.trailerObjects.add(object);
   }
   
  -class PendingLink {
  -PDFLink link;
  -String dest;
  -}
  -
  -public PDFLink makeLinkCurrentPage(Rectangle rect, String dest) {
  -PDFLink link = new PDFLink(++this.objectcount, rect);
  -this.objects.add(link);
  -PendingLink pl = new PendingLink();
  -pl.link = link;
  -pl.dest = dest;
  -if(pendingLinks == null) {
  -pendingLinks = new ArrayList();
  -}
  -pendingLinks.add(pl);
  -
  -return link;
  -}
  -
   public PDFLink makeLink(Rectangle rect, String page, String dest) {
   PDFLink link = new PDFLink(++this.objectcount, rect);
   this.objects.add(link);
  @@ -1142,7 +1104,7 @@
*
* @return the stream object created
*/
  -public PDFStream makeStream(String type) {
  +public PDFStream makeStream(String type, boolean add) {
   
   /*
* create a PDFStream with the next object number and add it
  @@ -1152,10 +1114,18 @@
   PDFStream obj = new PDFStream(++this.objectcount);
   obj.addDefaultFilters(filterMap, type);
   
  -this.objects.add(obj);
  +if(add) {
  +this.objects.add(obj);
  +}
   return obj;
   }
   
  +/**
  + * add a stream object
  + */
  +public void addStream(PDFStream obj) {
  +this.objects.add(obj);
  +}
   
   /**
* make an annotation list object
  
  
  
  1.107 +10 -2 xml-fop/src/org/apache/fop/render/pdf/PDFRenderer.java
  
  Index: PDFRenderer.java
  ===
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/render/pdf/PDFRenderer.java,v
  retrieving revision 1.106
  retrieving revision 1.107
  diff -u -r1.106 -r1.107
  --- PDFRenderer.java  28 Jun 2002 10:09:06 -  1.106
  +++ PDFRenderer.java  1 Jul 2002 14:42:42 -   1.107
  @@ -217,7 +217,7 @@
  (int) Math.round(w / 1000), (int) 
Math.round(h / 1000));
   pageReferences.put(page, currentPage.referencePDF());
   }
  -currentStream = this.pdfDoc.makeStream(PDFStream.CONTENT_FILTER);
  +currentStream = this.pdfDoc.makeStream(PDFStream.CONTENT_FILTER, false);
   
   currentState = new PDFState();
   currentState.setTransform(new AffineTransform(1, 0, 0, -1, 0, (int) 
Math.round(pageHeight / 1000)));
  @@ -231,6 +231,7 @@
   
   //currentStream.add("ET\n");
   
  +this.pdfDoc.addStream(currentStream);
   currentPage.setContents(currentStream);
   this.pdfDoc.addPage(currentPage);
   this.pdfDoc.output(ostream);
  @@ -526,6 +527,12 @@
 + xobj + " Do\nQ\nBT\n");
   }
   
  +// output new data
  +try {
  +this.pdfDoc.output(ostream);
  +} catch(IOException ioe) {
  +
  +   

cvs commit: xml-fop/src/org/apache/fop/svg PDFDocumentGraphics2D.java PDFGraphics2D.java PDFTextElementBridge.java

2002-06-28 Thread keiron

keiron  2002/06/28 03:09:07

  Modified:src/org/apache/fop/pdf BitmapImage.java PDFDocument.java
PDFPage.java PDFPattern.java PDFResources.java
PDFStream.java
   src/org/apache/fop/render/pdf FontSetup.java
FopPDFImage.java PDFRenderer.java
   src/org/apache/fop/svg PDFDocumentGraphics2D.java
PDFGraphics2D.java PDFTextElementBridge.java
  Added:   src/org/apache/fop/pdf PDFResourceContext.java
  Log:
  handles pattern resources better
  made stream filters externally configured
  
  Revision  ChangesPath
  1.2   +5 -3  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.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- BitmapImage.java  27 Jun 2002 11:45:54 -  1.1
  +++ BitmapImage.java  28 Jun 2002 10:09:06 -  1.2
  @@ -8,7 +8,7 @@
   package org.apache.fop.pdf;
   
   import java.io.IOException;
  -
  +import java.util.HashMap;
   public class BitmapImage implements PDFImage {
   int m_height;
   int m_width;
  @@ -18,6 +18,7 @@
   String maskRef;
   PDFColor transparent = null;
   String key;
  +HashMap filters;
   
   public BitmapImage(String k, int width, int height, byte[] result,
 String mask) {
  @@ -31,6 +32,7 @@
   }
   
   public void setup(PDFDocument doc) {
  +filters = doc.getFilterMap();
   }
   
   public String getKey() {
  @@ -87,7 +89,7 @@
   
   imgStream.setData(m_bitmaps);
   
  -imgStream.addDefaultFilters();
  +imgStream.addDefaultFilters(filters, PDFStream.CONTENT_FILTER);
   return imgStream;
   }
   
  
  
  
  1.42  +72 -24xml-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.41
  retrieving revision 1.42
  diff -u -r1.41 -r1.42
  --- PDFDocument.java  27 Jun 2002 11:45:54 -  1.41
  +++ PDFDocument.java  28 Jun 2002 10:09:06 -  1.42
  @@ -136,10 +136,17 @@
   protected HashMap xObjectsMap = new HashMap();
   
   /**
  + * the Font Map.
  + */
  +protected HashMap fontMap = new HashMap();
  +
  +/**
* the objects themselves
*/
   protected ArrayList pendingLinks = null;
   
  +protected HashMap filterMap = new HashMap();
  +
   /**
* creates an empty PDF document 
* 
  @@ -176,6 +183,14 @@
   this.info.setProducer(producer);
   }
   
  +public void setFilterMap(HashMap map) {
  +filterMap = map;
  +}
  +
  +public HashMap getFilterMap() {
  +return filterMap;
  +}
  +
   /**
* Make a /Catalog (Root) object. This object is written in
* the trailer.
  @@ -426,7 +441,7 @@
* It's optional, the default is the identity matrix
* @param theFunction The PDF Function that maps an (x,y) location to a color
*/
  -public PDFShading makeShading(int theShadingType,
  +public PDFShading makeShading(PDFResourceContext res, int theShadingType,
 PDFColorSpace theColorSpace,
 ArrayList theBackground, ArrayList theBBox,
 boolean theAntiAlias, ArrayList theDomain,
  @@ -442,7 +457,11 @@
   this.objects.add(shading);
   
   // add this shading to resources
  -this.resources.addShading(shading);
  +if(res != null) {
  +res.getPDFResources().addShading(shading);
  +} else {
  +this.resources.addShading(shading);
  +}
   
   return (shading);
   }
  @@ -466,7 +485,7 @@
* @param theExtend ArrayList of Booleans of whether to extend teh start and 
end colors past the start and end points
* The default is [false, false]
*/
  -public PDFShading makeShading(int theShadingType,
  +public PDFShading makeShading(PDFResourceContext res, int theShadingType,
 PDFColorSpace theColorSpace,
 ArrayList theBackground, ArrayList theBBox,
 boolean theAntiAlias, ArrayList theCoords,
  @@ -481,8 +500,11 @@
   theDomain, theFunction,
   theExtend);
   
  -this.resources.addShading(shading);
  -
  +if(res != null) {
  +res.getPDFResources().addShading(shading);
  +} else {
  +  

cvs commit: xml-fop/src/org/apache/fop/svg PDFDocumentGraphics2D.java PDFGraphics2D.java PDFTranscoder.java

2002-06-10 Thread chrisg

chrisg  2002/06/10 17:01:15

  Modified:src/org/apache/fop/apps Tag: fop-0_20_2-maintain
StreamRenderer.java
   src/org/apache/fop/render Tag: fop-0_20_2-maintain
PrintRenderer.java Renderer.java
   src/org/apache/fop/render/awt Tag: fop-0_20_2-maintain
AWTRenderer.java FontSetup.java
   src/org/apache/fop/render/pdf Tag: fop-0_20_2-maintain
FontSetup.java
   src/org/apache/fop/render/ps Tag: fop-0_20_2-maintain
PSRenderer.java
   src/org/apache/fop/render/svg Tag: fop-0_20_2-maintain
SVGRenderer.java
   src/org/apache/fop/render/xml Tag: fop-0_20_2-maintain
XMLRenderer.java
   src/org/apache/fop/svg Tag: fop-0_20_2-maintain
PDFDocumentGraphics2D.java PDFGraphics2D.java
PDFTranscoder.java
  Log:
  fixed compile error from previous commit (basedir) .. Doh
  
  Revision  ChangesPath
  No   revision
  
  
  No   revision
  
  
  1.6.2.3   +2 -0  xml-fop/src/org/apache/fop/apps/Attic/StreamRenderer.java
  
  Index: StreamRenderer.java
  ===
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/apps/Attic/StreamRenderer.java,v
  retrieving revision 1.6.2.2
  retrieving revision 1.6.2.3
  diff -u -r1.6.2.2 -r1.6.2.3
  --- StreamRenderer.java   17 Mar 2002 23:37:06 -  1.6.2.2
  +++ StreamRenderer.java   11 Jun 2002 00:01:14 -  1.6.2.3
  @@ -128,6 +128,8 @@
   try {
   renderer.setupFontInfo(fontInfo);
   renderer.startRenderer(outputStream);
  +} catch (FOPException fe) {
  +throw new SAXException(fe);
   } catch (IOException e) {
   throw new SAXException(e);
   }
  
  
  
  No   revision
  
  
  No   revision
  
  
  1.14.2.3  +3 -2  xml-fop/src/org/apache/fop/render/PrintRenderer.java
  
  Index: PrintRenderer.java
  ===
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/render/PrintRenderer.java,v
  retrieving revision 1.14.2.2
  retrieving revision 1.14.2.3
  diff -u -r1.14.2.2 -r1.14.2.3
  --- PrintRenderer.java23 Apr 2002 22:26:58 -  1.14.2.2
  +++ PrintRenderer.java11 Jun 2002 00:01:14 -  1.14.2.3
  @@ -19,6 +19,7 @@
   import org.apache.fop.layout.inline.*;
   import org.apache.fop.datatypes.*;
   import org.apache.fop.render.pdf.FontSetup;
  +import org.apache.fop.apps.FOPException;
   
   import org.apache.fop.svg.SVGArea;
   
  @@ -405,7 +406,7 @@
* 
* @param fontInfo font info to set up
*/
  -public void setupFontInfo(FontInfo fontInfo) {
  +public void setupFontInfo(FontInfo fontInfo) throws FOPException {
   this.fontInfo = fontInfo;
   FontSetup.setup(fontInfo);
   }
  
  
  
  1.19.2.2  +2 -2  xml-fop/src/org/apache/fop/render/Renderer.java
  
  Index: Renderer.java
  ===
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/render/Renderer.java,v
  retrieving revision 1.19.2.1
  retrieving revision 1.19.2.2
  diff -u -r1.19.2.1 -r1.19.2.2
  --- Renderer.java 17 Mar 2002 23:37:07 -  1.19.2.1
  +++ Renderer.java 11 Jun 2002 00:01:14 -  1.19.2.2
  @@ -36,7 +36,7 @@
   /**
* set up the given FontInfo
*/
  -public void setupFontInfo(FontInfo fontInfo);
  +public void setupFontInfo(FontInfo fontInfo) throws FOPException;
   
   /**
* set up renderer options
  
  
  
  No   revision
  
  
  No   revision
  
  
  1.38.2.4  +3 -2  xml-fop/src/org/apache/fop/render/awt/AWTRenderer.java
  
  Index: AWTRenderer.java
  ===
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/render/awt/AWTRenderer.java,v
  retrieving revision 1.38.2.3
  retrieving revision 1.38.2.4
  diff -u -r1.38.2.3 -r1.38.2.4
  --- AWTRenderer.java  19 May 2002 21:05:04 -  1.38.2.3
  +++ AWTRenderer.java  11 Jun 2002 00:01:14 -  1.38.2.4
  @@ -475,7 +475,8 @@
 a.getAllocationWidth(), a.getHeight());
   }
   
  -public void setupFontInfo(FontInfo fontInfo) {
  +public void setupFontInfo(FontInfo fontInfo)
  +throws FOPException {
   // create a temp Image to test font metrics on
   BufferedImage fontImage =
   new BufferedImage(100, 100, BufferedImage.TYPE_INT_RGB);
  
  
  
  1.3.2.2   +8 -3  xml-fop/src/org/apache/fop/render/awt/FontSetup.java
  
  Index: FontSetup.java
  

cvs commit: xml-fop/src/org/apache/fop/svg PDFDocumentGraphics2D.java PDFGraphics2D.java PDFTextPainter.java

2001-07-10 Thread keiron

keiron  01/07/10 04:59:27

  Modified:src/org/apache/fop/svg PDFDocumentGraphics2D.java
PDFGraphics2D.java PDFTextPainter.java
  Log:
  should handle colour space a bit better
  writes fonts to resources in PDFDocument
  cleaned up a bit
  
  Revision  ChangesPath
  1.7   +8 -9  xml-fop/src/org/apache/fop/svg/PDFDocumentGraphics2D.java
  
  Index: PDFDocumentGraphics2D.java
  ===
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/svg/PDFDocumentGraphics2D.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- PDFDocumentGraphics2D.java2001/07/09 08:14:44 1.6
  +++ PDFDocumentGraphics2D.java2001/07/10 11:59:23 1.7
  @@ -1,4 +1,4 @@
  -/* $Id: PDFDocumentGraphics2D.java,v 1.6 2001/07/09 08:14:44 keiron Exp $
  +/* $Id: PDFDocumentGraphics2D.java,v 1.7 2001/07/10 11:59:23 keiron Exp $
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
  @@ -27,7 +27,7 @@
* PDFGraphics2D.
*
* @author mailto:[EMAIL PROTECTED]";>Keiron Liddle
  - * @version $Id: PDFDocumentGraphics2D.java,v 1.6 2001/07/09 08:14:44 keiron Exp $
  + * @version $Id: PDFDocumentGraphics2D.java,v 1.7 2001/07/10 11:59:23 keiron Exp $
* @see org.apache.fop.svg.PDFGraphics2D
*/
   public class PDFDocumentGraphics2D extends PDFGraphics2D {
  @@ -37,6 +37,8 @@
   int width;
   int height;
   
  +FontInfo fontInfo = null;
  +
   /**
* Create a new PDFDocumentGraphics2D.
* This is used to create a new pdf document of the given height
  @@ -54,7 +56,7 @@
   super(textAsShapes);
   
   if(!textAsShapes) {
  -FontInfo fontInfo = new FontInfo();
  +fontInfo = new FontInfo();
   FontSetup.setup(fontInfo);
   try {
   fontState = new FontState(fontInfo, "Helvetica", "normal", 
"normal", 12, 0);
  @@ -73,15 +75,9 @@
   currentFontSize = 0;
   currentYPosition = 0;
   currentXPosition = 0;
  -//   fontState = fs;
   
   currentStream.write("1 0 0 -1 0 " + height + " cm\n");
   
  -// end part
  -/*
  -FontSetup.addToResources(this.pdfDoc, fontInfo);
  - */
  -
   }
   
   /**
  @@ -123,6 +119,9 @@
   PDFPage currentPage =
 this.pdfDoc.makePage(pdfResources, pdfStream, width,
  height, null);
  +if(fontInfo != null) {
  +FontSetup.addToResources(this.pdfDoc, fontInfo);
  +}
   this.pdfDoc.output(stream);
   
   }
  
  
  
  1.10  +149 -112  xml-fop/src/org/apache/fop/svg/PDFGraphics2D.java
  
  Index: PDFGraphics2D.java
  ===
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/svg/PDFGraphics2D.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- PDFGraphics2D.java2001/07/09 08:17:57 1.9
  +++ PDFGraphics2D.java2001/07/10 11:59:24 1.10
  @@ -1,4 +1,4 @@
  -/* $Id: PDFGraphics2D.java,v 1.9 2001/07/09 08:17:57 keiron Exp $
  +/* $Id: PDFGraphics2D.java,v 1.10 2001/07/10 11:59:24 keiron Exp $
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources."
  @@ -38,7 +38,7 @@
* implementing a Graphic2D piece-meal.
*
* @author mailto:[EMAIL PROTECTED]";>Keiron Liddle
  - * @version $Id: PDFGraphics2D.java,v 1.9 2001/07/09 08:17:57 keiron Exp $
  + * @version $Id: PDFGraphics2D.java,v 1.10 2001/07/10 11:59:24 keiron Exp $
* @see org.apache.batik.ext.awt.g2d.AbstractGraphics2D
*/
   public class PDFGraphics2D extends AbstractGraphics2D {
  @@ -163,8 +163,7 @@
   
   final byte[] result =
 new byte[buf.getWidth() * buf.getHeight() * 3];
  -final byte[] mask =
  -  new byte[buf.getWidth() * buf.getHeight()];
  +final byte[] mask = new byte[buf.getWidth() * buf.getHeight()];
   
   Raster raster = buf.getData();
   DataBuffer bd = raster.getDataBuffer();
  @@ -177,10 +176,10 @@
   for (int i = 0; i < idata.length; i++) {
   for (int j = 0; j < idata[i].length; j++) {
   //mask[maskpos++] = (byte)((idata[i][j] >> 24) & 0xFF);
  -if(((idata[i][j] >> 24) & 0xFF) != 255) {
  -result[count++] = (byte)0xFF;
  -result[count++] = (byte)0xFF;
  -result[count++] = (byte)0xFF;
  +if (((idata[i][j] >> 24) & 0xFF) != 255) {
  +re

cvs commit: xml-fop/src/org/apache/fop/svg PDFDocumentGraphics2D.java PDFGraphics2D.java SVGElement.java

2001-06-18 Thread keiron

keiron  01/06/18 01:19:34

  Modified:src/org/apache/fop/svg PDFDocumentGraphics2D.java
PDFGraphics2D.java SVGElement.java
  Log:
  PDFNumber uses static methods
  
  Revision  ChangesPath
  1.5   +3 -4  xml-fop/src/org/apache/fop/svg/PDFDocumentGraphics2D.java
  
  Index: PDFDocumentGraphics2D.java
  ===
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/svg/PDFDocumentGraphics2D.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- PDFDocumentGraphics2D.java2001/05/18 10:03:15 1.4
  +++ PDFDocumentGraphics2D.java2001/06/18 08:19:19 1.5
  @@ -1,4 +1,4 @@
  -/* $Id: PDFDocumentGraphics2D.java,v 1.4 2001/05/18 10:03:15 keiron Exp $
  +/* $Id: PDFDocumentGraphics2D.java,v 1.5 2001/06/18 08:19:19 keiron Exp $
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources."
  @@ -24,7 +24,7 @@
* PDFGraphics2D.
*
* @author mailto:[EMAIL PROTECTED]";>Keiron Liddle
  - * @version $Id: PDFDocumentGraphics2D.java,v 1.4 2001/05/18 10:03:15 keiron Exp $
  + * @version $Id: PDFDocumentGraphics2D.java,v 1.5 2001/06/18 08:19:19 keiron Exp $
* @see org.apache.fop.svg.PDFGraphics2D
*/
   public class PDFDocumentGraphics2D extends PDFGraphics2D {
  @@ -79,8 +79,7 @@
* The result is scaled so that the svg fits correctly inside the pdf document.
*/
   public void setSVGDimension(float w, float h) {
  -PDFNumber pdfNumber = new PDFNumber();
  -currentStream.write("" + pdfNumber.doubleOut(width / w) + " 0 0 " + 
pdfNumber.doubleOut(height / h) + " 0 0 cm\n");
  +currentStream.write("" + PDFNumber.doubleOut(width / w) + " 0 0 " + 
PDFNumber.doubleOut(height / h) + " 0 0 cm\n");
   }
   
   /**
  
  
  
  1.7   +54 -63xml-fop/src/org/apache/fop/svg/PDFGraphics2D.java
  
  Index: PDFGraphics2D.java
  ===
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/svg/PDFGraphics2D.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- PDFGraphics2D.java2001/06/07 10:08:42 1.6
  +++ PDFGraphics2D.java2001/06/18 08:19:20 1.7
  @@ -1,4 +1,4 @@
  -/* $Id: PDFGraphics2D.java,v 1.6 2001/06/07 10:08:42 keiron Exp $
  +/* $Id: PDFGraphics2D.java,v 1.7 2001/06/18 08:19:20 keiron Exp $
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources."
  @@ -38,7 +38,7 @@
* implementing a Graphic2D piece-meal.
*
* @author mailto:[EMAIL PROTECTED]";>Keiron Liddle
  - * @version $Id: PDFGraphics2D.java,v 1.6 2001/06/07 10:08:42 keiron Exp $
  + * @version $Id: PDFGraphics2D.java,v 1.7 2001/06/18 08:19:20 keiron Exp $
* @see org.apache.batik.ext.awt.g2d.AbstractGraphics2D
*/
   public class PDFGraphics2D extends AbstractGraphics2D {
  @@ -416,8 +416,6 @@
   currentColour = new PDFColor(c.getRed(), c.getGreen(), c.getBlue());
   currentStream.write(currentColour.getColorSpaceOut(false));
   
  -PDFNumber pdfNumber = new PDFNumber();
  -
   applyPaint(getPaint(), false);
   applyStroke(getStroke());
   
  @@ -427,26 +425,26 @@
   int type = iter.currentSegment(vals);
   switch (type) {
   case PathIterator.SEG_CUBICTO:
  -currentStream.write(pdfNumber.doubleOut(vals[0]) +
  -" " + pdfNumber.doubleOut(vals[1]) + " " +
  -pdfNumber.doubleOut(vals[2]) + " " +
  -pdfNumber.doubleOut(vals[3]) + " " +
  -pdfNumber.doubleOut(vals[4]) + " " +
  -pdfNumber.doubleOut(vals[5]) + " c\n");
  +currentStream.write(PDFNumber.doubleOut(vals[0]) +
  +" " + PDFNumber.doubleOut(vals[1]) + " " +
  +PDFNumber.doubleOut(vals[2]) + " " +
  +PDFNumber.doubleOut(vals[3]) + " " +
  +PDFNumber.doubleOut(vals[4]) + " " +
  +PDFNumber.doubleOut(vals[5]) + " c\n");
   break;
   case PathIterator.SEG_LINETO:
  -currentStream.write(pdfNumber.doubleOut(vals[0]) +
  -" " + pdfNumber.doubleOut(vals[1]) + " 
l\n");
  +currentStream.write(PDFNumber.doubleOut(vals[0]) +
  +" " + PDFNumber.doubleOut(vals[1]) +