public class NinePatchImage extends Object implements Image
Color.BLACK
) at the left or top border indicate the stretch regions. Relative size
of multiple regions will be kept.Constructor and Description |
---|
NinePatchImage(BufferedImage src)
Crates a new stretchable image from a nine patch image.
|
Modifier and Type | Method and Description |
---|---|
void |
draw(Graphics2D g,
int width,
int height)
Draws the image on a given
Graphics2D object |
BufferedImage |
getImage(int width,
int height) |
Insets |
getInsets()
Get the
Insets specified by the underlying nine patch source image. |
Size |
getNaturalSize()
Get the natural minimum size of this image.
|
int |
getQuality()
Get the used interpolation quality.
|
Size |
getSize()
Get the original size of the image
|
Size |
getSourceSize()
Get the source size of this image.
|
boolean |
isHorizontalStretachable()
Get the capability to stretch this image in horizontal direction.
|
boolean |
isVerticalStretachable()
Get the capability to stretch this image in vertical direction.
|
void |
setQuality(int quality)
Set the interpolation quality values from 0 to 2 are allowed.
|
public NinePatchImage(BufferedImage src)
src
- The shared source imageBufferedImage.getSubimage(int, int, int, int)
public void draw(Graphics2D g, int width, int height)
Image
Graphics2D
objectpublic BufferedImage getImage(int width, int height)
public boolean isHorizontalStretachable()
public boolean isVerticalStretachable()
public Size getNaturalSize()
public Insets getInsets()
Insets
specified by the underlying nine patch source image.Insets
specified by the nine patch source imagepublic Size getSourceSize()
src.getWidth() - 2, src.getHeight() - 2
public Size getSize()
Image
getSize
in interface Image
getSourceSize()
,
Image.getSize()
public int getQuality()
public void setQuality(int quality)
quality
- Interpolation qualityCopyright © 2017. All rights reserved.