FXGraphics2D.java 文件源码

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

项目:ccu-historian 作者:
/**
 * Fills the specified shape with the current {@code paint}.  There is
 * direct handling for {@code RoundRectangle2D}, 
 * {@code Rectangle2D}, {@code Ellipse2D} and {@code Arc2D}.  
 * All other shapes are mapped to a path outline and then filled.
 * 
 * @param s  the shape ({@code null} not permitted). 
 * 
 * @see #draw(java.awt.Shape) 
 */
@Override
public void fill(Shape s) {
    if (s instanceof RoundRectangle2D) {
        RoundRectangle2D rr = (RoundRectangle2D) s;
        this.gc.fillRoundRect(rr.getX(), rr.getY(), rr.getWidth(), 
                rr.getHeight(), rr.getArcWidth(), rr.getArcHeight());
    } else if (s instanceof Rectangle2D) {
        Rectangle2D r = (Rectangle2D) s;
        this.gc.fillRect(r.getX(), r.getY(), r.getWidth(), r.getHeight());
    } else if (s instanceof Ellipse2D) {
        Ellipse2D e = (Ellipse2D) s;
        this.gc.fillOval(e.getX(), e.getY(), e.getWidth(), e.getHeight());
    } else if (s instanceof Arc2D) {
        Arc2D a = (Arc2D) s;
        this.gc.fillArc(a.getX(), a.getY(), a.getWidth(), a.getHeight(), 
                a.getAngleStart(), a.getAngleExtent(), 
                intToArcType(a.getArcType()));
    } else {
        shapeToPath(s);
        this.gc.fill();
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号