use of sun.awt.geom.PathConsumer2D in project jdk8u_jdk by JetBrains.
the class PiscesRenderingEngine method createStrokedShape.
/**
* Create a widened path as specified by the parameters.
* <p>
* The specified {@code src} {@link Shape} is widened according
* to the specified attribute parameters as per the
* {@link BasicStroke} specification.
*
* @param src the source path to be widened
* @param width the width of the widened path as per {@code BasicStroke}
* @param caps the end cap decorations as per {@code BasicStroke}
* @param join the segment join decorations as per {@code BasicStroke}
* @param miterlimit the miter limit as per {@code BasicStroke}
* @param dashes the dash length array as per {@code BasicStroke}
* @param dashphase the initial dash phase as per {@code BasicStroke}
* @return the widened path stored in a new {@code Shape} object
* @since 1.7
*/
public Shape createStrokedShape(Shape src, float width, int caps, int join, float miterlimit, float[] dashes, float dashphase) {
final Path2D p2d = new Path2D.Float();
strokeTo(src, null, width, NormMode.OFF, caps, join, miterlimit, dashes, dashphase, new PathConsumer2D() {
public void moveTo(float x0, float y0) {
p2d.moveTo(x0, y0);
}
public void lineTo(float x1, float y1) {
p2d.lineTo(x1, y1);
}
public void closePath() {
p2d.closePath();
}
public void pathDone() {
}
public void curveTo(float x1, float y1, float x2, float y2, float x3, float y3) {
p2d.curveTo(x1, y1, x2, y2, x3, y3);
}
public void quadTo(float x1, float y1, float x2, float y2) {
p2d.quadTo(x1, y1, x2, y2);
}
public long getNativeConsumer() {
throw new InternalError("Not using a native peer");
}
});
return p2d;
}
Aggregations