public class NinePatch
extends java.lang.Object
NinePatch
for mini2DxModifier and Type | Field and Description |
---|---|
static int |
BOTTOM_CENTER |
static int |
BOTTOM_LEFT |
static int |
BOTTOM_RIGHT |
protected com.badlogic.gdx.graphics.Color |
color |
static int |
MIDDLE_CENTER |
static int |
MIDDLE_LEFT |
static int |
MIDDLE_RIGHT |
protected TextureRegion[] |
patches |
static int |
TOP_CENTER |
static int |
TOP_LEFT |
static int |
TOP_RIGHT |
Constructor and Description |
---|
NinePatch(NinePatch ninePatch) |
NinePatch(NinePatch ninePatch,
com.badlogic.gdx.graphics.Color color) |
NinePatch(com.badlogic.gdx.graphics.Texture texture,
int left,
int right,
int top,
int bottom)
Create a
NinePatch by cutting up the given texture into nine
patches. |
NinePatch(TextureRegion region,
int left,
int right,
int top,
int bottom)
Create a
NinePatch by cutting up the given texture region into
nine patches. |
Modifier and Type | Method and Description |
---|---|
float |
getBottomHeight() |
com.badlogic.gdx.graphics.Color |
getColor() |
float |
getLeftWidth() |
float |
getMiddleHeight() |
float |
getMiddleWidth() |
float |
getPaddingBottom()
Returns the bottom padding if set, else returns
getBottomHeight() . |
float |
getPaddingLeft()
Returns the left padding if set, else returns
getLeftWidth() . |
float |
getPaddingRight()
Returns the right padding if set, else returns
getRightWidth() . |
float |
getPaddingTop()
Returns the top padding if set, else returns
getTopHeight() . |
float |
getRightWidth() |
com.badlogic.gdx.graphics.Texture |
getTexture() |
float |
getTopHeight() |
float |
getTotalHeight() |
float |
getTotalWidth() |
void |
render(Graphics g,
float x,
float y,
float width,
float height) |
void |
scale(float scaleX,
float scaleY)
Multiplies the top/left/bottom/right sizes and padding by the specified
amount.
|
void |
setBottomHeight(float bottomHeight)
Set the draw-time height of the three bottom edge patches
|
void |
setColor(com.badlogic.gdx.graphics.Color color)
Copy given color.
|
void |
setLeftWidth(float leftWidth)
Set the draw-time width of the three left edge patches
|
void |
setMiddleHeight(float middleHeight)
Set the height of the middle row of the patch.
|
void |
setMiddleWidth(float middleWidth)
Set the width of the middle column of the patch.
|
void |
setPadding(float left,
float right,
float top,
float bottom)
Set the padding for content inside this ninepatch.
|
void |
setPaddingBottom(float bottom)
|
void |
setPaddingLeft(float left)
|
void |
setPaddingRight(float right)
|
void |
setPaddingTop(float top)
|
void |
setRightWidth(float rightWidth)
Set the draw-time width of the three right edge patches
|
void |
setTopHeight(float topHeight)
Set the draw-time height of the three top edge patches
|
public static final int TOP_LEFT
public static final int TOP_CENTER
public static final int TOP_RIGHT
public static final int MIDDLE_LEFT
public static final int MIDDLE_CENTER
public static final int MIDDLE_RIGHT
public static final int BOTTOM_LEFT
public static final int BOTTOM_CENTER
public static final int BOTTOM_RIGHT
protected TextureRegion[] patches
protected final com.badlogic.gdx.graphics.Color color
public NinePatch(com.badlogic.gdx.graphics.Texture texture, int left, int right, int top, int bottom)
NinePatch
by cutting up the given texture into nine
patches. The subsequent parameters define the 4 lines that will cut the
texture region into 9 pieces.left
- Pixels from left edge.right
- Pixels from right edge.top
- Pixels from top edge.bottom
- Pixels from bottom edge.public NinePatch(TextureRegion region, int left, int right, int top, int bottom)
NinePatch
by cutting up the given texture region into
nine patches. The subsequent parameters define the 4 lines that will cut
the texture region into 9 pieces.left
- Pixels from left edge.right
- Pixels from right edge.top
- Pixels from top edge.bottom
- Pixels from bottom edge.public NinePatch(NinePatch ninePatch)
public NinePatch(NinePatch ninePatch, com.badlogic.gdx.graphics.Color color)
public void render(Graphics g, float x, float y, float width, float height)
public void setColor(com.badlogic.gdx.graphics.Color color)
draw
time.
Default is Color.WHITE
.public com.badlogic.gdx.graphics.Color getColor()
public float getLeftWidth()
public void setLeftWidth(float leftWidth)
public float getRightWidth()
public void setRightWidth(float rightWidth)
public float getTopHeight()
public void setTopHeight(float topHeight)
public float getBottomHeight()
public void setBottomHeight(float bottomHeight)
public float getMiddleWidth()
public void setMiddleWidth(float middleWidth)
default total width
.public float getMiddleHeight()
public void setMiddleHeight(float middleHeight)
default total height
.public float getTotalWidth()
public float getTotalHeight()
public void setPadding(float left, float right, float top, float bottom)
public float getPaddingLeft()
getLeftWidth()
.public void setPaddingLeft(float left)
public float getPaddingRight()
getRightWidth()
.public void setPaddingRight(float right)
public float getPaddingTop()
getTopHeight()
.public void setPaddingTop(float top)
public float getPaddingBottom()
getBottomHeight()
.public void setPaddingBottom(float bottom)
public void scale(float scaleX, float scaleY)
public com.badlogic.gdx.graphics.Texture getTexture()