Compare commits
1 Commits
f474c4c8bf
...
c79b93a4f9
Author | SHA1 | Date |
---|---|---|
Shadowfacts | c79b93a4f9 |
|
@ -1,7 +1,17 @@
|
||||||
package net.shadowfacts.cacao.util
|
package net.shadowfacts.cacao.util
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Helper class that represents a texture that can be divided into nine pieces (4 corners, 4 edges, and the center)
|
||||||
|
* and can be drawn at any size by combining and repeating those pieces.
|
||||||
|
*
|
||||||
|
* It also provides convenience [Texture] objects that represent the different patches.
|
||||||
|
*
|
||||||
* @author shadowfacts
|
* @author shadowfacts
|
||||||
|
* @param texture The base [Texture] object.
|
||||||
|
* @param cornerWidth The width of each corner (and therefore the width of the vertical edges).
|
||||||
|
* @param cornerHeight The height of each corner (and therefore the height of the horizontal edges.)
|
||||||
|
* @param centerWidth The width of the center patch.
|
||||||
|
* @param centerHeight The height of the center patch.
|
||||||
*/
|
*/
|
||||||
data class NinePatchTexture(val texture: Texture, val cornerWidth: Int, val cornerHeight: Int, val centerWidth: Int, val centerHeight: Int) {
|
data class NinePatchTexture(val texture: Texture, val cornerWidth: Int, val cornerHeight: Int, val centerWidth: Int, val centerHeight: Int) {
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,11 @@ import net.shadowfacts.cacao.util.NinePatchTexture
|
||||||
import net.shadowfacts.cacao.util.RenderHelper
|
import net.shadowfacts.cacao.util.RenderHelper
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* A helper class for drawing a [NinePatchTexture] in a view.
|
||||||
|
* `NinePatchView` will draw the given nine patch texture filling its bounds.
|
||||||
|
*
|
||||||
* @author shadowfacts
|
* @author shadowfacts
|
||||||
|
* @param ninePatch The nine patch texture that this view will draw.
|
||||||
*/
|
*/
|
||||||
class NinePatchView(val ninePatch: NinePatchTexture): View() {
|
class NinePatchView(val ninePatch: NinePatchTexture): View() {
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue