DMarlinRenderingEngine.java 文件源码

java
阅读 25 收藏 0 点赞 0 评论 0

项目:openjdk-jdk10 作者:
/**
 * 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
 */
@Override
public Shape createStrokedShape(Shape src,
                                float width,
                                int caps,
                                int join,
                                float miterlimit,
                                float[] dashes,
                                float dashphase)
{
    final DRendererContext rdrCtx = getRendererContext();
    try {
        // initialize a large copyable Path2D to avoid a lot of array growing:
        final Path2D.Double p2d = rdrCtx.getPath2D();

        strokeTo(rdrCtx,
                 src,
                 null,
                 width,
                 NormMode.OFF,
                 caps,
                 join,
                 miterlimit,
                 dashes,
                 dashphase,
                 rdrCtx.transformerPC2D.wrapPath2d(p2d)
                );

        // Use Path2D copy constructor (trim)
        return new Path2D.Double(p2d);

    } finally {
        // recycle the DRendererContext instance
        returnRendererContext(rdrCtx);
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号