简体   繁体   English

Java绘制线条纹理

[英]Java draw line with textures

I'm trying to figure this out with no success. 我试图弄清楚这一点并没有成功。 I can draw rectangles with a texture but how could I draw a line of say 4 pixels wide at an angle using a texture? 我可以用纹理绘制矩形,但是如何使用纹理在某个角度绘制一条4像素宽的线? Example like a / or \\ ? 例如a /\\

use a TexturePaint . 使用TexturePaint

TexturePaint paint = new TexturePaint(bufferedImage, anchorRect);
g.setPaint(paint);
g.setStroke(new BasicStroke(4.0F);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM