From: Keiron Liddle Date: Thu, 27 Mar 2003 23:53:28 +0000 (+0000) Subject: moved image drawing so drawing with size also works X-Git-Tag: Root_Temp_KnuthStylePageBreaking~1686 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=714095486e1f8a2adf6d4f2a68f68cd108044d49;p=xmlgraphics-fop.git moved image drawing so drawing with size also works git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@196187 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/java/org/apache/fop/svg/PDFGraphics2D.java b/src/java/org/apache/fop/svg/PDFGraphics2D.java index d0bbaf9fe..915a364bc 100644 --- a/src/java/org/apache/fop/svg/PDFGraphics2D.java +++ b/src/java/org/apache/fop/svg/PDFGraphics2D.java @@ -406,6 +406,50 @@ public class PDFGraphics2D extends AbstractGraphics2D { return false; } + return drawImage(img, x, y, width, height, observer); + } + + private BufferedImage buildBufferedImage(Dimension size) { + return new BufferedImage(size.width, size.height, + BufferedImage.TYPE_INT_ARGB); + } + + /** + * Draws as much of the specified image as has already been scaled + * to fit inside the specified rectangle. + *

+ * The image is drawn inside the specified rectangle of this + * graphics context's coordinate space, and is scaled if + * necessary. Transparent pixels do not affect whatever pixels + * are already there. + *

+ * This method returns immediately in all cases, even if the + * entire image has not yet been scaled, dithered, and converted + * for the current output device. + * If the current output representation is not yet complete, then + * drawImage returns false. As more of + * the image becomes available, the process that draws the image notifies + * the image observer by calling its imageUpdate method. + *

+ * A scaled version of an image will not necessarily be + * available immediately just because an unscaled version of the + * image has been constructed for this output device. Each size of + * the image may be cached separately and generated from the original + * data in a separate image production sequence. + * @param img the specified image to be drawn. + * @param x the x coordinate. + * @param y the y coordinate. + * @param width the width of the rectangle. + * @param height the height of the rectangle. + * @param observer object to be notified as more of + * the image is converted. + * @return true if the image was drawn + * @see java.awt.Image + * @see java.awt.image.ImageObserver + * @see java.awt.image.ImageObserver#imageUpdate(java.awt.Image, int, int, int, int, int) + */ + public boolean drawImage(Image img, int x, int y, int width, int height, + ImageObserver observer) { // first we look to see if we've already added this image to // the pdf document. If so, we just reuse the reference; // otherwise we have to build a FopImage and add it to the pdf @@ -543,51 +587,6 @@ public class PDFGraphics2D extends AbstractGraphics2D { return true; } - private BufferedImage buildBufferedImage(Dimension size) { - return new BufferedImage(size.width, size.height, - BufferedImage.TYPE_INT_ARGB); - } - - /** - * Draws as much of the specified image as has already been scaled - * to fit inside the specified rectangle. - *

- * The image is drawn inside the specified rectangle of this - * graphics context's coordinate space, and is scaled if - * necessary. Transparent pixels do not affect whatever pixels - * are already there. - *

- * This method returns immediately in all cases, even if the - * entire image has not yet been scaled, dithered, and converted - * for the current output device. - * If the current output representation is not yet complete, then - * drawImage returns false. As more of - * the image becomes available, the process that draws the image notifies - * the image observer by calling its imageUpdate method. - *

- * A scaled version of an image will not necessarily be - * available immediately just because an unscaled version of the - * image has been constructed for this output device. Each size of - * the image may be cached separately and generated from the original - * data in a separate image production sequence. - * @param img the specified image to be drawn. - * @param x the x coordinate. - * @param y the y coordinate. - * @param width the width of the rectangle. - * @param height the height of the rectangle. - * @param observer object to be notified as more of - * the image is converted. - * @return true if the image was drawn - * @see java.awt.Image - * @see java.awt.image.ImageObserver - * @see java.awt.image.ImageObserver#imageUpdate(java.awt.Image, int, int, int, int, int) - */ - public boolean drawImage(Image img, int x, int y, int width, int height, - ImageObserver observer) { - System.out.println("drawImage"); - return true; - } - /** * Disposes of this graphics context and releases * any system resources that it is using.