public final class NinePatchHeightMap extends AbstractHeightMap
The innerSize
is the inner size of the square (from the centre, so half the actual width) without the rounded corners.
The borderSize
is the radius of the rounded corners.
The coastSize
is the distance over which the height decreases to zero outside the border.
The height
is the height of the part described by innerSize + borderSize
. From there the height sinuously decreases to zero over coastSize
pixels.
By setting the innerSize
to zero you can create a completely circular shape. The two constructors that take only two int
s are convenience constructors to do that.
To have entirely sharp, perpendicular corners, set the borderSize
to zero.
name, seed
Constructor and Description |
---|
NinePatchHeightMap(int innerRadius,
int coastSize,
double height) |
NinePatchHeightMap(int innerSize,
int borderSize,
int coastSize,
double height) |
NinePatchHeightMap(java.lang.String name,
int innerRadius,
int coastSize,
double height) |
NinePatchHeightMap(java.lang.String name,
int innerSize,
int borderSize,
int coastSize,
double height) |
Modifier and Type | Method and Description |
---|---|
int |
getBorderSize() |
int |
getCoastSize() |
double |
getHeight() |
double |
getHeight(float x,
float y)
Get the height of the height map at a particular location.
|
javax.swing.Icon |
getIcon()
Get a 16x16 icon representing this height map.
|
int |
getInnerSizeX() |
int |
getInnerSizeY() |
double[] |
getRange()
Get the range of this height map, i.e.
|
clone, getBaseHeight, getColour, getConstantValue, getExtent, getHeight, getName, getParent, getSeed, isConstant, setName, setSeed
public NinePatchHeightMap(int innerRadius, int coastSize, double height)
public NinePatchHeightMap(int innerSize, int borderSize, int coastSize, double height)
public NinePatchHeightMap(java.lang.String name, int innerRadius, int coastSize, double height)
public NinePatchHeightMap(java.lang.String name, int innerSize, int borderSize, int coastSize, double height)
public int getInnerSizeX()
public int getInnerSizeY()
public int getBorderSize()
public int getCoastSize()
public double getHeight()
public double getHeight(float x, float y)
HeightMap
getHeight
in interface HeightMap
getHeight
in class AbstractHeightMap
x
- The X coordinate of the location of which to get the height.y
- The Y coordinate of the location of which to get the height.public javax.swing.Icon getIcon()
HeightMap
public double[] getRange()
HeightMap
HeightMap.getBaseHeight()
) and the upper bound in
index 1.