United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-6966746 Dashed lines are broken with certain scaling transforms
JDK-6966746 : Dashed lines are broken with certain scaling transforms

Details
Type:
Bug
Submit Date:
2010-07-05
Status:
Closed
Updated Date:
2012-03-20
Project Name:
JDK
Resolved Date:
2011-03-07
Component:
client-libs
OS:
linux
Sub-Component:
2d
CPU:
x86
Priority:
P4
Resolution:
Duplicate
Affected Versions:
7
Fixed Versions:

Related Reports
Duplicate:

Sub Tasks

Description
FULL PRODUCT VERSION :
java version "1.6.0_18"
OpenJDK Runtime Environment (IcedTea6 1.8) (fedora-41.b18.fc13-x86_64)
OpenJDK 64-Bit Server VM (build 14.0-b16, mixed mode)

ADDITIONAL OS VERSION INFORMATION :
2.6.33.5-124.fc13.x86_64 #1 SMP Fri Jun 11 09:38:12 UTC 2010 x86_64 x86_64 x86_64 GNU/Linux

A DESCRIPTION OF THE PROBLEM :
When dashed lines are drawn with a transform of the form [[n,0],[0,n]] in effect, dashed lines are not drawn properly. The dashes are much longer than they should be.

The problem is caused by the "symmetric" variable in pisces/Dasher.java, and how it is used when computing dash lengths in lineTo in that same file.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run provided source.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
White dashed line is drawn on black background where the dashes are about 4 pixels long.
ACTUAL -
The dashes are much longer.

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
import java.awt.*;
import java.awt.geom.*;
import java.awt.image.*;
import javax.imageio.*;

public class TestDBZ extends Frame {

    public static void main(String[] args) {
        BufferedImage bImg = new BufferedImage(512, 512, BufferedImage.TYPE_INT_RGB);
        Graphics2D g2d = (Graphics2D) bImg.getGraphics();

        g2d.setStroke(new BasicStroke(0.1f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND, 10.0f, new float[] {0.2f, 0.2f}, 0));

        g2d.scale(20, 20);
        g2d.drawLine(1, 1, 10, 10);
        try { ImageIO.write(bImg, "png", new java.io.File("test.png")); } catch (Exception e) {}
    }
}

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

CUSTOMER SUBMITTED WORKAROUND :
This isn't very feasible, but it's the only possibility: don't use transforms.

                                    

Comments



Hardware and Software, Engineered to Work Together