public final class BackgroundImage extends Object implements BackgroundPaint, Cloneable
Int
values are in screen pixels, that is,
the display scaling is already taken into account.
Modifier and Type | Class and Description |
---|---|
static class |
BackgroundImage.Repeat
Specifies how the image is to be repeated.
|
Modifier and Type | Field and Description |
---|---|
Image |
image
Corresponds to CSS property background-image.
|
String |
imageSpec
Used to identify the background image.
|
BackgroundImage.Repeat |
repeat
Specifies how the image is to be repeated.
|
boolean |
xPercent
If
true , xPos is a percentage
and not a length in pixels. |
int |
xPos
The horizontal position of the image in pixels or in percent.
|
boolean |
yPercent
If
true , yPos is a percentage
and not a length in pixels. |
int |
yPos
The vertical position of the image in pixels or in percent.
|
Constructor and Description |
---|
BackgroundImage(Image image,
String imageSpec,
int xPos,
boolean xPercent,
int yPos,
boolean yPercent,
BackgroundImage.Repeat repeat) |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object other) |
Paint |
getPaint(int width,
int height)
Returns the color pattern used to paint the background of a box.
|
int |
hashCode() |
void |
paint(Graphics g,
int width,
int height,
int clipX,
int clipY,
int clipW,
int clipH)
Paint the background of a box.
|
String |
toString() |
public final Image image
null
.public final String imageSpec
null
if unknown.public final int xPos
xPercent
public final boolean xPercent
true
, xPos
is a percentage
and not a length in pixels.public final int yPos
public final boolean yPercent
true
, yPos
is a percentage
and not a length in pixels.yPercent
public BackgroundImage.Repeat repeat
public BackgroundImage(Image image, String imageSpec, int xPos, boolean xPercent, int yPos, boolean yPercent, BackgroundImage.Repeat repeat)
public Paint getPaint(int width, int height)
BackgroundPaint
getPaint
in interface BackgroundPaint
width
- the width of the boxheight
- the height of the boxnull
if this color pattern
cannot be created.public void paint(Graphics g, int width, int height, int clipX, int clipY, int clipW, int clipH)
g
- the graphics used to paintwidth
- the width of the boxheight
- the height of the boxclipX
- the X coordinate of the origin of the clip rectangle
set in gclipY
- the Y coordinate of the origin of the clip rectangle
set in gclipW
- the width of the clip rectangle set in gclipH
- the height of the clip rectangle set in g