Package juuxel.libninepatch
Interface ContextualTextureRenderer<T,C>
- Type Parameters:
T- the texture type that this renderer can drawC- the type of context that is needed to draw a texture
- All Known Subinterfaces:
TextureRenderer<T>
- All Known Implementing Classes:
AwtTextureRenderer
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Texture renderers are used for drawing platform-specific textures and texture regions.
- Since:
- 1.1.0
- See Also:
texture renderers that don't need a context object
-
Method Summary
Modifier and TypeMethodDescriptiondefault voiddraw(TextureRegion<? extends T> region, C context, int x, int y, int width, int height, float u1, float v1, float u2, float v2)Draws rectangular subregion of a texture region.voiddraw(T texture, C context, int x, int y, int width, int height, float u1, float v1, float u2, float v2)Draws rectangular region of a texture.default voiddrawTiled(TextureRegion<? extends T> region, C context, int x, int y, int regionWidth, int regionHeight, int tileWidth, int tileHeight, float u1, float v1, float u2, float v2)Draws a tiled rectangular subregion of a texture.default voiddrawTiled(T texture, C context, int x, int y, int regionWidth, int regionHeight, int tileWidth, int tileHeight, float u1, float v1, float u2, float v2)Draws a tiled rectangular subregion of a texture.
-
Method Details
-
draw
void draw(T texture, C context, int x, int y, int width, int height, float u1, float v1, float u2, float v2)Draws rectangular region of a texture.- Parameters:
texture- the texturecontext- the context needed to draw the texturex- the leftmost X coordinate of the target drawing regiony- the topmost Y coordinate of the target drawing regionwidth- the width of the target regionheight- the height of the target regionu1- the left edge of the input region as a fraction from 0 to 1v1- the top edge of the input region as a fraction from 0 to 1u2- the right edge of the input region as a fraction from 0 to 1v2- the bottom edge of the input region as a fraction from 0 to 1
-
draw
default void draw(TextureRegion<? extends T> region, C context, int x, int y, int width, int height, float u1, float v1, float u2, float v2)Draws rectangular subregion of a texture region.- Parameters:
region- the texture regioncontext- the context needed to draw the texturex- the leftmost X coordinate of the target drawing regiony- the topmost Y coordinate of the target drawing regionwidth- the width of the target regionheight- the height of the target regionu1- the left edge of the input region as a fraction from 0 to 1v1- the top edge of the input region as a fraction from 0 to 1u2- the right edge of the input region as a fraction from 0 to 1v2- the bottom edge of the input region as a fraction from 0 to 1
-
drawTiled
default void drawTiled(T texture, C context, int x, int y, int regionWidth, int regionHeight, int tileWidth, int tileHeight, float u1, float v1, float u2, float v2)Draws a tiled rectangular subregion of a texture.The default implementation uses
draw()to draw each tile, but implementations may want to override this method for more performant rendering.- Parameters:
texture- the texturecontext- the context needed to draw the texturex- the leftmost X coordinate of the target drawing regiony- the topmost Y coordinate of the target drawing regionregionWidth- the total width of the target regionregionHeight- the total height of the target regiontileWidth- the width of an individual tile in the target regiontileHeight- the height of an individual tile in the target regionu1- the left edge of the input region as a fraction from 0 to 1v1- the top edge of the input region as a fraction from 0 to 1u2- the right edge of the input region as a fraction from 0 to 1v2- the bottom edge of the input region as a fraction from 0 to 1- Since:
- 1.2.0
-
drawTiled
default void drawTiled(TextureRegion<? extends T> region, C context, int x, int y, int regionWidth, int regionHeight, int tileWidth, int tileHeight, float u1, float v1, float u2, float v2)Draws a tiled rectangular subregion of a texture.The default implementation delegates to the overload taking a raw {@code T} texture; generally only that overload should be overridden.
- Parameters:
region- the texture regioncontext- the context needed to draw the texturex- the leftmost X coordinate of the target drawing regiony- the topmost Y coordinate of the target drawing regionregionWidth- the total width of the target regionregionHeight- the total height of the target regiontileWidth- the width of an individual tile in the target regiontileHeight- the height of an individual tile in the target regionu1- the left edge of the input region as a fraction from 0 to 1v1- the top edge of the input region as a fraction from 0 to 1u2- the right edge of the input region as a fraction from 0 to 1v2- the bottom edge of the input region as a fraction from 0 to 1- Since:
- 1.2.0
-