4
任何知道如何在Java中重新創建交叉散列紋理?下面的C#代碼顯示瞭如何在.NET框架中完成此操作。 Java片段很近,但我無法正確地將線條旋轉45度。Java交叉陰影紋理
C#
HatchBrush crossHatch =
new HatchBrush(HatchStyle.Cross, somecolor, somecolor);
的Java
BufferedImage bufferedImage =
new BufferedImage(5, 5, BufferedImage.TYPE_INT_ARGB);
Graphics2D g2 = bufferedImage.createGraphics();
g2.setColor(Color.BLUE);
g2.fillRect(0, 0, 5, 5);
g2.setColor(pinColor);
g2.fillOval(0, 0, 5, 5);
// paint with the texturing brush
Rectangle2D rect = new Rectangle2D.Double(0, 0, 5, 5);
g2d.setPaint(new TexturePaint(bufferedImage, rect));
g2d.fill(shape);
在此先感謝。