"Smearing" when scrolling monochrome images

XMLWordPrintable

    • Type: Bug
    • Resolution: Duplicate
    • Priority: P4
    • None
    • Affects Version/s: 1.1.1
    • Component/s: client-libs
    • 2d
    • x86
    • windows_98

      Name: jk109818 Date: 05/23/2002


      FULL PRODUCT VERSION :
      java version "1.4.0"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-b92)
      Java HotSpot(TM) Client VM (build 1.4.0-b92, mixed mode)


      FULL OPERATING SYSTEM VERSION :Windows 98 [Version
      4.10.2222]



      ADDITIONAL OPERATING SYSTEMS : Windows 2000



      A DESCRIPTION OF THE PROBLEM :
      When I display a monochrome JAI image in a
      ScrollPane that contains the image
      sink for the image, the image is "smeared"
      when I scroll in small increments. i.e.,
      moving the scrollbar a little bit to the right
      or left, or using the little arrow, small vertical
      lines look like wide lines, and text is a few pixels
      wide when it should be one or two pixels wide. This
      seems to happen for monochrome images but not for color
      ones.

      BTW, I have also noticed problems with
      repaint(int, int, int, int) redrawing pixels at a location
      one or two pixels to the left or right of where
      they should be. I think this might be another
      symptom of the same problem.


      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. Run the enclosed program, using a large monochrome TIFF
      image for input. I can supply you with a sample
      image if necessary.
      2. Scroll using the arrows, especially looking at
      well-defined edges in the image.
      3.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      The image shouldn't be displayed differently depending
      on whether I do fast or slow scrolling.


      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      No trace information appeared.


      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.awt.Component;
      import java.awt.Dimension;
      import java.awt.Graphics;
      import java.awt.Graphics2D;
      import java.awt.ScrollPane;
      import java.awt.geom.AffineTransform;
      import java.awt.image.RenderedImage;
      import javax.media.jai.JAI;
      import javax.swing.JFrame;

      public class JAIScroller {
          ScrollPane scrollPane;
          JAIScrollCanvas canvas;

          public JAIScroller (RenderedImage sourceImage) {
      scrollPane = new ScrollPane ();
      canvas = new JAIScrollCanvas (sourceImage);
      scrollPane.add (canvas);
          }
          public ScrollPane getScrollPane() { return scrollPane; }
          public static void main (String[] argv) {
      if (argv.length == 0) {
      System.out.println ("usage: java JAIScroller <imagefilename>");
      return;
      }
      String filename = argv[0];
      System.out.println ("Loading image file: " + filename);
      RenderedImage image = JAI.create ("fileload", filename);
      JFrame jframe = new JFrame ("JAIScroller Test");
      JAIScroller js = new JAIScroller (image);
      jframe.getContentPane().add (js.getScrollPane());
      jframe.setSize (400, 400);
      jframe.invalidate();
      jframe.setVisible (true);
          }

          class JAIScrollCanvas extends Component {
      RenderedImage localSourceImage;
      AffineTransform identityTransform = new AffineTransform();

      public JAIScrollCanvas (RenderedImage localSourceImage) {
      set (localSourceImage);
      }

      public void set (RenderedImage localSourceImage) {
      if (localSourceImage == null) return;
      this.localSourceImage = localSourceImage;
      setSize (localSourceImage.getWidth(),
      localSourceImage.getHeight());
      scrollPane.invalidate();
      scrollPane.repaint();
      }
      public Dimension getPreferredSize() {
      if (localSourceImage == null) return null;
      return new Dimension
      ((int)(localSourceImage.getWidth()),
      (int)(localSourceImage.getHeight()));
      }
      public void update(Graphics g) { paint(g); }
      public void paint (Graphics g) {
      if (localSourceImage == null) return;
      Graphics2D g2d = (Graphics2D)g;
      g2d.drawRenderedImage (localSourceImage,
      identityTransform);
      }
          }
      }

      ---------- END SOURCE ----------

      CUSTOMER WORKAROUND :
      I haven't found a workaround yet. My client is
      screaming for one. Let me know if you have any
      bright ideas.
      (Review ID: 146448)
      ======================================================================

            Assignee:
            Jim Graham
            Reporter:
            Jeffrey Kim (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: