PartialTexture

class PartialTexture(val texture: Texture, val srcX: Float, val srcY: Float, val imageWidth: Float, val imageHeight: Float) : Image

Defines a rectangular region of a Texture as an Image. For example, it is common to place many icons in a single .png file, which is loaded as a single Texture. Each icon is then defined using PartialTexture.

NOTE. Ensure that there is at least 1 transparent pixel between each icon, otherwise the colors of the neighbouring icons can 'bleed' this icon when rendered. Google 'opengl texture bleeding' for details.

Constructors

Link copied to clipboard
constructor(texture: Texture, srcX: Float, srcY: Float, imageWidth: Float, imageHeight: Float)

Properties

Link copied to clipboard
open override val imageHeight: Float
Link copied to clipboard
open override val imageWidth: Float
Link copied to clipboard
val srcX: Float
Link copied to clipboard
val srcY: Float
Link copied to clipboard

Functions

Link copied to clipboard
open override fun batch(tint: Color?, block: TextureBatch.() -> Unit)
Link copied to clipboard
open override fun draw(x: Float, y: Float, tint: Color?)
Link copied to clipboard
open override fun drawBatched(batch: TextureBatch, x: Float, y: Float)
Link copied to clipboard
open override fun drawTo(x: Float, y: Float, destWidth: Float, destHeight: Float, tint: Color?)
Link copied to clipboard
open override fun drawToBatched(batch: TextureBatch, x: Float, y: Float, destWidth: Float, destHeight: Float)

The same as the other drawTo, but using a TextureBatch for efficiency.

Link copied to clipboard
open override fun partialImage(fromX: Float, fromY: Float, width: Float, height: Float): Image

Takes a rectangular region of this Image, and returns it as an Image. Note, the pixel data is NOT copied

Link copied to clipboard
open override fun scaledBy(scaleX: Float, scaleY: Float): ScaledPartialTexture

Returns an Image using the same pixel data as this image, but it lies about its actual size.

Link copied to clipboard
open override fun toString(): String