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 kl...@apache.org on 2001/03/04 22:41:44 UTC

cvs commit: xml-fop/src/org/apache/fop/render/pdf PDFRenderer.java

klease      01/03/04 13:41:44

  Modified:    src/org/apache/fop/render/awt AWTRenderer.java
               src/org/apache/fop/render/mif MIFRenderer.java
               src/org/apache/fop/render/pdf PDFRenderer.java
  Log:
  Modify handling of border and padding
  
  Revision  Changes    Path
  1.19      +33 -33    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.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- AWTRenderer.java	2001/01/24 00:31:36	1.18
  +++ AWTRenderer.java	2001/03/04 21:41:43	1.19
  @@ -326,7 +326,7 @@
               //for negative postscript one
               this.currentYPosition =
                 area.getYPosition() - 2 * area.getPaddingTop() -
  -              2 * area.borderWidthTop;
  +              2 * area.getBorderTopWidth();
               this.currentAreaContainerXPosition = area.getXPosition();
           } else if (area.getPosition() ==
                   org.apache.fop.fo.properties.Position.RELATIVE) {
  @@ -335,9 +335,9 @@
           } else if (area.getPosition() ==
                   org.apache.fop.fo.properties.Position.STATIC) {
               this.currentYPosition -=
  -              area.getPaddingTop() + area.borderWidthTop;
  +              area.getPaddingTop() + area.getBorderTopWidth();
               this.currentAreaContainerXPosition +=
  -              area.getPaddingLeft() + area.borderWidthLeft;
  +              area.getPaddingLeft() + area.getBorderLeftWidth();
           }
   
           doFrame(area);
  @@ -405,36 +405,36 @@
                            bg.blue(), bg.red(), bg.green(), bg.blue());
           }
   
  -        rx = rx - area.borderWidthLeft;
  -        ry = ry + area.borderWidthTop;
  -        w = w + area.borderWidthLeft + area.borderWidthRight;
  -        h = h + area.borderWidthTop + area.borderWidthBottom;
  -
  -        if (area.borderWidthTop != 0) {
  -            addLine(rx, ry, rx + w, ry, area.borderWidthTop,
  -                    area.borderColorTop.red(), area.borderColorTop.green(),
  -                    area.borderColorTop.blue());
  -        }
  -
  -        if (area.borderWidthLeft != 0) {
  -            addLine(rx, ry, rx, ry - h, area.borderWidthLeft,
  -                    area.borderColorLeft.red(),
  -                    area.borderColorLeft.green(),
  -                    area.borderColorLeft.blue());
  -        }
  -
  -        if (area.borderWidthRight != 0) {
  -            addLine(rx + w, ry, rx + w, ry - h, area.borderWidthRight,
  -                    area.borderColorRight.red(),
  -                    area.borderColorRight.green(),
  -                    area.borderColorRight.blue());
  -        }
  -
  -        if (area.borderWidthBottom != 0) {
  -            addLine(rx, ry - h, rx + w, ry - h, area.borderWidthBottom,
  -                    area.borderColorBottom.red(),
  -                    area.borderColorBottom.green(),
  -                    area.borderColorBottom.blue());
  +        rx = rx - area.getBorderLeftWidth();
  +        ry = ry + area.getBorderTopWidth();
  +        w = w + area.getBorderLeftWidth() + area.getBorderRightWidth();
  +        h = h + area.getBorderTopWidth() + area.getBorderBottomWidth();
  +
  +	BorderAndPadding bp = area.getBorderAndPadding();
  +	ColorType borderColor;
  +
  +        if (area.getBorderTopWidth() != 0) {
  +	  borderColor=bp.getBorderColor(BorderAndPadding.TOP);
  +	  addLine(rx, ry, rx + w, ry, area.getBorderTopWidth(),
  +		  borderColor.red(), borderColor.green(), borderColor.blue());
  +        }
  +
  +        if (area.getBorderLeftWidth() != 0) {
  +	  borderColor=bp.getBorderColor(BorderAndPadding.LEFT);
  +            addLine(rx, ry, rx, ry - h, area.getBorderLeftWidth(),
  +		  borderColor.red(), borderColor.green(), borderColor.blue());
  +        }
  +
  +        if (area.getBorderRightWidth() != 0) {
  +	  borderColor=bp.getBorderColor(BorderAndPadding.RIGHT);
  +            addLine(rx + w, ry, rx + w, ry - h, area.getBorderRightWidth(),
  +		  borderColor.red(), borderColor.green(), borderColor.blue());
  +        }
  +
  +        if (area.getBorderBottomWidth() != 0) {
  +	  borderColor=bp.getBorderColor(BorderAndPadding.BOTTOM);
  +            addLine(rx, ry - h, rx + w, ry - h, area.getBorderBottomWidth(),
  +		  borderColor.red(), borderColor.green(), borderColor.blue());
           }
       }
   
  
  
  
  1.2       +22 -28    xml-fop/src/org/apache/fop/render/mif/MIFRenderer.java
  
  Index: MIFRenderer.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/render/mif/MIFRenderer.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- MIFRenderer.java	2001/02/10 03:25:29	1.1
  +++ MIFRenderer.java	2001/03/04 21:41:44	1.2
  @@ -1,4 +1,4 @@
  -/*-- $Id: MIFRenderer.java,v 1.1 2001/02/10 03:25:29 arved Exp $ -- 
  +/*-- $Id: MIFRenderer.java,v 1.2 2001/03/04 21:41:44 klease Exp $ -- 
   
    ============================================================================
   				   The Apache Software License, Version 1.1
  @@ -211,7 +211,7 @@
   
           if (area.getPosition() == Position.ABSOLUTE) {
      	     // Y position is computed assuming positive Y axis, adjust for negative postscript one
  -   		this.currentYPosition =area.getYPosition() - 2 * area.getPaddingTop() - 2 * 						area.borderWidthTop;
  +   		this.currentYPosition =area.getYPosition() - 2 * area.getPaddingTop() - 2 * 						area.getBorderTopWidth();
           
   		this.currentAreaContainerXPosition = area.getXPosition();
           } else if (area.getPosition() == Position.RELATIVE) {
  @@ -222,8 +222,8 @@
   	} else if (area.getPosition() == Position.STATIC) {
           	
   		this.currentYPosition -=
  -        	area.getPaddingTop() + area.borderWidthTop;
  -        	this.currentAreaContainerXPosition +=area.getPaddingLeft() + 		area.borderWidthLeft;
  +        	area.getPaddingTop() + area.getBorderTopWidth();
  +        	this.currentAreaContainerXPosition +=area.getPaddingLeft() + 		area.getBorderLeftWidth();
           }
   
           this.currentXPosition = this.currentAreaContainerXPosition;
  @@ -324,36 +324,30 @@
   
   	*/
   	
  -	rx = rx - area.borderWidthLeft;
  -	ry = ry + area.borderWidthTop;
  -	w = w + area.borderWidthLeft + area.borderWidthRight;
  -	h = h + area.borderWidthTop + area.borderWidthBottom;
  +	rx = rx - area.getBorderLeftWidth();
  +	ry = ry + area.getBorderTopWidth();
  +	w = w + area.getBorderLeftWidth() + area.getBorderRightWidth();
  +	h = h + area.getBorderTopWidth() + area.getBorderBottomWidth();
   
   	//Create a textrect with these dimensions.
   	//The y co-ordinate is measured +ve downwards so subtract page-height
   		
   	this.mifDoc.setTextRectProp(rx,pageHeight-ry,w,h);
   
  -
  -	/*	
  -
  -	if (area.borderWidthTop != 0)
  -		  addLine(rx, ry, rx + w, ry, 
  -				area.borderWidthTop,  
  -				new PDFColor(area.borderColorTop));
  -		if (area.borderWidthLeft != 0)
  -		  addLine(rx, ry, rx, ry - h, 
  -				area.borderWidthLeft,  
  -				new PDFColor(area.borderColorLeft));
  -		if (area.borderWidthRight != 0)
  -		  addLine(rx + w, ry, rx + w, ry - h, 
  -				area.borderWidthRight,	
  -				new PDFColor(area.borderColorRight));
  -		if (area.borderWidthBottom != 0)
  -		  addLine(rx, ry - h, rx + w, ry - h, 
  -				area.borderWidthBottom,  
  -				new PDFColor(area.borderColorBottom));
  -
  +	/*
  +	 BorderAndPadding bp = area.getBorderAndPadding();
  +	 if (area.getBorderTopWidth() != 0)
  +	   addLine(rx, ry, rx + w, ry, area.getBorderTopWidth(),
  +			   new PDFColor(bp.getBorderColor(BorderAndPadding.TOP)));
  +	 if (area.getBorderLeftWidth() != 0)
  +	   addLine(rx, ry, rx, ry - h, area.getBorderLeftWidth(),
  +			   new PDFColor(bp.getBorderColor(BorderAndPadding.LEFT)));
  +	 if (area.getBorderRightWidth() != 0)
  +	   addLine(rx + w, ry, rx + w, ry - h, area.getBorderRightWidth(),
  +			   new PDFColor(bp.getBorderColor(BorderAndPadding.RIGHT)));
  +	 if (area.getBorderBottomWidth() != 0)
  +	   addLine(rx, ry - h, rx + w, ry - h, area.getBorderBottomWidth(),
  +			   new PDFColor(bp.getBorderColor(BorderAndPadding.BOTTOM)));
   	*/
       } 
   
  
  
  
  1.56      +26 -23    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.55
  retrieving revision 1.56
  diff -u -r1.55 -r1.56
  --- PDFRenderer.java	2001/02/27 12:28:19	1.55
  +++ PDFRenderer.java	2001/03/04 21:41:44	1.56
  @@ -1,4 +1,4 @@
  -/*-- $Id: PDFRenderer.java,v 1.55 2001/02/27 12:28:19 fotis Exp $ --
  +/*-- $Id: PDFRenderer.java,v 1.56 2001/03/04 21:41:44 klease Exp $ --
   
    ============================================================================
   				   The Apache Software License, Version 1.1
  @@ -320,16 +320,16 @@
               // Y position is computed assuming positive Y axis, adjust for negative postscript one
               this.currentYPosition =
                 area.getYPosition() - 2 * area.getPaddingTop() -
  -              2 * area.borderWidthTop;
  +              2 * area.getBorderTopWidth();
               this.currentAreaContainerXPosition = area.getXPosition();
           } else if (area.getPosition() == Position.RELATIVE) {
               this.currentYPosition -= area.getYPosition();
               this.currentAreaContainerXPosition += area.getXPosition();
           } else if (area.getPosition() == Position.STATIC) {
               this.currentYPosition -=
  -              area.getPaddingTop() + area.borderWidthTop;
  +              area.getPaddingTop() + area.getBorderTopWidth();
               this.currentAreaContainerXPosition +=
  -              area.getPaddingLeft() + area.borderWidthLeft;
  +              area.getPaddingLeft() + area.getBorderLeftWidth();
           }
   
           this.currentXPosition = this.currentAreaContainerXPosition;
  @@ -422,23 +422,26 @@
               this.addRect(rx, ry, w, -h, new PDFColor(bg), new PDFColor(bg));
           }
   
  -        rx = rx - area.borderWidthLeft;
  -        ry = ry + area.borderWidthTop;
  -        w = w + area.borderWidthLeft + area.borderWidthRight;
  -        h = h + area.borderWidthTop + area.borderWidthBottom;
  -
  -        if (area.borderWidthTop != 0)
  -            addLine(rx, ry, rx + w, ry, area.borderWidthTop,
  -                    new PDFColor(area.borderColorTop));
  -        if (area.borderWidthLeft != 0)
  -            addLine(rx, ry, rx, ry - h, area.borderWidthLeft,
  -                    new PDFColor(area.borderColorLeft));
  -        if (area.borderWidthRight != 0)
  -            addLine(rx + w, ry, rx + w, ry - h, area.borderWidthRight,
  -                    new PDFColor(area.borderColorRight));
  -        if (area.borderWidthBottom != 0)
  -            addLine(rx, ry - h, rx + w, ry - h, area.borderWidthBottom,
  -                    new PDFColor(area.borderColorBottom));
  +        rx = rx - area.getBorderLeftWidth();
  +        ry = ry + area.getBorderTopWidth();
  +        w = w + area.getBorderLeftWidth() + area.getBorderRightWidth();
  +        h = h + area.getBorderTopWidth() + area.getBorderBottomWidth();
  +
  +	// Handle line style
  +	// Offset for haft the line width!
  +				BorderAndPadding bp = area.getBorderAndPadding();
  +        if (area.getBorderTopWidth() != 0)
  +            addLine(rx, ry, rx + w, ry, area.getBorderTopWidth(),
  +                    new PDFColor(bp.getBorderColor(BorderAndPadding.TOP)));
  +        if (area.getBorderLeftWidth() != 0)
  +            addLine(rx, ry, rx, ry - h, area.getBorderLeftWidth(),
  +                    new PDFColor(bp.getBorderColor(BorderAndPadding.LEFT)));
  +        if (area.getBorderRightWidth() != 0)
  +            addLine(rx + w, ry, rx + w, ry - h, area.getBorderRightWidth(),
  +                    new PDFColor(bp.getBorderColor(BorderAndPadding.RIGHT)));
  +        if (area.getBorderBottomWidth() != 0)
  +            addLine(rx, ry - h, rx + w, ry - h, area.getBorderBottomWidth(),
  +                    new PDFColor(bp.getBorderColor(BorderAndPadding.BOTTOM)));
   
       }
   
  @@ -451,14 +454,14 @@
       public void renderBlockArea(BlockArea area) {
         // KLease: Temporary test to fix block positioning
         // Offset ypos by padding and border widths
  -      // this.currentYPosition -= (area.getPaddingTop() + area.borderWidthTop);
  +        this.currentYPosition -= (area.getPaddingTop() + area.getBorderTopWidth());
           doFrame(area);
           Enumeration e = area.getChildren().elements();
           while (e.hasMoreElements()) {
               Box b = (Box) e.nextElement();
               b.render(this);
           }
  -	//  this.currentYPosition -= (area.getPaddingBottom() + area.borderWidthBottom);
  +	this.currentYPosition -= (area.getPaddingBottom() + area.getBorderBottomWidth());
       }
   
       /**