Draw.java 文件源码

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

项目:MeteoInfoLib 作者:
/**
 * Draw polygon symbol
 *
 * @param aP The point
 * @param width The width
 * @param height The height
 * @param aPGB The polygon break
 * @param g Graphics2D
 */
public static void drawPolygonSymbol(PointF aP, float width, float height, PolygonBreak aPGB,
        Graphics2D g) {
    aP.X = aP.X - width / 2;
    aP.Y = aP.Y - height / 2;
    if (aPGB.isDrawFill()) {
        if (aPGB.isUsingHatchStyle()) {
            int size = aPGB.getStyleSize();
            BufferedImage bi = getHatchImage(aPGB.getStyle(), size, aPGB.getColor(), aPGB.getBackColor());
            Rectangle2D rect = new Rectangle2D.Double(0, 0, size, size);
            g.setPaint(new TexturePaint(bi, rect));
            g.fill(new Rectangle.Float(aP.X, aP.Y, width, height));
        } else {
            g.setColor(aPGB.getColor());
            g.fill(new Rectangle.Float(aP.X, aP.Y, width, height));
        }
    }
    if (aPGB.isDrawOutline()) {
        g.setColor(aPGB.getOutlineColor());
        g.setStroke(new BasicStroke(aPGB.getOutlineSize()));
        g.draw(new Rectangle.Float(aP.X, aP.Y, width, height));
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号