Constructor Summary |
GImage(Image image)
Creates a new GImage object at the origin that displays
the specified image. |
GImage(Image image,
double x,
double y)
Creates a new GImage object at the specified coordinates. |
GImage(int[][] array)
Creates a new GImage object at the origin. |
GImage(int[][] array,
double x,
double y)
Creates a new GImage object at the specified coordinates. |
GImage(String name)
Creates a new GImage object by looking for an image with that
name. |
GImage(String name,
double x,
double y)
Creates a new GImage object at the specified coordinates. |
Method Summary |
int |
createRGBPixel(int red,
int green,
int blue)
Creates an opaque pixel value with the color components given by
red , green , and blue . |
int |
createRGBPixel(int red,
int green,
int blue,
int alpha)
Creates a pixel value with the color components given by
red , green , and blue
and the transparency value alpha . |
int |
getAlpha(int pixel)
Returns the alpha component from an RGB value. |
int |
getBlue(int pixel)
Returns the blue component from an RGB value. |
GRectangle |
getBounds()
Returns the bounding box of this object. |
int |
getGreen(int pixel)
Returns the green component from an RGB value. |
Image |
getImage()
Returns the image stored inside this GImage . |
int[][] |
getPixelArray()
Returns a two-dimensional array of pixel values from the stored image. |
int |
getRed(int pixel)
Returns the red component from an RGB value. |
GDimension |
getSize()
Returns the size of this object as a GDimension . |
void |
saveImage(File file)
Saves the image to the specified file. |
void |
saveImage(String filename)
Saves the image to a file with the specified filename. |
void |
scale(double sf)
Scales the object on the screen by the scale factor sf , which applies
in both dimensions. |
void |
scale(double sx,
double sy)
Scales the object on the screen by the scale factors sx and sy . |
void |
setBounds(double x,
double y,
double width,
double height)
Changes the bounds of this object to the specified values. |
void |
setBounds(GRectangle bounds)
Changes the bounds of this object to the values from the specified
GRectangle . |
void |
setImage(Image image)
Resets the image used by this GImage object to the new image
specified as an argument. |
void |
setImage(String name)
Resets the image used by this GImage object to the one identified
by the argument name , which is processed exactly as described
in the constructors. |
void |
setSize(double width,
double height)
Changes the size of this object to the specified width and height. |
Inherited Method Summary |
void | addMouseListener(MouseListener listener)
Adds a mouse listener to this graphical object.
|
void | addMouseMotionListener(MouseMotionListener listener)
Adds a mouse motion listener to this graphical object.
|
boolean | contains(GPoint pt)
Checks to see whether a point is inside the object.
|
boolean | contains(double x, double y)
Checks to see whether a point is inside the object.
|
double | getHeight()
Returns the height of this object as a double-precision value, which
is defined to be the height of the bounding box.
|
GPoint | getLocation()
Returns the location of this object as a GPoint .
|
double | getWidth()
Returns the width of this object as a double-precision value, which
is defined to be the width of the bounding box.
|
double | getX()
Returns the x-coordinate of the object.
|
double | getY()
Returns the y-coordinate of the object.
|
boolean | isVisible()
Checks to see whether this object is visible.
|
void | move(double dx, double dy)
Moves the object on the screen using the displacements dx and dy .
|
void | movePolar(double r, double theta)
Moves the object using displacements given in polar coordinates.
|
void | removeMouseListener(MouseListener listener)
Removes a mouse listener from this graphical object.
|
void | removeMouseMotionListener(MouseMotionListener listener)
Removes a mouse motion listener from this graphical object.
|
void | sendBackward()
Moves this object one step toward the back in the z dimension.
|
void | sendForward()
Moves this object one step toward the front in the z dimension.
|
void | sendToBack()
Moves this object to the back of the display in the z dimension.
|
void | sendToFront()
Moves this object to the front of the display in the z dimension.
|
void | setLocation(GPoint pt)
Sets the location of this object to the specified point.
|
void | setLocation(double x, double y)
Sets the location of this object to the point (x , y ).
|
void | setVisible(boolean visible)
Sets whether this object is visible.
|