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:
Sean Luke <[log in to unmask]>
Reply To:
MASON Multiagent Simulation Toolkit <[log in to unmask]>
Date:
Tue, 13 Dec 2011 11:00:35 -0500
Content-Type:
text/plain
Parts/Attachments:
text/plain (45 lines)
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

ATOM RSS1 RSS2