🖼️texture

This type represents a texture object.

This type inherits managed type. All of its base methods and fields are also available in this type.

Supported texture formats are:

  • JPEG (.jpg, .jpeg) - 12 bpc/arithmetic are not supported.

  • PNG (.png)

  • TGA (.tga)

  • BMP (.bmp) - 1 bpp and RLE variants are not supported.

  • PSD (.psd) - composited view only, no extra channels, 8/16 bpc

  • GIF (.gif) - only first frame, for animated gifs use animated_texture

  • HDR (.hdr)

  • PIC (.pic)

  • PNM (.pnm, .ppm, .pgm) - PPM and PGM are binary only

__call

Constructs an instance of this type.

Arguments

1. From file.

Name

Type

Description

path

string

Path to a valid texture file.

2. From memory.

Name

Type

Description

data

Pointer to texture file data in memory.

sz

int

Size of the texture file data.

3. From RGBA data.

Name

Type

Description

data

Pointer to RGBA data in memory.

w

int

Width.

h

int

Height (row count).

p

int

Pitch (row width). This is the amount of bytes per row.

Returns

Type

Description

texture

Texture object.

Example

local tex = draw.texture('funny_meme.png');

is_animated

Type: bool

Set to true if this is an instance of animated_texture.


get_size

Returns size of this texture.

Arguments

None.

Returns

Type

Description

Texture dimensions.

Example

local sz = tex:get_size();

Last updated