1 2 3 4 5 6 7 8 9 10 11 12 13 14
|
// création de la texture
texture_bi = new BufferedImage(50,50,BufferedImage.TYPE_INT_BGR);
texture_g = texture_bi.createGraphics();
ImageIcon texture_image = new ImageIcon("images/texture_1.jpg");
texture_g.drawImage(texture_image.getImage(), 0, 0, this);
Rectangle2D imageRect = new Rectangle2D.Double(0.0, 0.0, texture_bi.getWidth(), texture_bi.getHeight());
texture = new TexturePaint(texture_bi, imageRect.getBounds2D());
....
// application de la texture
g.setPaint(texture);
g.fillPolygon(xs, ys, 4); |
Partager