Overview Package Class Tree Deprecated Index Help
PREV CLASS NEXT CLASS FRAMES NO FRAMES All Classes
SUMMARY: NESTED | FIELD | CONSTR | METHOD DETAIL: FIELD | CONSTR | METHOD

diva.canvas.toolbox
Class ImageFigure

java.lang.Object
 extended bydiva.canvas.AbstractFigure
 extended bydiva.canvas.toolbox.ImageFigure
All Implemented Interfaces:
CanvasComponent, Figure, java.awt.image.ImageObserver, UserObjectContainer, VisibleComponent

public class ImageFigure
extends AbstractFigure
implements java.awt.image.ImageObserver

A figure which draws a user-specified image.

Version:
$Id: ImageFigure.java,v 1.24 2005年10月24日 19:09:04 cxh Exp $
Author:
Michael Shilman

Field Summary
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
Constructor Summary
ImageFigure()
Create an empty image figure.
ImageFigure(java.awt.Image i)
Create an image figure displaying the given image.
Method Summary
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.
Methods inherited from class diva.canvas.AbstractFigure
contains, getBounds, getInteractor, getLayer, getParent, getToolTipText, getTransformContext, getUserObject, hit, intersects, isVisible, paint, repaint, repaint, setInteractor, setParent, setToolTipText, setUserObject, setVisible, translate
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail

ImageFigure

public ImageFigure()
Create an empty image figure.


ImageFigure

public ImageFigure(java.awt.Image i)
Create an image figure displaying the given image. This needs to be called in the Swing thread.

Method Detail

getImage

public java.awt.Image getImage()
Return the figure's image.


getOrigin

public java.awt.geom.Point2D getOrigin()
Return the origin of the figure in the enclosing transform context. This overrides the base class to return the center of the shape, if the figure is centered, or the origin of the shape if the figure is not centered.

Specified by:
getOrigin in interface Figure
Overrides:
getOrigin in class AbstractFigure
Returns:
The origin of the figure.
See Also:
AbstractFigure.getBounds()

getShape

public java.awt.Shape getShape()
Return the rectangular shape of the image, or a small rectangle if the image is null. NOTE: You cannot rely on the return value unless the image has been fully rendered.

Specified by:
getShape in interface Figure
Specified by:
getShape in class AbstractFigure

imageUpdate

public 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. It simply calls repaint().

Specified by:
imageUpdate in interface java.awt.image.ImageObserver
Parameters:
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.
Returns:
False if the infoflags indicate that the image is completely loaded; true otherwise.

isCentered

public boolean isCentered()
Return whether the figure should be centered on its origin.

Returns:
False If the origin of the figure, as returned by getOrigin(), is the upper left corner.
See Also:
getOrigin(), setCentered(boolean)

paint

public void paint(java.awt.Graphics2D g)
Paint the figure's image.

Specified by:
paint in interface VisibleComponent
Specified by:
paint in class AbstractFigure

setCentered

public void setCentered(boolean centered)
Specify whether the figure should be centered on its origin. By default, it is.

Parameters:
centered - False to make the origin of the figure, as returned by getOrigin(), be the upper left corner.
See Also:
getOrigin()

setImage

public void setImage(java.awt.Image i)
Set the figure's image. This should be called only from the Swing thread.

Parameters:
i - The image.

transform

public void transform(java.awt.geom.AffineTransform t)
Perform an affine transform on this image.

Specified by:
transform in interface Figure
Specified by:
transform in class AbstractFigure

Overview Package Class Tree Deprecated Index Help
PREV CLASS NEXT CLASS FRAMES NO FRAMES All Classes
SUMMARY: NESTED | FIELD | CONSTR | METHOD DETAIL: FIELD | CONSTR | METHOD

AltStyle によって変換されたページ (->オリジナル) /