Christoph, mail me your image and let me try it.
Sean
On Dec 13, 2011, at 8:37 AM, Christoph Schwarz wrote:
> 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
|