Hello,
Can anyone help me with this? I want to apply a custom texture or create a custom texture and apply it to a geometry like, a rectangle or a oval. How am i to do that? Thank you.
Here’s the Java tutorial: http://docs.oracle.com/javase/tutorial/2d/geometry/strokeandfill.html
If that doesn’t work, post an MCVE that shows what you’ve tried and where you’re stuck, and we’ll go from there.
Hope this helps
// Graphics context will come from your Component you'd like to render on. (JPanel, Canvas etc..)
Graphics g = obtainYourSelf();
// To draw images:
g.drawImage(IMAGE, x, y, null);
g.drawImage(IMAGE, x, y, w, h, null);
// To draw plain geometry:
g.drawRect(x, y, w, h);
g.fillRect(x, y, w, h);
You can draw all types of geometry in Java but layering them with a texture I’m not quite sure all are do-able.
I’d also suggest reading the link posted above my reply by KevinWorkman.