public class CanvasImage
extends java.lang.Object
MMG2DCanvas()
.
The attribute isStatic
declares that the image uses whether
screen or world coordinates (i.e. counting from the top left corner of the
canvas or going from canvas origin to positive infinity). Translating or
scaling the canvas's view has therefore no effect on static images. Only
non-static images are "embedded" in the world.
The attribute isRepeating
declares that the image will
whether be repeated (at original size) over the defined width and height, or
not.
The attributes can be combined.Constructor and Description |
---|
CanvasImage() |
CanvasImage(java.awt.image.BufferedImage img) |
CanvasImage(java.awt.image.BufferedImage img,
double x,
double y,
double width,
double height,
boolean isStatic,
boolean isRepeating) |
CanvasImage(java.lang.String location)
Constructs a new CanvasImage that will be drawn at (0,0) in canvas
coordinates.
|
CanvasImage(java.lang.String location,
double x,
double y)
Constructs a new CanvasImage that will be drawn at (x,y) in canvas
coordinates.
|
CanvasImage(java.lang.String location,
double x,
double y,
double width,
double height)
Constructs a new CanvasImage that will be drawn at (x,y) in canvas
coordinates.
|
CanvasImage(java.lang.String location,
double x,
double y,
double width,
double height,
boolean isStatic,
boolean isRepeating)
Constructs a new CanvasImage that will be drawn at (x,y) in
canvas-coordinates.
|
Modifier and Type | Method and Description |
---|---|
void |
drawImage()
Draws the image onto the canvas.
|
double[] |
getCoordinates()
Returns wheather the absolute or relative coordinates of the picture.
|
double |
getDimensionRatio()
Returns the ratio between width and height.
|
java.awt.image.BufferedImage |
getImage()
Returns the real image.
|
java.lang.String |
getImageFileLocation()
Returns the file location from where the image is loaded.
|
java.awt.Color |
getPixelColor(int x,
int y)
Returns the color of the pixel with the specified (image) coordinates.
|
double[] |
getSize() |
boolean |
isRepeating() |
boolean |
isStatic() |
void |
setCanvas(MMG2DCanvas canvas)
Sets the canvas in which this CanvasImage will be drawn.
|
void |
setCoordinates(double x,
double y)
Sets the absolute or relative coordinates of the image's left bottom corner.
|
void |
setImage(java.awt.image.BufferedImage bi)
Sets the real image.
|
void |
setImage(java.lang.String loc)
Loads and sets the image.
|
void |
setPixelColor(java.awt.Color c,
int x,
int y)
Sets the color of the pixel with the specified (image) coordinates.
|
void |
setSize(double width,
double height)
Sets the size of this image.
|
public CanvasImage(java.lang.String location)
location
.public CanvasImage(java.lang.String location, double x, double y)
location
.public CanvasImage(java.lang.String location, double x, double y, double width, double height)
location
.public CanvasImage(java.lang.String location, double x, double y, double width, double height, boolean isStatic, boolean isRepeating)
location
.public CanvasImage()
public CanvasImage(java.awt.image.BufferedImage img)
public CanvasImage(java.awt.image.BufferedImage img, double x, double y, double width, double height, boolean isStatic, boolean isRepeating)
public void setImage(java.lang.String loc)
public void setImage(java.awt.image.BufferedImage bi)
public java.awt.image.BufferedImage getImage()
public java.lang.String getImageFileLocation()
public double[] getCoordinates()
public void setCoordinates(double x, double y)
public void setSize(double width, double height)
public double[] getSize()
public boolean isStatic()
public boolean isRepeating()
public void drawImage()
public void setPixelColor(java.awt.Color c, int x, int y)
public java.awt.Color getPixelColor(int x, int y)
public double getDimensionRatio()
public void setCanvas(MMG2DCanvas canvas)
Further documentation and examples can be found under www.mathletfactory.de.