Sender: |
|
Subject: |
|
From: |
|
Date: |
Tue, 13 Dec 2011 14:37:27 +0100 |
Content-Type: |
text/plain; charset=ISO-8859-1 |
MIME-Version: |
1.0 |
Reply-To: |
|
Parts/Attachments: |
|
|
Hi together!
I have a Problem with using ImagePrtrayals.
With the following code:
bumperPortrayal.setPortrayalForAll( new
sim.portrayal.simple.RectanglePortrayal2D(Color.orange,4.0) );
Everything works. The bumpers a shown as orange rectangles.
When i alter the statement to:
Image i = new ImageIcon(getClass().getResource("T16.gif")).getImage();
BufferedImage b =
display.getGraphicsConfiguration().createCompatibleImage(i.getWidth(null),
i.getHeight(null));
bumperPortrayal.setPortrayalForAll(new
sim.portrayal.simple.ImagePortrayal2D(i));
I have no visualization of the bumpers at all.
Loading the BufferedImage should work fine, since:
Image i = new ImageIcon(getClass().getResource("T16.gif")).getImage();
BufferedImage b =
display.getGraphicsConfiguration().createCompatibleImage(i.getWidth(null),
i.getHeight(null));
Graphics g = b.getGraphics();
g.drawImage(i,0,0,i.getWidth(null),i.getHeight(null),null);
g.dispose();
display.setBackdrop(new TexturePaint(b, new
Rectangle(0,0,i.getWidth(null),i.getHeight(null))));
works. Has anyone an idea?
Best regards,
Christoph
|
|
|