public class ImageFigure extends AbstractFigure implements java.awt.image.ImageObserver
Constructor and Description |
---|
ImageFigure()
Create an empty image figure.
|
ImageFigure(java.awt.Image i)
Create an image figure displaying
the given image.
|
Modifier and Type | Method and Description |
---|---|
java.awt.Image |
getImage()
Return the figure's image.
|
java.awt.geom.Point2D |
getOrigin()
Return the origin of the figure in the enclosing transform
context.
|
java.awt.Shape |
getShape()
Return the rectangular shape of the
image, or a small rectangle if the
image is null.
|
boolean |
imageUpdate(java.awt.Image image,
int infoflags,
int x,
int y,
int width,
int height)
This method, which is required by the ImageObserver interface,
is called if something has changed in a background loading of
the image.
|
boolean |
isCentered()
Return whether the figure should be centered on its origin.
|
void |
paint(java.awt.Graphics2D g)
Paint the figure's image.
|
void |
setCentered(boolean centered)
Specify whether the figure should be centered on its origin.
|
void |
setImage(java.awt.Image i)
Set the figure's image.
|
void |
transform(java.awt.geom.AffineTransform t)
Perform an affine transform on this
image.
|
contains, getBounds, getInteractor, getLayer, getParent, getToolTipText, getTransformContext, getUserObject, hit, intersects, isVisible, paint, repaint, repaint, setInteractor, setParent, setToolTipText, setUserObject, setVisible, translate
public ImageFigure()
public ImageFigure(java.awt.Image i)
public java.awt.Image getImage()
public java.awt.geom.Point2D getOrigin()
getOrigin
in interface Figure
getOrigin
in class AbstractFigure
AbstractFigure.getBounds()
public java.awt.Shape getShape()
getShape
in interface Figure
getShape
in class AbstractFigure
public boolean imageUpdate(java.awt.Image image, int infoflags, int x, int y, int width, int height)
imageUpdate
in interface java.awt.image.ImageObserver
image
- The image being observed.infoflags
- The bitwise inclusive OR of the following flags:
WIDTH, HEIGHT, PROPERTIES, SOMEBITS, FRAMEBITS, ALLBITS, ERROR,
ABORT.x
- The x coordinate of the image.y
- The y coordinate of the image.width
- The width of the image.height
- The height of the image.public boolean isCentered()
getOrigin()
,
setCentered(boolean)
public void paint(java.awt.Graphics2D g)
paint
in interface VisibleComponent
paint
in class AbstractFigure
g
- The 2D graphics object that this object
it to be painted upon.public void setCentered(boolean centered)
centered
- False to make the origin of the figure, as
returned by getOrigin(), be the upper left corner.getOrigin()
public void setImage(java.awt.Image i)
i
- The image.public void transform(java.awt.geom.AffineTransform t)
transform
in interface Figure
transform
in class AbstractFigure
t
- The transform to be used.