JDK-4193338 : drawArc() to offscreen produces unsmooth arc
  • Type: Bug
  • Component: client-libs
  • Sub-Component: 2d
  • Affected Version: 1.2.0
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: generic
  • CPU: generic
  • Submitted: 1998-11-28
  • Updated: 1999-04-09
  • Resolved: 1999-04-09
Related Reports
Duplicate :  
Relates :  
Description

Name: gsC80088			Date: 11/28/98


// drawArc() incorrect in 1.2RC2 when
// drawn onto off-screen Image
//

import java.applet.*;
import java.awt.*;

public class ArcBug extends Applet {

public static void main(String args[]) {

ArcBug	arcBug = new ArcBug();
Frame	frame = new Frame("Arc bug");

frame.add("Center", arcBug);
frame.setSize(200, 120);
frame.show();
}

public void paint(Graphics g) {

int		width = getSize().width,
		height = getSize().height;
Graphics	offscreenGraphics;
Image		offscreenImage;

// Create the off-screen drawable
//
offscreenImage = createImage(width, height);
offscreenGraphics = offscreenImage.getGraphics();

// Draw the arc off-screen (incorrectly drawn)
//
offscreenGraphics.setColor(Color.white);
offscreenGraphics.fillRect(0, 0, width, height);
offscreenGraphics.setColor(Color.blue);
offscreenGraphics.drawString("Incorrect arc", 10, 30);
offscreenGraphics.drawArc(35, 50, 20, 20, 0, 180);

// And copy it onto the screen
//
g.drawImage(offscreenImage, 0, 0, this);

// Now, draw the arc on-screen (correctly drawn)
//
g.setColor(Color.black);
g.drawString("Correct arc", 110, 30);
g.drawArc(125, 50, 20, 20, 0, 180);
}
}
(Review ID: 43406)
======================================================================

Comments
WORK AROUND Name: gsC80088 Date: 11/28/98 None ======================================================================
11-06-2004