sim.portrayal.simple
Class ImagePortrayal2D
java.lang.Object
sim.portrayal.SimplePortrayal2D
sim.portrayal.simple.RectanglePortrayal2D
sim.portrayal.simple.ImagePortrayal2D
- All Implemented Interfaces:
- Portrayal, Portrayal2D, java.io.Serializable
- public class ImagePortrayal2D
- extends RectanglePortrayal2D
A simple portrayal for 2D visualization of images. It extends the SimplePortrayal2D and
it manages the drawing and hit-testing for rectangular shapes containing images/pictures.
ImagePortrayal2D draws an image centered on the Portrayal's origin.
Images are not stretched to fill the info.draw.height x info.draw.width rectangle. Instead, if the image
is taller than it is wide, then the width of the image will be info.draw.width * scale and the height
will stay in proportion; else the height of the image will be info.draw.height * scale and the
width will stay in proportion.
- See Also:
- Serialized Form
Field Summary |
java.awt.Image |
image
|
Method Summary |
void |
draw(java.lang.Object object,
java.awt.Graphics2D graphics,
DrawInfo2D info)
Draw a portrayed object centered at the origin in info, and
with the given scaling factors. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
image
public java.awt.Image image
ImagePortrayal2D
public ImagePortrayal2D(java.awt.Image image)
ImagePortrayal2D
public ImagePortrayal2D(java.awt.Image image,
double scale)
draw
public void draw(java.lang.Object object,
java.awt.Graphics2D graphics,
DrawInfo2D info)
- Description copied from interface:
Portrayal2D
- Draw a portrayed object centered at the origin in info, and
with the given scaling factors. It is possible that object
is null.
- Specified by:
draw
in interface Portrayal2D
- Overrides:
draw
in class RectanglePortrayal2D