|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Class Picture
java.lang.ObjectPicture
public class Picture
- extends Object
This class allows you to view and edit pictures.
Constructor Summary | |
---|---|
Picture()
Constructs a blank picture. |
Method Summary | |
---|---|
void |
border(int width)
Adds a black border to the image. |
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(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,
Color c)
Sets the color of a pixel. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
Picture
public Picture()
- Constructs a blank picture.
Method Detail |
---|
getWidth
public int getWidth()
- Gets the width of this picture.
- Returns:
- the width
getHeight
public int getHeight()
- Gets the height of this picture.
- Returns:
- the height
load
public void load(String source)
- Loads a picture from a given source.
- Parameters:
source
- the image source. If the source starts with http://, it is a URL, otherwise, a filename.
reload
public void reload()
- Reloads this picture, undoing any manipulations.
pick
public void pick()
- Displays a file chooser for picking a picture.
move
public void move(int dx, int dy)
- Moves this picture by the given amount in x- and y-direction.
- Parameters:
dx
- the offset in the x-directiondy
- the offset in the y-direction
scale
public void scale(int newWidth, int newHeight)
- Scales this picture to a new size. If the new size is smaller
than the old size, the remainder is filled with transparent
pixels. If it is larger, it is clipped.
- Parameters:
newWidth
- the new width of the picturenewHeight
- the new height of the picture
border
public void border(int width)
- Adds a black border to the image.
- Parameters:
width
- the border width
getColorAt
public Color getColorAt(int x, int y)
- Gets the color of a pixel.
- Parameters:
x
- the column index (between 0 and getWidth() - 1)y
- the row index (between 0 and getHeight() - 1)- Returns:
- the color of the pixel at position (x, y)
setColorAt
public void setColorAt(int x, int y, Color c)
- Sets the color of a pixel.
- Parameters:
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)
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |