|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object Picture
public class Picture
The Picture class stores a two-dimensional image. This Picture is
comprised of pixels (see Pixel
) and is displayed on-screen
through the use of a PictureFrame
.
Constructor Summary | |
---|---|
Picture(int width,
int height)
Create a Picture with the specified width and height. |
|
Picture(Picture source)
Create a Picture by copying the contents of another (non-null) Picture. |
|
Picture(String filename)
Create a Picture from a file. |
Method Summary | |
---|---|
BufferedImage |
getBufferedImage()
Returns the BufferedImage underlying the Picture. |
int |
getHeight()
Return the height of the Picture. |
Pixel |
getPixel(int x,
int y)
Return the Pixel stored at this location. |
int |
getWidth()
Return the width of the Picture. |
Pixel |
setPixel(int x,
int y,
Pixel pixel)
Set the location (x, y) to a new Pixel value. |
void |
updateImage()
Flush changes to the underlying image. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Picture(int width, int height)
width
- the width (> 0) of the picture.height
- the height (> 0) of the picture.public Picture(String filename)
filename
- the name of the image file.public Picture(Picture source)
source
- the Picture to copy.Method Detail |
---|
public int getWidth()
public int getHeight()
public BufferedImage getBufferedImage()
public void updateImage()
PictureFrame.refresh(Picture)
).
public Pixel getPixel(int x, int y)
x
- the x-coordinate of the Pixel to get.y
- the y-coordinate of the Pixel to get.public Pixel setPixel(int x, int y, Pixel pixel)
x
- the x-coordinate of the Pixel to set.y
- the y-coordinate of the Pixel to set.pixel
- the Pixel value to put at this coordinate.
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |