Sluggish dragging over JGoImage

Hello,

I have a simple JGoView that I add a JGoImage and a JGoPolygon to. I then resize the JGoImage to about 4 times its original size. When I drag the JGoPloygon around the view, the dragging becomes sluggish over the JGoImage but returns to normal speed when not over the JGoImage. By sluggish I mean that the polygon graphic does not keep up with the mouse pointer.

Is there something I can do to improve this performance?

Thank you

Tony

That’s odd, performance should be very good in the case you describe. I’ve tried to reproduce the problem with the following code:

// Create image
JGoImage image = new JGoImage(new Rectangle(0,0,40,40));
image.loadImage(Test.class.getResource(“image.jpg”), true);
goView.getDocument().add(image);
// Create polygon
JGoPolygon gon = new JGoPolygon();
gon.setBrush(JGoBrush.makeStockBrush(Color.red));
gon.setPen(JGoPen.make(JGoPen.SOLID, 3, Color.white));
gon.addPoint(new Point(10, 0));
gon.addPoint(new Point(20, 0));
gon.addPoint(new Point(30, 10));
gon.addPoint(new Point(30, 20));
gon.addPoint(new Point(20, 30));
gon.addPoint(new Point(10, 30));
gon.addPoint(new Point( 0, 20));
gon.addPoint(new Point( 0, 10));
goView.getDocument().add(gon);

I’ve used a high resolution image in the background and resized it by manually dragging the resize handles. I then drag around the polygon in the foreground and it seems to run like the wind for me - no delay seen at all.

Does this sample also run well for you?

I tried your code but got the same results. The bigger I make the image the slower/jumpier the dragging gets. I used the JGoRectangle-001.jpg image from your library. When it is small, the dragging is fast. When I resized the image to by dragging the resize handles, the larger image caused the dragging to be jumpy.

I can send you a desktop video of the behavior if that would help.

This is the code I’m using to duplicate the problem.

    setLayout(new BorderLayout());
    
    JGoView goView = new JGoView();
    
    // Create image
    JGoImage image = new JGoImage(new Rectangle(0, 0, 40, 40));
    image.loadImage(testJGoPanel.class.getResource("JGoRectangle-001.jpg"), true);
    
    
    goView.getDocument().add(image);
    // Create polygon
    JGoPolygon gon = new JGoPolygon();
    gon.setBrush(JGoBrush.makeStockBrush(Color.red));
    gon.setPen(JGoPen.make(JGoPen.SOLID, 3, Color.white));
    gon.addPoint(new Point(10, 0));
    gon.addPoint(new Point(20, 0));
    gon.addPoint(new Point(30, 10));
    gon.addPoint(new Point(30, 20));
    gon.addPoint(new Point(20, 30));
    gon.addPoint(new Point(10, 30));
    gon.addPoint(new Point(0, 20));
    gon.addPoint(new Point(0, 10));
    goView.getDocument().add(gon);

    add(goView, BorderLayout.CENTER);

I’ve just modified my test case to use JGoRectangle-001.jpg for the image. It still drags without any delay for me.

I don’t think sending me a desktop video of your performance will help – I’m willing to believe that you’re seeing the delay you describe. The question is, what’s different between your environment vs. mine? Can you tell me whether you’re using JGo Swing or JGo SWT? Also, the exact version number and what operating system you are using.

here’s my configuration

JGo for Swing version 5.40.
Windows 7 professional.
Java JDK 7.0_13

I’ve also tried this on my office workstation, laptop and home computer and get the same results.

Let me know if you need any other information.

Thanks

I’ve just tested on exactly the same configuration, and still cannot reproduce problem.

I’m sending you an executable jar file via email. That will help us insure we’re running exactly the same test. Let me know if you still have performance problems using the jar.

FYI, this discussion continued in email. The resolution was to override GoView.applyRenderingHints and set the KEY_INTERPOLATION to VALUE_INTERPOLATION_BILINEAR, after which the dragging sped right up.