Skip to main content

CompressedImageData

Description:

  Represents compressed image data designed to stay compressed in RAM.

release

Type: Function.

Description:

  Destroys the object's Lua reference. The object will be completely deleted if it's not referenced by any other LÖVE object or thread. This method can be used to immediately clean up resources without waiting for Lua's garbage collector.

Signature:

release: function(self: CompressedImageData): boolean

Returns:

Return TypeDescription
booleanTrue if the object was released by this call, false if it had been previously released.

type

Type: Function.

Description:

  Gets the type of the object as a string.

Signature:

type: function(self: CompressedImageData): string

Returns:

Return TypeDescription
stringThe type as a string.

Of

Type: Function.

Description:

  Checks whether an object is of a certain type. If the object has the type with the specified name in its hierarchy, this function will return true.

Signature:

typeOf: function(self: CompressedImageData, type_name: string): boolean

Parameters:

ParameterTypeDescription
type_namestringThe name of the type to check for.

Returns:

Return TypeDescription
booleanTrue if the object is of the specified type, false otherwise.

getString

Type: Function.

Description:

  Gets the full Data as a string.

Signature:

getString: function(self: CompressedImageData): string

Returns:

Return TypeDescription
stringThe raw data.

getSize

Type: Function.

Description:

  Gets the Data's size in bytes.

Signature:

getSize: function(self: CompressedImageData): integer

Returns:

Return TypeDescription
integerThe size of the Data in bytes.

getPointer

Type: Function.

Description:

  Gets a pointer to the Data. Can be used with libraries such as LuaJIT's FFI.

Signature:

getPointer: function(self: CompressedImageData): any

Returns:

Return TypeDescription
anyA raw pointer to the Data.

getFFIPointer

Type: Function.

Description:

  Gets an FFI pointer to the Data. This function should be preferred instead of Data:getPointer because the latter uses light userdata which can't store more all possible memory addresses on some new ARM64 architectures, when LuaJIT is used.

Signature:

getFFIPointer: function(self: CompressedImageData): nil

Returns:

Return TypeDescription
nilA raw void* pointer to the Data, or nil if FFI is unavailable.

clone

Type: Function.

Description:

  Creates a new copy of the Data object.

Signature:

clone: function(self: CompressedImageData): CompressedImageData

Returns:

Return TypeDescription
CompressedImageDataThe new copy.

getWidth

Type: Function.

Description:

  Gets the width of the CompressedImageData.

Signature:

getWidth: function(self: CompressedImageData): integer

Returns:

Return TypeDescription
integerwidth — The width of the CompressedImageData.

getWidth

Type: Function.

Description:

  Gets the width of the CompressedImageData.

Signature:

getWidth: function(self: CompressedImageData, mipmap: integer): integer

Parameters:

ParameterTypeDescription
mipmapintegerA mipmap level. Must be in the range of CompressedImageData:getMipmapCount().

Returns:

Return TypeDescription
integerThe width of a specific mipmap level of the CompressedImageData.

getHeight

Type: Function.

Description:

  Gets the height of the CompressedImageData.

Signature:

getHeight: function(self: CompressedImageData): integer

Returns:

Return TypeDescription
integerheight — The height of the CompressedImageData.

getHeight

Type: Function.

Description:

  Gets the height of the CompressedImageData.

Signature:

getHeight: function(self: CompressedImageData, mipmap: integer): integer

Parameters:

ParameterTypeDescription
mipmapintegerA mipmap level. Must be in the range of CompressedImageData:getMipmapCount().

Returns:

Return TypeDescription
integerThe height of a specific mipmap level of the CompressedImageData.

getDimensions

Type: Function.

Description:

  Gets the width and height of the CompressedImageData.

Signature:

getDimensions: function(self: CompressedImageData): integer, integer

Returns:

Return TypeDescription
integerwidth — The width of the CompressedImageData.
integerheight — The height of the CompressedImageData.

getDimensions

Type: Function.

Description:

  Gets the width and height of the CompressedImageData.

Signature:

getDimensions: function(self: CompressedImageData, mipmap: integer): integer, integer

Parameters:

ParameterTypeDescription
mipmapintegerA mipmap level. Must be in the range of CompressedImageData:getMipmapCount().

Returns:

Return TypeDescription
integerThe width of a specific mipmap level of the CompressedImageData.
integerThe height of a specific mipmap level of the CompressedImageData.

getMipmapCount

Type: Function.

Description:

  Gets the number of mipmap levels in the CompressedImageData. The base mipmap level (original image) is included in the count. Overload details:

  1. Mipmap filtering cannot be activated for an Image:setMipmapFilter will error. Most tools which can create compressed textures are able to automatically generate mipmaps for them in the same file.

Signature:

getMipmapCount: function(self: CompressedImageData): integer

Returns:

Return TypeDescription
integerThe number of mipmap levels stored in the CompressedImageData.

getFormat

Type: Function.

Description:

  Gets the format of the CompressedImageData.

Signature:

getFormat: function(self: CompressedImageData): string

Returns:

Return TypeDescription
stringThe format of the CompressedImageData.