You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Dmitry Irlyanov (JIRA)" <ji...@apache.org> on 2007/06/18 17:46:26 UTC

[jira] Created: (HARMONY-4221) [classlib][awt]BufferedImage.getSubimage method is incorrect

[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


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.


[jira] Updated: (HARMONY-4221) [classlib][awt]BufferedImage.getSubimage method is incorrect

Posted by "Dmitry Irlyanov (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-4221?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Dmitry Irlyanov updated HARMONY-4221:
-------------------------------------

    Attachment: test.png
                CropTest.java

> [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.


[jira] Commented: (HARMONY-4221) [classlib][awt]BufferedImage.getSubimage method is incorrect

Posted by "Dmitry Irlyanov (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HARMONY-4221?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12505855 ] 

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

My apologies, TestCase inheritance is unneded in the code

> [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.


[jira] Updated: (HARMONY-4221) [classlib][awt]BufferedImage.getSubimage method is incorrect

Posted by "Dmitry Irlyanov (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-4221?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Dmitry Irlyanov updated HARMONY-4221:
-------------------------------------

    Attachment: Harmony's result.jpg

Harmony's result

> [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.


[jira] Commented: (HARMONY-4221) [classlib][awt]BufferedImage.getSubimage method is incorrect

Posted by "Dmitry Irlyanov (JIRA)" <ji...@apache.org>.
    [ 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.


[jira] Updated: (HARMONY-4221) [classlib][awt]BufferedImage.getSubimage method is incorrect

Posted by "Dmitry Irlyanov (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-4221?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Dmitry Irlyanov updated HARMONY-4221:
-------------------------------------

    Attachment: .jpg

RI's result

> [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
>
>
> 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.