Skip to main content

UI.Texture

Class representing static or animated texture.

Index

Constructors

constructor

  • Constructs new static Texture with specified bitmap.


    Parameters

    • bitmap: Bitmap

      android.graphics.Bitmap instance

    Returns Texture

Properties

animation

animation: IBitmapWrap[]

bitmap

bitmap: IBitmapWrap

delay

delay: number

isAnimation

isAnimation: boolean

Methods

draw

  • draw(canvas: Canvas, x: number, y: number, scale: number): void
  • Parameters

    • canvas: Canvas
    • x: number
    • y: number
    • scale: number

    Returns void

drawCutout

  • drawCutout(canvas: Canvas, cutout: RectF, x: number, y: number, scale: number): void
  • Parameters

    • canvas: Canvas
    • cutout: RectF
    • x: number
    • y: number
    • scale: number

    Returns void

fitAllToOneSize

  • fitAllToOneSize(): void
  • Resizes all the frames to match the first one.


    Returns void

getBitmap

  • getBitmap(frame: number): Bitmap
  • Parameters

    • frame: number

      frame number

    Returns Bitmap

    Bitmap object containing animation frame for the corresponding frame number.

getBitmapWrap

getFrame

  • getFrame(): number
  • Returns number

    Frame number of the animation corresponding to current system time.

getHeight

  • getHeight(): number
  • Returns number

    Height of the texture in pixels.

getWidth

  • getWidth(): number
  • Returns number

    Width of the texture in pixels.

isAnimated

  • isAnimated(): boolean
  • Returns boolean

readOffset

  • readOffset(obj: { x?: number; y?: number }): void
  • Sets texture offsets in pixels from the upper left bound of the bitmap.


    Parameters

    • obj: { x?: number; y?: number }
      • optionalx: number
      • optionaly: number

    Returns void

release

  • release(): void
  • Releases all allocated resources, should be called when the texture is not longer needed.


    Returns void

rescaleAll

  • rescaleAll(scale: number): void
  • Resizes all the frames by constant scale multiplier.


    Parameters

    • scale: number

      scale to modify the frames by

    Returns void

resizeAll

  • resizeAll(width: number, height: number): void
  • Resizes all the frames of the texture to the specified size.


    Parameters

    • width: number
    • height: number

    Returns void