Compare commits

..

1 Commits

Author SHA1 Message Date
Shadowfacts f474c4c8bf
Add NinePatchTexture and NinePatchView 2019-06-23 20:02:47 -04:00
2 changed files with 0 additions and 14 deletions

View File

@ -1,17 +1,7 @@
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) {

View File

@ -6,11 +6,7 @@ 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() {