public class Picture
extends java.lang.Object
| Constructor and Description |
|---|
Picture()
Constructs a blank picture.
|
| Modifier and Type | Method and Description |
|---|---|
void |
border(int width)
Adds a black border to the image.
|
java.awt.Color |
getColorAt(int x,
int y)
Gets the color of a pixel.
|
int |
getHeight()
Gets the height of this picture.
|
int |
getWidth()
Gets the width of this picture.
|
void |
load(java.lang.String source)
Loads a picture from a given source.
|
void |
move(int dx,
int dy)
Moves this picture by the given amount in x- and y-direction.
|
void |
pick()
Displays a file chooser for picking a picture.
|
void |
reload()
Reloads this picture, undoing any manipulations.
|
void |
scale(int newWidth,
int newHeight)
Scales this picture to a new size.
|
void |
setColorAt(int x,
int y,
java.awt.Color c)
Sets the color of a pixel.
|
public int getWidth()
public int getHeight()
public void load(java.lang.String source)
source - the image source. If the source starts
with http://, it is a URL, otherwise, a filename.public void reload()
public void pick()
public void move(int dx,
int dy)
dx - the offset in the x-directiondy - the offset in the y-directionpublic void scale(int newWidth,
int newHeight)
newWidth - the new width of the picturenewHeight - the new height of the picturepublic void border(int width)
width - the border widthpublic java.awt.Color getColorAt(int x,
int y)
x - the column index (between 0 and getWidth() - 1)y - the row index (between 0 and getHeight() - 1)public void setColorAt(int x,
int y,
java.awt.Color c)
x - the column index (between 0 and getWidth() - 1)y - the row index (between 0 and getHeight() - 1)c - the color for the pixel at position (x, y)