blob: 2270e53a28b761b91e837b0b2c5d2b634432d9ec [file] [log] [blame]
<test title="Stroke Extension Testing">
<description>
This test validates handling of Stroke implementations
other than BasicStroke.
</description>
<description>
Only BasicStroke has an equivalent in SVG. Other Strokes
are handled by filling the stroked path with the current
Paint.
</description>
<import>
import com.sun.glf.goodies.*;
</import>
<javaCode>
<![CDATA[
g.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
//
// Build a ShapeStroke
//
Shape smallDot = new Ellipse2D.Float(0, 0, 12, 12);
// small rectangle
Shape smallRect = new Rectangle(0, 0, 12, 12);
// Small Triangle
GeneralPath smallTriangle = new GeneralPath();
smallTriangle.moveTo(6, 0);
smallTriangle.lineTo(12, 12);
smallTriangle.lineTo(0, 12);
smallTriangle.closePath();
Shape pattern[] = { smallDot, smallRect, smallTriangle };
ShapeStroke shapeStroke = new ShapeStroke(pattern, 20);
//
// Build a WaveStroke
//
Stroke waveStroke = new WaveStroke(5, 20, 6);
Rectangle rect = new Rectangle(75, 25, 150, 150);
Ellipse2D disc = new Ellipse2D.Double(75, 225, 150, 150);
g.setPaint(Color.black);
g.setStroke(shapeStroke);
g.draw(rect);
g.setStroke(waveStroke);
g.draw(disc);
]]>
</javaCode>
</test>