Guys,
The attached patch implements PDFRenderer.drawImageClipped() properly, so the right-most and bottom-most images of a tiled image background are now clipped, rather than being scaled or overrun. It also removes a bit of System.out cruft I left in the previous image bg patch. Can a comitter please have a look at the patch and commit if happy. Cheers, Mike. -- Michael Gratton <[EMAIL PROTECTED]> Recall Design <http://www.recalldesign.com/> s: 53 Gilbert Street Adelaide SA 5000 Australia t: +61 8 8217 0500 f: +61 8 8217 0555
? FopImageFactory.patch ? background-image_0.01.patch ? background-image_0.02.patch ? background-image_0.03.patch ? background-image_0.04.patch ? bg-renderer.patch ? dist-bin ? dist-src ? fop-background-image-0.03-bin.tar.gz ? fop-background-image-0.03-bin.zip ? fop-background-image-0.03-src.tar.gz ? fop-background-image-0.03-src.zip ? table-and-block.fo ? table-and-block.pdf ? test-config.xml ? test.fo ? test.pcl ? test.pdf ? test.ps ? test.txt ? docs/html-docs ? docs/xml-docs/book.xml Index: src/org/apache/fop/layout/BodyRegionArea.java =================================================================== RCS file: /home/cvspublic/xml-fop/src/org/apache/fop/layout/BodyRegionArea.java,v retrieving revision 1.3.2.1 diff -u -r1.3.2.1 BodyRegionArea.java --- src/org/apache/fop/layout/BodyRegionArea.java 23 Apr 2002 22:26:10 -0000 1.3.2.1 +++ src/org/apache/fop/layout/BodyRegionArea.java 3 May 2002 08:08:52 -0000 @@ -25,11 +25,6 @@ } public BodyAreaContainer makeBodyAreaContainer() { - System.out.println(" +++ Constructing new BodyAreaContainer:"); - System.out.println(" -> x : " + xPosition); - System.out.println(" -> y : " + yPosition); - System.out.println(" -> allocW: " + width); - System.out.println(" -> maxH : " + height); BodyAreaContainer area = new BodyAreaContainer(null, xPosition, yPosition, width, height, Position.ABSOLUTE, columnCount, Index: src/org/apache/fop/render/AbstractRenderer.java =================================================================== RCS file: /home/cvspublic/xml-fop/src/org/apache/fop/render/AbstractRenderer.java,v retrieving revision 1.4.2.2 diff -u -r1.4.2.2 AbstractRenderer.java --- src/org/apache/fop/render/AbstractRenderer.java 23 Apr 2002 22:26:58 -0000 1.4.2.2 +++ src/org/apache/fop/render/AbstractRenderer.java 3 May 2002 08:08:52 -0000 @@ -71,10 +71,6 @@ * @param h the height in millipoints */ protected void doBackground(Area area, int x, int y, int w, int h) { - System.out.println("Doing background: " + area); - System.out.println(" x:" + x + " y:" + y); - System.out.println(" w:" + w + " h:" + h); - if (h == 0 || w == 0) return; Index: src/org/apache/fop/render/pdf/PDFRenderer.java =================================================================== RCS file: /home/cvspublic/xml-fop/src/org/apache/fop/render/pdf/PDFRenderer.java,v retrieving revision 1.91.2.2 diff -u -r1.91.2.2 PDFRenderer.java --- src/org/apache/fop/render/pdf/PDFRenderer.java 23 Apr 2002 22:33:39 -0000 1.91.2.2 +++ src/org/apache/fop/render/pdf/PDFRenderer.java 3 May 2002 08:08:52 -0000 @@ -323,18 +323,41 @@ FopImage image, FontState fs) { - PDFRectangle clip = new PDFRectangle(clipX / 1000, - clipY / 1000, - (clipX + clipW) / 1000, - (clipY + clipW) / 1000); + float cx1 = ((float)x) / 1000f; + float cy1 = ((float)y - clipH) / 1000f; + + float cx2 = ((float)x + clipW) / 1000f; + float cy2 = ((float)y) / 1000f; + + int imgX = x - clipX; + int imgY = y - clipY; + + int imgW; + int imgH; + try { + // XXX: do correct unit conversion here.. + imgW = image.getWidth() * 1000; + imgH = image.getHeight() * 1000; + } + catch (FopImageException fie) { + log.error("Error obtaining image width and height", fie); + return; + } if (image instanceof SVGImage) { try { closeText(); SVGDocument svg = ((SVGImage)image).getSVGDocument(); - currentStream.add("ET\nq\n"); - renderSVGDocument(svg, x, y, fs); + currentStream.add("ET\nq\n" + + // clipping + cx1 + " " + cy1 + " m\n" + + cx2 + " " + cy1 + " l\n" + + cx2 + " " + cy2 + " l\n" + + cx1 + " " + cy2 + " l\n" + + "W\n" + + "n\n"); + renderSVGDocument(svg, imgX, imgY, fs); currentStream.add("Q\nBT\n"); } catch (FopImageException e) {} @@ -342,11 +365,18 @@ int xObjectNum = this.pdfDoc.addImage(image); closeText(); currentStream.add("ET\nq\n" + + // clipping + cx1 + " " + cy1 + " m\n" + + cx2 + " " + cy1 + " l\n" + + cx2 + " " + cy2 + " l\n" + + cx1 + " " + cy2 + " l\n" + + "W\n" + + "n\n" + // image matrix - (((float)clipW) / 1000f) + " 0 0 " + - (((float)clipH) / 1000f) + " " + - (((float)x) / 1000f) + " " + - (((float)y - clipH) / 1000f) + " cm\n" + + (((float)imgW) / 1000f) + " 0 0 " + + (((float)imgH) / 1000f) + " " + + (((float)imgX) / 1000f) + " " + + (((float)imgY - imgH) / 1000f) + " cm\n" + "s\n" + // the image itself "/Im" + xObjectNum + " Do\nQ\nBT\n");
smime.p7s
Description: S/MIME Cryptographic Signature