-
Bug
-
Resolution: Unresolved
-
P4
-
7u55
-
x86_64
-
linux
FULL PRODUCT VERSION :
java version "1.7.0_55"
OpenJDK Runtime Environment (mageia-2.4.7.1.mga4-x86_64 u55-b13)
OpenJDK 64-Bit Server VM (build 24.51-b03, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Linux localhost 3.12.21-desktop-2.mga4 #1 SMP Thu Jun 5 21:33:44 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
A DESCRIPTION OF THE PROBLEM :
Graphics.drawLine() draws an extra pixel at the beginning of the line, close to the first point (x1, y1). Please note that this bug isn't reproducible under Microsoft Windows 7 64 bits with Oracle Java 1.7 update 60. Disabling the anti-aliasing has no effect. The Java2D pipeline based on XRender is used under GNU Linux and trying to disable it with -Dsun.java2d.xrender=false doesn't help.
ADDITIONAL REGRESSION INFORMATION:
java version "1.7.0_55"
OpenJDK Runtime Environment (mageia-2.4.7.1.mga4-x86_64 u55-b13)
OpenJDK 64-Bit Server VM (build 24.51-b03, mixed mode)
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run the short self-contained concise example I provided below. It draws a diagonal cross composed of 2 lines.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
drawLine(int x1, int y1, int x2, int y2) should draw a line between the points (x1, y1) and (x2, y2).
ACTUAL -
drawLine(int x1, int y1, int x2, int y2) draws a line between the points (x1, y1) and (x2, y2) but it extends the line near (x1, y1).
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.awt.BasicStroke;
import java.awt.Canvas;
import java.awt.Color;
import java.awt.Frame;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import javax.swing.SwingUtilities;
public class Test {
public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
Frame frame=new Frame();
frame.add(new Canvas(){
private static final long serialVersionUID = 1L;
@Override
public void paint(Graphics g){
final Graphics2D g2=(Graphics2D)g.create();
g2.setStroke(new BasicStroke(1.0f,BasicStroke.CAP_BUTT,BasicStroke.JOIN_MITER));
g2.setColor(Color.BLACK);
final int delta=3;
final int width=20;
final int height=20;
g2.drawLine(delta,delta,width-delta-1,height-delta-1);
g2.drawLine(width-delta-1,delta,delta,height-delta-1);
g2.dispose();
}
});
frame.setSize(600,600);
frame.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent we) {
System.exit(0);
}
});
frame.setVisible(true);
}
});
}
}
---------- END SOURCE ----------
java version "1.7.0_55"
OpenJDK Runtime Environment (mageia-2.4.7.1.mga4-x86_64 u55-b13)
OpenJDK 64-Bit Server VM (build 24.51-b03, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Linux localhost 3.12.21-desktop-2.mga4 #1 SMP Thu Jun 5 21:33:44 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
A DESCRIPTION OF THE PROBLEM :
Graphics.drawLine() draws an extra pixel at the beginning of the line, close to the first point (x1, y1). Please note that this bug isn't reproducible under Microsoft Windows 7 64 bits with Oracle Java 1.7 update 60. Disabling the anti-aliasing has no effect. The Java2D pipeline based on XRender is used under GNU Linux and trying to disable it with -Dsun.java2d.xrender=false doesn't help.
ADDITIONAL REGRESSION INFORMATION:
java version "1.7.0_55"
OpenJDK Runtime Environment (mageia-2.4.7.1.mga4-x86_64 u55-b13)
OpenJDK 64-Bit Server VM (build 24.51-b03, mixed mode)
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run the short self-contained concise example I provided below. It draws a diagonal cross composed of 2 lines.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
drawLine(int x1, int y1, int x2, int y2) should draw a line between the points (x1, y1) and (x2, y2).
ACTUAL -
drawLine(int x1, int y1, int x2, int y2) draws a line between the points (x1, y1) and (x2, y2) but it extends the line near (x1, y1).
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.awt.BasicStroke;
import java.awt.Canvas;
import java.awt.Color;
import java.awt.Frame;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import javax.swing.SwingUtilities;
public class Test {
public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
Frame frame=new Frame();
frame.add(new Canvas(){
private static final long serialVersionUID = 1L;
@Override
public void paint(Graphics g){
final Graphics2D g2=(Graphics2D)g.create();
g2.setStroke(new BasicStroke(1.0f,BasicStroke.CAP_BUTT,BasicStroke.JOIN_MITER));
g2.setColor(Color.BLACK);
final int delta=3;
final int width=20;
final int height=20;
g2.drawLine(delta,delta,width-delta-1,height-delta-1);
g2.drawLine(width-delta-1,delta,delta,height-delta-1);
g2.dispose();
}
});
frame.setSize(600,600);
frame.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent we) {
System.exit(0);
}
});
frame.setVisible(true);
}
});
}
}
---------- END SOURCE ----------