PSWTPath.java 文件源码

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

项目:PhET 作者:
private void drawShape(final SWTGraphics2D g2) {
    final double lineWidth = g2.getTransformedLineWidth();
    if (shape instanceof Rectangle2D) {
        g2.drawRect(shapePts[0] + lineWidth / 2, shapePts[1] + lineWidth / 2, shapePts[2] - lineWidth, shapePts[3]
                - lineWidth);
    }
    else if (shape instanceof Ellipse2D) {
        g2.drawOval(shapePts[0] + lineWidth / 2, shapePts[1] + lineWidth / 2, shapePts[2] - lineWidth, shapePts[3]
                - lineWidth);
    }
    else if (shape instanceof Arc2D) {
        g2.drawArc(shapePts[0] + lineWidth / 2, shapePts[1] + lineWidth / 2, shapePts[2] - lineWidth, shapePts[3]
                - lineWidth, shapePts[4], shapePts[5]);
    }
    else if (shape instanceof RoundRectangle2D) {
        g2.drawRoundRect(shapePts[0] + lineWidth / 2, shapePts[1] + lineWidth / 2, shapePts[2] - lineWidth,
                shapePts[3] - lineWidth, shapePts[4], shapePts[5]);
    }
    else {
        g2.draw(shape);
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号