You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xmlgraphics.apache.org by je...@apache.org on 2007/12/19 16:02:15 UTC
svn commit: r605565 -
/xmlgraphics/commons/branches/TempNewImagePackage/src/java/org/apache/xmlgraphics/image/loader/impl/ImageConverterBitmap2G2D.java
Author: jeremias
Date: Wed Dec 19 07:02:14 2007
New Revision: 605565
URL: http://svn.apache.org/viewvc?rev=605565&view=rev
Log:
Bugfix: Scaling did not behave as required.
Modified:
xmlgraphics/commons/branches/TempNewImagePackage/src/java/org/apache/xmlgraphics/image/loader/impl/ImageConverterBitmap2G2D.java
Modified: xmlgraphics/commons/branches/TempNewImagePackage/src/java/org/apache/xmlgraphics/image/loader/impl/ImageConverterBitmap2G2D.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/branches/TempNewImagePackage/src/java/org/apache/xmlgraphics/image/loader/impl/ImageConverterBitmap2G2D.java?rev=605565&r1=605564&r2=605565&view=diff
==============================================================================
--- xmlgraphics/commons/branches/TempNewImagePackage/src/java/org/apache/xmlgraphics/image/loader/impl/ImageConverterBitmap2G2D.java (original)
+++ xmlgraphics/commons/branches/TempNewImagePackage/src/java/org/apache/xmlgraphics/image/loader/impl/ImageConverterBitmap2G2D.java Wed Dec 19 07:02:14 2007
@@ -22,13 +22,12 @@
import java.awt.Dimension;
import java.awt.Graphics2D;
import java.awt.geom.AffineTransform;
-import java.awt.geom.Dimension2D;
import java.awt.geom.Rectangle2D;
+import java.awt.image.RenderedImage;
import java.util.Map;
import org.apache.xmlgraphics.image.loader.Image;
import org.apache.xmlgraphics.image.loader.ImageFlavor;
-import org.apache.xmlgraphics.image.loader.ImageSize;
import org.apache.xmlgraphics.java2d.Graphics2DImagePainter;
/**
@@ -48,25 +47,20 @@
}
public void paint(Graphics2D g2d, Rectangle2D area) {
- ImageSize imageSize = rendImage.getSize();
+ RenderedImage ri = rendImage.getRenderedImage();
double w = area.getWidth();
double h = area.getHeight();
AffineTransform at = new AffineTransform();
- //Fit in paint area
- Dimension2D sizePt = imageSize.getDimensionPt();
- double sx = w / sizePt.getWidth();
- double sy = h / sizePt.getHeight();
- if (sx != 1.0 || sy != 1.0) {
- at.scale(sx, sy);
- }
+ at.translate(area.getX(), area.getY());
//Scale image to fit
- sx = w / imageSize.getWidthPx();
- sy = h / imageSize.getHeightPx();
+ double sx, sy;
+ sx = w / ri.getWidth();
+ sy = h / ri.getHeight();
if (sx != 1.0 || sy != 1.0) {
at.scale(sx, sy);
}
- g2d.drawRenderedImage(rendImage.getRenderedImage(), at);
+ g2d.drawRenderedImage(ri, at);
}
};
---------------------------------------------------------------------
Apache XML Graphics Project URL: http://xmlgraphics.apache.org/
To unsubscribe, e-mail: commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: commits-help@xmlgraphics.apache.org