0

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? Example like a / or \?

Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
sproketboy
  • 8,967
  • 18
  • 65
  • 95
  • You might be looking for `Graphics2D.setPaint(TexturePaint)` 1) [`Graphics2D.setPaint(Paint)`](http://docs.oracle.com/javase/7/docs/api/java/awt/Graphics2D.html#setPaint%28java.awt.Paint%29) 2) [`TexturePaint`](http://docs.oracle.com/javase/7/docs/api/java/awt/TexturePaint.html) – Andrew Thompson Dec 31 '12 at 14:09
  • Fine but why vote it down? I've searched for a solution here and can't find one. Others would probably like to know how to do this. – sproketboy Dec 31 '12 at 14:12
  • The only person notified of that comment was me, and I don't know why the question was voted down, sorry. :( – Andrew Thompson Dec 31 '12 at 14:14

1 Answers1

2

use a TexturePaint.

TexturePaint paint = new TexturePaint(bufferedImage, anchorRect);
g.setPaint(paint);
g.setStroke(new BasicStroke(4.0F);
Joop Eggen
  • 107,315
  • 7
  • 83
  • 138