abak / java-image-scaling

Automatically exported from code.google.com/p/java-image-scaling
Other
0 stars 0 forks source link

Incorrect implementation of getBounds2D and getPoint2D #31

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Call the getPoint2D or getBounds2D of the ResampleOp

What is the expected output? What do you see instead?
The expected output is the new size of the image and the new location of the 
point

What I see is the size of the source image and the location of the source point

What version of the product are you using? On what operating system?
0.8.5

Here is the fix for AdvancedResizeOp.java

public final Rectangle2D getBounds2D(BufferedImage src) {
    Dimension dstDimension = dimensionConstrain.getDimension(new  Dimension(src.getWidth(),src.getHeight()));
    return new Rectangle(0, 0, dstDimension.width, dstDimension.height);
}

public final Point2D getPoint2D(Point2D srcPt, Point2D dstPt) {
    if (dstPt != null) {
        return dstPt;
    } else {
        Dimension dstDimension = dimensionConstrain.getDimension(new  Dimension(srcPt.x, srcPt.y));
        return new Point2D.Double(dstDimension.width, dstDimension.height);
    }
}

Original issue reported on code.google.com by anthony....@gmail.com on 29 Nov 2012 at 5:27

GoogleCodeExporter commented 9 years ago

Original comment by mor...@nobel-joergensen.com on 3 Dec 2012 at 4:04