use of org.apache.poi.hwmf.record.HwmfHatchStyle in project poi by apache.
the class HwmfGraphics method getHatchedFill.
protected Paint getHatchedFill() {
int dim = 7, mid = 3;
BufferedImage bi = new BufferedImage(dim, dim, BufferedImage.TYPE_4BYTE_ABGR);
Graphics2D g = bi.createGraphics();
Color c = (prop.getBkMode() == HwmfBkMode.TRANSPARENT) ? new Color(0, true) : prop.getBackgroundColor().getColor();
g.setColor(c);
g.fillRect(0, 0, dim, dim);
g.setColor(prop.getBrushColor().getColor());
HwmfHatchStyle h = prop.getBrushHatch();
if (h == HwmfHatchStyle.HS_HORIZONTAL || h == HwmfHatchStyle.HS_CROSS) {
g.drawLine(0, mid, dim, mid);
}
if (h == HwmfHatchStyle.HS_VERTICAL || h == HwmfHatchStyle.HS_CROSS) {
g.drawLine(mid, 0, mid, dim);
}
if (h == HwmfHatchStyle.HS_FDIAGONAL || h == HwmfHatchStyle.HS_DIAGCROSS) {
g.drawLine(0, 0, dim, dim);
}
if (h == HwmfHatchStyle.HS_BDIAGONAL || h == HwmfHatchStyle.HS_DIAGCROSS) {
g.drawLine(0, dim, dim, 0);
}
g.dispose();
return new TexturePaint(bi, new Rectangle(0, 0, dim, dim));
}
Aggregations