[OpenJDK 2D-Dev] [PATCH] Fix BasicStroke's usage of dash elements

Omair Majid omajid at redhat.com
Tue Jan 13 18:22:16 UTC 2009


The Java Tutorials [1] say this about the dash_array parameter of 

The dash array defines the dash pattern. Alternating elements in the 
array represent the dash length and the length of the space between 
dashes in user coordinate units. Element 0 represents the first dash, 
element 1 the first space, and so on.

However, in openjdk6 (and openjdk7 - I havent tested explicitly, just 
looked at the code) it seems to be the other way around: element 0 
represent the first space and element 1 the first dash (and so on). The 
attached program, when run with openjdk6, produces a solid black border 
around the button text instead of no border.

The attached patch tries to fix the problem by initializing the renderer 
with dashOn = true so that the first element of the array produces a 
dash. The second element then produces a space and so on.


[1] http://java.sun.com/docs/books/tutorial/2d/geometry/strokeandfill.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: DashStrokeButton.java
Type: text/x-java
Size: 1866 bytes
Desc: not available
URL: <http://mail.openjdk.java.net/pipermail/2d-dev/attachments/20090113/819a0eab/DashStrokeButton.java>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: openjdk-java2d-dasher.patch
Type: text/x-patch
Size: 413 bytes
Desc: not available
URL: <http://mail.openjdk.java.net/pipermail/2d-dev/attachments/20090113/819a0eab/openjdk-java2d-dasher.patch>

More information about the 2d-dev mailing list