Note this class does not accept ".9.png" textures that include the metadata border pixels describing the splits (and padding)
for the ninepatch. That information is either passed to a constructor or defined implicitly by the size of the individual patch
textures. TextureAtlas is one way to generate a postprocessed ninepatch texture regions from ".9.png" files.
| Modifier and Type | Field and Description |
|---|---|
| public static final int | BOTTOM_CENTER
Indices for the |
| public static final int | |
| public static final int | |
| private int | |
| private float | |
| private int | |
| private int | |
| private final Color | |
| private int | |
| private float | |
| public static final int | |
| public static final int | |
| public static final int | |
| private int | |
| private float | |
| private int | |
| private int | |
| private float | |
| private float | |
| private float | |
| private float | |
| private float | |
| private float | |
| private Texture | |
| private static final Color | |
| public static final int | |
| public static final int | |
| public static final int | |
| private int | |
| private float | |
| private int | |
| private int | |
| private float[] |
| Access | Constructor and Description |
|---|---|
| public | |
| public | NinePatch(TextureRegion region, int
Pixels from left edge. left, int Pixels from right edge. right, int Pixels from top edge. top, int Pixels from bottom edge. bottom)Create a ninepatch by cutting up the given texture region into nine patches. |
| public | |
| public | |
| public | NinePatch(TextureRegion region, Color color)
Construct a degenerate "nine" patch with only a center component. |
| public | |
| public | |
| public | |
| public |
| Modifier and Type | Method and Description |
|---|---|
| private int | |
| public void | |
| public void | |
| public float | |
| public Color | |
| public float | |
| public float | |
| public float | |
| public float | |
| public float | |
| public float | |
| public float | |
| public float | |
| public Texture | |
| public float | |
| public float | |
| public float | |
| private void | |
| private void | |
| public void | scale(float scaleX, float scaleY)
Multiplies the top/left/bottom/right sizes and padding by the specified amount. |
| private void | set(int idx, float x, float y, float width, float height, float color)
Set the coordinates and color of a ninth of the patch. |
| public void | |
| public void | |
| public void | |
| public void | |
| public void | |
| public void | |
| public void | setPadding(float left, float right, float top, float bottom)
Set the padding for content inside this ninepatch. |
| public void | |
| public void | |
| public void | |
| public void | |
| public void |
| BOTTOM_CENTER | back to summary |
|---|---|
| public static final int BOTTOM_CENTER Indices for the | |
| BOTTOM_LEFT | back to summary |
|---|---|
| public static final int BOTTOM_LEFT | |
| BOTTOM_RIGHT | back to summary |
|---|---|
| public static final int BOTTOM_RIGHT | |
| bottomCenter | back to summary |
|---|---|
| private int bottomCenter | |
| bottomHeight | back to summary |
|---|---|
| private float bottomHeight | |
| bottomLeft | back to summary |
|---|---|
| private int bottomLeft | |
| bottomRight | back to summary |
|---|---|
| private int bottomRight | |
| color | back to summary |
|---|---|
| private final Color color | |
| idx | back to summary |
|---|---|
| private int idx | |
| leftWidth | back to summary |
|---|---|
| private float leftWidth | |
| MIDDLE_CENTER | back to summary |
|---|---|
| public static final int MIDDLE_CENTER | |
| MIDDLE_LEFT | back to summary |
|---|---|
| public static final int MIDDLE_LEFT | |
| MIDDLE_RIGHT | back to summary |
|---|---|
| public static final int MIDDLE_RIGHT | |
| middleCenter | back to summary |
|---|---|
| private int middleCenter | |
| middleHeight | back to summary |
|---|---|
| private float middleHeight | |
| middleLeft | back to summary |
|---|---|
| private int middleLeft | |
| middleRight | back to summary |
|---|---|
| private int middleRight | |
| middleWidth | back to summary |
|---|---|
| private float middleWidth | |
| padBottom | back to summary |
|---|---|
| private float padBottom | |
| padLeft | back to summary |
|---|---|
| private float padLeft | |
| padRight | back to summary |
|---|---|
| private float padRight | |
| padTop | back to summary |
|---|---|
| private float padTop | |
| rightWidth | back to summary |
|---|---|
| private float rightWidth | |
| texture | back to summary |
|---|---|
| private Texture texture | |
| tmpDrawColor | back to summary |
|---|---|
| private static final Color tmpDrawColor | |
| TOP_CENTER | back to summary |
|---|---|
| public static final int TOP_CENTER | |
| TOP_LEFT | back to summary |
|---|---|
| public static final int TOP_LEFT | |
| TOP_RIGHT | back to summary |
|---|---|
| public static final int TOP_RIGHT | |
| topCenter | back to summary |
|---|---|
| private int topCenter | |
| topHeight | back to summary |
|---|---|
| private float topHeight | |
| topLeft | back to summary |
|---|---|
| private int topLeft | |
| topRight | back to summary |
|---|---|
| private int topRight | |
| vertices | back to summary |
|---|---|
| private float[] vertices | |
| NinePatch | back to summary |
|---|---|
| public NinePatch(Texture texture, int left, int right, int top, int bottom) Create a 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.
| |
| NinePatch | back to summary |
|---|---|
| public NinePatch(TextureRegion region, int left, int right, int top, int bottom) Create a 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.
| |
| NinePatch | back to summary |
|---|---|
| public NinePatch(Texture texture, Color color) Construct a degenerate "nine" patch with only a center component. | |
| NinePatch | back to summary |
|---|---|
| public NinePatch(Texture texture) Construct a degenerate "nine" patch with only a center component. | |
| NinePatch | back to summary |
|---|---|
| public NinePatch(TextureRegion region, Color color) Construct a degenerate "nine" patch with only a center component. | |
| NinePatch | back to summary |
|---|---|
| public NinePatch(TextureRegion region) Construct a degenerate "nine" patch with only a center component. | |
| NinePatch | back to summary |
|---|---|
| public NinePatch(TextureRegion... patches) Construct a nine patch from the given nine texture regions. The provided patches must be consistently sized (e.g., any left
edge textures must have the same width, etc). Patches may be | |
| NinePatch | back to summary |
|---|---|
| public NinePatch(NinePatch ninePatch) | |
| NinePatch | back to summary |
|---|---|
| public NinePatch(NinePatch ninePatch, Color color) | |
| add | back to summary |
|---|---|
| private int add(TextureRegion region, boolean isStretchW, boolean isStretchH) | |
| draw | back to summary |
|---|---|
| public void draw(Batch batch, float x, float y, float width, float height) | |
| draw | back to summary |
|---|---|
| public void draw(Batch batch, float x, float y, float originX, float originY, float width, float height, float scaleX, float scaleY, float rotation) | |
| getBottomHeight | back to summary |
|---|---|
| public float getBottomHeight() | |
| getColor | back to summary |
|---|---|
| public Color getColor() | |
| getLeftWidth | back to summary |
|---|---|
| public float getLeftWidth() | |
| getMiddleHeight | back to summary |
|---|---|
| public float getMiddleHeight() | |
| getMiddleWidth | back to summary |
|---|---|
| public float getMiddleWidth() | |
| getPadBottom | back to summary |
|---|---|
| public float getPadBottom() Returns the bottom padding if set, else returns | |
| getPadLeft | back to summary |
|---|---|
| public float getPadLeft() Returns the left padding if set, else returns | |
| getPadRight | back to summary |
|---|---|
| public float getPadRight() Returns the right padding if set, else returns | |
| getPadTop | back to summary |
|---|---|
| public float getPadTop() Returns the top padding if set, else returns | |
| getRightWidth | back to summary |
|---|---|
| public float getRightWidth() | |
| getTexture | back to summary |
|---|---|
| public Texture getTexture() | |
| getTopHeight | back to summary |
|---|---|
| public float getTopHeight() | |
| getTotalHeight | back to summary |
|---|---|
| public float getTotalHeight() | |
| getTotalWidth | back to summary |
|---|---|
| public float getTotalWidth() | |
| load | back to summary |
|---|---|
| private void load(TextureRegion[] patches) | |
| prepareVertices | back to summary |
|---|---|
| private void prepareVertices(Batch batch, float x, float y, float width, float height) | |
| scale | back to summary |
|---|---|
| public void scale(float scaleX, float scaleY) Multiplies the top/left/bottom/right sizes and padding by the specified amount. | |
| set | back to summary |
|---|---|
| private void set(int idx, float x, float y, float width, float height, float color) Set the coordinates and color of a ninth of the patch. | |
| setBottomHeight | back to summary |
|---|---|
| public void setBottomHeight(float bottomHeight) Set the draw-time height of the three bottom edge patches | |
| setColor | back to summary |
|---|---|
| public void setColor(Color color) Copy given color. The color will be blended with the batch color, then combined with the texture colors at
| |
| setLeftWidth | back to summary |
|---|---|
| public void setLeftWidth(float leftWidth) Set the draw-time width of the three left edge patches | |
| setMiddleHeight | back to summary |
|---|---|
| public void setMiddleHeight(float middleHeight) Set the height of the middle row of the patch. At render time, this is implicitly the requested render-height of the entire
nine patch, minus the top and bottom height. This value is only used for computing the | |
| setMiddleWidth | back to summary |
|---|---|
| public void setMiddleWidth(float middleWidth) Set the width of the middle column of the patch. At render time, this is implicitly the requested render-width of the
entire nine patch, minus the left and right width. This value is only used for computing the | |
| setPadBottom | back to summary |
|---|---|
| public void setPadBottom(float bottom) | |
| setPadding | back to summary |
|---|---|
| public void setPadding(float left, float right, float top, float bottom) Set the padding for content inside this ninepatch. By default the padding is set to match the exterior of the ninepatch, so the content should fit exactly within the middle patch. | |
| setPadLeft | back to summary |
|---|---|
| public void setPadLeft(float left) | |
| setPadRight | back to summary |
|---|---|
| public void setPadRight(float right) | |
| setPadTop | back to summary |
|---|---|
| public void setPadTop(float top) | |
| setRightWidth | back to summary |
|---|---|
| public void setRightWidth(float rightWidth) Set the draw-time width of the three right edge patches | |
| setTopHeight | back to summary |
|---|---|
| public void setTopHeight(float topHeight) Set the draw-time height of the three top edge patches | |