Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4532352

REGRESSION: subcase of drawImage with background for transparent broken

    XMLWordPrintable

    Details

    • Subcomponent:
      2d
    • Resolved In Build:
      01
    • CPU:
      x86
    • OS:
      windows_98

      Backports

        Description



        Name: rmT116609 Date: 11/28/2001


        java version "1.4.0-beta3"
        Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-beta3-b84)
        Java HotSpot(TM) Client VM (build 1.4.0-beta3-b84, mixed mode)

        The following method is broken:
         Graphics.drawImage(Image img, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, Color bgcolor, ImageObserver observer)
        in the subcase when the specified area requires scaling to fit into the destination.

        It was working in
          java version "1.3.0"
          Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-C)
          Java HotSpot(TM) Client VM (build 1.3.0-C, mixed mode)


        The bug is shown by the following code:

        import java.awt.*;
        import java.awt.image.*;

        public class TransparentTest extends Frame {
          Image img_ = null;

          public void paint(Graphics g) {
        g.setColor(Color.green); g.fillRect(0,0, getWidth(), getHeight());
        g.setColor(Color.red); g.drawLine(0,0, 300,300);

        // works -- same method as below, but requires scaling
        g.drawImage(img_, 10,10,310,310, 10,10,60,110, Color.yellow, this);

        // CALL THAT DOESN'T REQUIRE SCALING
        // DOESN'T TAKE PASSED COLOR FOR TRANSPARENT PIXEL AND INSTEAD USES EXISTING BACKGROUND
        g.drawImage(img_, 100,100,100+50,100+100, 10,10,10+50,10+100, Color.green, this);
          }

            public static void main(String[] args) {
        try {
        TransparentTest f = new TransparentTest();
        // edit image path to image
        f.img_ = f.getToolkit().getImage("duke4.gif");
        f.setBounds(100,100, 500,500);
        f.show();

        } catch (Exception e) {
        System.out.println(e);
        }
          }
        }
        (Review ID: 136403)
        ======================================================================

          Attachments

            Issue Links

              Activity

                People

                Assignee:
                campbell Christopher Campbell (Inactive)
                Reporter:
                rmandalasunw Ranjith Mandala (Inactive)
                Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: