MASON-INTEREST-L Archives

December 2011

MASON-INTEREST-L@LISTSERV.GMU.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Christoph Schwarz <[log in to unmask]>
Reply To:
MASON Multiagent Simulation Toolkit <[log in to unmask]>
Date:
Tue, 13 Dec 2011 14:37:27 +0100
Content-Type:
text/plain
Parts/Attachments:
text/plain (39 lines)
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

ATOM RSS1 RSS2