/**
* Fill polygon
*
* @param points The points array
* @param g Graphics2D
* @param aPGB Polygon break
*/
public static void fillPolygon(PointF[] points, Graphics2D g, PolygonBreak aPGB) {
GeneralPath path = new GeneralPath(GeneralPath.WIND_EVEN_ODD, points.length);
for (int i = 0; i < points.length; i++) {
if (i == 0) {
path.moveTo(points[i].X, points[i].Y);
} else {
path.lineTo(points[i].X, points[i].Y);
}
}
path.closePath();
if (aPGB != null) {
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(path);
} else {
g.fill(path);
}
} else {
g.fill(path);
}
}
Draw.java 文件源码
java
阅读 27
收藏 0
点赞 0
评论 0
项目:MeteoInfoLib
作者:
评论列表
文章目录