Skip to main content

ImageAsset

An image asset with metadata important for displaying it in a control.

class ImageAsset

Example​

import { ImageAsset } from kontakt_controls

var my_image = ImageAsset(
path: "rounded_button.png",
width: 128,
height: 24,
frame_count: 8,
fixed_left: 4,
fixed_right: 4,
fixed_top: 4,
fixed_bottom: 4,
)

Constructor​

constructor(path: String, width: Float, height: Float, frame_count: Int = 1, fixed_left: Int = 0, fixed_right: Int = 0, fixed_top: Int = 0, fixed_bottom: Int = 0)
path: String

The project relative path.

width: Float

Logical width in pixels.

height: Float

Logical height in pixels.

frame_count: Int = 1

Number of frames if this is a sprite otherwise leave this at 1.

fixed_left: Int = 0

The logical width of the fixed left border for a nine-patch image.

fixed_right: Int = 0

The logical width of the fixed right border for a nine-patch image.

fixed_top: Int = 0

The logical height of the fixed top border for a nine-patch image.

fixed_bottom: Int = 0

The logical height of the fixed bottom border for a nine-patch image.

The logical height of the fixed bottom border for a nine-patch image.

Properties​

path​

path: String { get set }

The project relative path.


width​

width: Float { get set }

Logical width in pixels.


height​

height: Float { get set }

Logical height in pixels.


frame_count​

frame_count: Int { get set }

Number of frames if this is a sprite otherwise leave this at 1.


fixed_left​

fixed_left: Int { get set }

The logical width of the fixed left border for a nine-patch image.


fixed_right​

fixed_right: Int { get set }

The logical width of the fixed right border for a nine-patch image.


fixed_top​

fixed_top: Int { get set }

The logical height of the fixed top border for a nine-patch image.


fixed_bottom​

fixed_bottom: Int { get set }

The logical height of the fixed bottom border for a nine-patch image.

The logical height of the fixed bottom border for a nine-patch image.