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

BufferedImage methods getTileGridXOffset() and getTileGridYOffset() return a non 0 value for sub images

XMLWordPrintable

    • b12
    • x86_64
    • generic

      FULL PRODUCT VERSION :
      java version "1.8.0_101"
      Java(TM) SE Runtime Environment (build 1.8.0_101-b13)
      Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows [Version 6.1.7601]

      A DESCRIPTION OF THE PROBLEM :
      Based on https://docs.oracle.com/javase/8/docs/api/java/awt/image/BufferedImage.html

      The documentation for the methods getTileGridXOffset() and getTileGridYOffset() of the class java.awt.image.BufferedImage says "This is always zero." but for sub images (getSubimage(int x, int y, int w, int h)) this is not true.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. Create a sub image using the method java.awt.image.BufferedImage.getSubimage(int, int, int, int)
      2. Call the method java.awt.image.BufferedImage.getTileGridXOffset() or java.awt.image.BufferedImage.getTileGridYOffset() of this sub image

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The returned value would be 0 or the documentation should not say it is always 0
      ACTUAL -
      The returned value is -x respectively -y

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      java.awt.image.BufferedImage baseBufferedImage = new java.awt.image.BufferedImage(2048, 2048, java.awt.image.BufferedImage.TYPE_INT_ARGB);

      java.awt.image.BufferedImage subBufferedImage = baseBufferedImage.getSubimage(512, 512, 100, 100);
      System.out.println("getTileGridXOffset() " + subBufferedImage.getTileGridXOffset());
      System.out.println("getTileGridYOffset() " + subBufferedImage.getTileGridYOffset());
      ---------- END SOURCE ----------

            serb Sergey Bylokhov
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: