|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.rit.slides.items.SlideItem
edu.rit.slides.items.ImageItem
public class ImageItem
Class ImageItem provides a SlideItem
containing an image. The image is read from an input stream when the image
item is constructed. Image formats supported by the javax.imageio package are
supported; this typically includes GIF, JPEG, and PNG images.
Class ImageItem keeps track of the "last image item." The static ImageItem.last() method returns a reference to the last created image item.
When an ImageItem is created, the "last point" (returned by the Point.last() method) is set to the point where the image item was located.
Constructor Summary | |
---|---|
ImageItem()
Construct a new empty image item. |
|
ImageItem(InputStream in,
Point theLocation)
Construct a new image item with the image read from the given input stream. |
|
ImageItem(InputStream in,
Point theLocation,
double scale)
Construct a new image item with the image read from the given input stream. |
Method Summary | |
---|---|
Point |
c()
Returns the center point of this image item. |
void |
draw(Graphics2D g2d)
Draw this image item in the given graphics context. |
Point |
e()
Returns the east middle point of this image item. |
static ImageItem |
last()
Returns the last image item created. |
Point |
location()
Returns this image item's upper left corner location. |
Point |
n()
Returns the north middle point of this image item. |
Point |
ne()
Returns the northeast corner point of this image item. |
Point |
nw()
Returns the northwest corner point of this image item. |
void |
readExternal(ObjectInput in)
Read this image item from the given object input stream. |
Point |
s()
Returns the south middle point of this image item. |
Point |
se()
Returns the southeast corner point of this image item. |
Size |
size()
Returns this image item's size. |
Point |
sw()
Returns the southwest corner point of this image item. |
Point |
w()
Returns the west middle point of this image item. |
void |
writeExternal(ObjectOutput out)
Write this image item to the given object output stream. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ImageItem()
public ImageItem(InputStream in, Point theLocation) throws IOException
in
- Input stream from which to read the image.theLocation
- Upper left corner location.
NullPointerException
- (unchecked exception) Thrown if in is null or
theLocation is null.
IOException
- Thrown if an I/O error occurred.public ImageItem(InputStream in, Point theLocation, double scale) throws IOException
in
- Input stream from which to read the image.theLocation
- Upper left corner location.scale
- Scale factor > 0.
NullPointerException
- (unchecked exception) Thrown if in is null or
theLocation is null.
IllegalArgumentException
- (unchecked exception) Thrown if scale <= 0.
IOException
- Thrown if an I/O error occurred.Method Detail |
---|
public static ImageItem last()
public Point location()
public Size size()
public Point nw()
public Point n()
public Point ne()
public Point w()
public Point c()
public Point e()
public Point sw()
public Point s()
public Point se()
public void draw(Graphics2D g2d)
draw
in class SlideItem
g2d
- 2-D graphics context.public void writeExternal(ObjectOutput out) throws IOException
writeExternal
in interface Externalizable
out
- Object output stream.
IOException
- Thrown if an I/O error occurred.public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
readExternal
in interface Externalizable
in
- Object input stream.
IOException
- Thrown if an I/O error occurred.
ClassNotFoundException
- Thrown if any class needed to deserialize this image item cannot be
found.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |