harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dmitry Irlyanov (JIRA)" <j...@apache.org>
Subject [jira] Commented: (HARMONY-4221) [classlib][awt]BufferedImage.getSubimage method is incorrect
Date Mon, 18 Jun 2007 15:52:26 GMT

    [ https://issues.apache.org/jira/browse/HARMONY-4221?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12505853
] 

Dmitry Irlyanov commented on HARMONY-4221:
------------------------------------------

Added test file and test.png

> [classlib][awt]BufferedImage.getSubimage method is incorrect
> ------------------------------------------------------------
>
>                 Key: HARMONY-4221
>                 URL: https://issues.apache.org/jira/browse/HARMONY-4221
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Dmitry Irlyanov
>            Priority: Minor
>         Attachments: .jpg, CropTest.java, Harmony's result.jpg, test.png
>
>
> according spec, BufferedImage.getSubimage(int x, int y, int w, int h) method takes 2
first ints as a upper-left corner coordinate of subimage. But harmony implementation takes
upper-left corner point as (0,0)
> Look at the following code:
> import java.awt.Graphics;
> import java.awt.image.BufferedImage;
> import java.io.File;
> import java.io.IOException;
> import javax.imageio.ImageIO;
> import javax.swing.JFrame;
> import junit.framework.TestCase;
> public class cropTest extends TestCase {
>     public void testCrop() throws IOException {
>         final BufferedImage image = ImageIO.read(new File(cropTest.class
>                 .getResource("test.png").getPath()));
>         
>         JFrame f = new JFrame() {
>             @Override
>             public void paint(Graphics g) {
>                 g.drawImage(image.getSubimage(0, 0, 10, 10), 100, 100, 100,
>                         100, null);
>                 g.drawImage(image.getSubimage(0, 10, 10, 10), 100, 200, 100,
>                         100, null);
>                 g.drawImage(image.getSubimage(0, 20, 10, 10), 100, 300, 100,
>                         100, null);
>                 g.drawImage(image.getSubimage(10, 0, 10, 10), 200, 100, 100,
>                         100, null);
>                 g.drawImage(image.getSubimage(10, 10, 10, 10), 200, 200, 100,
>                         100, null);
>                 g.drawImage(image.getSubimage(10, 20, 10, 10), 200, 300, 100,
>                         100, null);
>                 g.drawImage(image.getSubimage(20, 0, 10, 10), 300, 100, 100,
>                         100, null);
>                 g.drawImage(image.getSubimage(20, 10, 10, 10), 300, 200, 100,
>                         100, null);
>                 g.drawImage(image.getSubimage(20, 20, 10, 10), 300, 300, 100,
>                         100, null);
>             }
>         };
>         f.setSize(500, 500);
>         f.setVisible(true);
>         f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
>     }
> }
> the results for RI and harmony represented on attached screenshots

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message