public class ImageDoodle extends FlatDoodle implements ImageObserver
Details:
ImageDoodle
s allow you to include arbitrary images in a figure.
ImageDoodle
comprises a Java AWT Image
and a bounding rectangle, called the "frame," which controls the position and size of the image in the figure.
The image is automatically scaled to fit in the frame, fully justified.
(Note that this means the image will be distorted if the aspect of the frame differs from the aspect ratio of the image.)
Optionally, a clipping shape, called the "mask," can also be specified.
This allows you to define image-
Several of the methods in this class refer to the "image area." This is defined as the intersection of the frame and the mask, or the confined region where image data is drawn.
mToolTip, mZOrder
mParent
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
Constructor and Description |
---|
ImageDoodle(Rectangle2D iFrame,
Image iImage)
Sets frame and image.
|
Modifier and Type | Method and Description |
---|---|
boolean |
contains(AffineTransform iTransform,
Point2D iP)
Determines whether point is contained in image area.
|
boolean |
draw(FigGraphics iG)
Renders doodle.
|
Rectangle2D |
getBounds(AffineTransform iTransform,
Rectangle2D oBounds)
Computes rectangular bounds.
|
Rectangle2D |
getFrame()
Returns the current frame.
|
Image |
getImage()
Returns current image.
|
Area |
getMask()
Returns current mask.
|
boolean |
imageUpdate(Image iImage,
int iInfoFlags,
int iX,
int iY,
int iW,
int iH) |
void |
setFrame(Rectangle2D iFrame)
Sets current image frame.
|
void |
setImage(Image iImage)
Sets new image.
|
void |
setMask(Area iMask)
Sets image mask.
|
void |
setZOrder(float iZOrder)
Updates Z-order property.
|
getToolTip, getZOrder, setToolTip
getDefaultOrigin, getParent, redraw, setParent
public ImageDoodle(Rectangle2D iFrame, Image iImage)
Details:
This constructor sets the frame and the image.
No mask is configured.
The frame cannot be null
, but the image may be.
iFrame
- the frameiImage
- the imagepublic Rectangle2D getFrame()
Details: This method returns the current frame.
public void setFrame(Rectangle2D iFrame)
Details:
This method sets the current frame.
This value cannot be null
.
iFrame
- the new framepublic Image getImage()
Details:
This method returns the current image displayed by this shape.
This value may be null
.
public void setImage(Image iImage)
Details:
This method sets the image to be displayed by this shape.
The new image may be null
if no image is desired.
iImage
- the new imagepublic Area getMask()
Details:
This method returns the current mask applied to the image, if any.
If no mask is set, this method returns null
.
public void setMask(Area iMask)
Details:
This method sets the image's mask.
By default, in a new ImageDoodle
no mask is set.
This method allows you to confine the displayed image to non-
iMask
- the new maskpublic boolean draw(FigGraphics iG)
Doodle
Details:
Doodle.draw(FigGraphics)
renders this doodle using the supplied graphics environment.
When the host FigureView
is repainting itself, it will probably call this method, albeit indirectly, to redraw its figure's components.
This method returns true
if drawing was successful, false
otherwise.
public void setZOrder(float iZOrder)
FlatDoodle
Details:
FlatDoodle.setZOrder(float)
updates the Z-Doodle
and instructs views to redraw.
setZOrder
in class FlatDoodle
iZOrder
- new property valuepublic boolean imageUpdate(Image iImage, int iInfoFlags, int iX, int iY, int iW, int iH)
imageUpdate
in interface ImageObserver
public boolean contains(AffineTransform iTransform, Point2D iP)
Details:
This method returns true
if the given point lies in the image area, false
otherwise.
public Rectangle2D getBounds(AffineTransform iTransform, Rectangle2D oBounds)
Details:
This method returns the rectangular bounds of the image area, according to the Shape
interface contract.
Copyright © 2013. All Rights Reserved.