public class BackgroundImage extends Object
| Modifier and Type | Field and Description |
|---|---|
int |
anchor
This is only used if the type is DISPLAY_TYPE_SINGLE.
|
static int |
DISPLAY_TYPE_CACHED_SCALED
An exclusive value for displayType - this one keeps a copy of the scaled image.
|
static int |
DISPLAY_TYPE_SCALED
An exclusive value for displayType.
|
static int |
DISPLAY_TYPE_SINGLE
An exclusive value for displayType.
|
static int |
DISPLAY_TYPE_TILED
An exclusive value for displayType.
|
int |
displayType
This should be one of the DISPLAY_TYPE_XXX values.
|
ImageData |
imageToDraw |
ImageData |
originalImage |
int |
scaleOptions
This is only used if the type is DISPLAY_TYPE_SCALED.
|
| Constructor and Description |
|---|
BackgroundImage(ImageData im,
int displayType,
int anchorOrScaleOptions)
Create a BackgroundImage.
|
| Modifier and Type | Method and Description |
|---|---|
void |
display(Graphics g,
int x,
int y,
int width,
int height)
Display the BackgroundImage in the Graphics within the specified location.
|
void |
scaleImageTo(int width,
int height,
Color scaleOnTopOf)
When using DISPLAY_TYPE_CACHED_SCALE this pre-scales the image.
|
void |
scaleImageTo(int width,
int height,
Image scaleOnTopOf)
When using DISPLAY_TYPE_CACHED_SCALE this pre-scales the image.
|
public static final int DISPLAY_TYPE_SCALED
public static final int DISPLAY_TYPE_CACHED_SCALED
public static final int DISPLAY_TYPE_TILED
public static final int DISPLAY_TYPE_SINGLE
public ImageData originalImage
public ImageData imageToDraw
public int displayType
public int anchor
public int scaleOptions
public BackgroundImage(ImageData im, int displayType, int anchorOrScaleOptions)
im - the Image to display.displayType - one of the DISPLAY_TYPE_XXX values.anchorOrScaleOptions - the anchor for DISPLAY_TYPE_SINGLE
or the scale options for DISPLAY_TYPE_SCALED.public void scaleImageTo(int width,
int height,
Color scaleOnTopOf)
width - the new width.height - the new height.scaleOnTopOf - an optional Color to scale on top of.public void scaleImageTo(int width,
int height,
Image scaleOnTopOf)
width - the new width.height - the new height.scaleOnTopOf - an optional Image to scale on top of (which should
have the dimensions the same as width and height). You can free() that
image as a picture of the final image is used.public void display(Graphics g, int x, int y, int width, int height)
g - x - y - width - height -