lovr.data.newImage
EditCreates a new Image. Image data can be loaded and decoded from an image file. Alternatively, a blank image can be created with a given width, height, and format.
Load image data from a file.
Arguments
| Name | Type | Description |
| file | string | Blob | A filename or Blob containing an image file to load. |
Returns
| Name | Type | Description |
| image | Image | The new Image. |
Create an Image with a given size and pixel format.
Arguments
| Name | Type | Default | Description |
| width | number | The width of the texture. | |
| height | number | The height of the texture. | |
| format | TextureFormat | rgba8 | The format of the texture's pixels. |
| data | Blob | nil |
Raw pixel values to use as the contents. If nil, the data will all be zero.
|
Returns
| Name | Type | Description |
| image | Image | The new Image. |
Clone an existing Image.
Arguments
| Name | Type | Description |
| source | Image | The Image to clone. |
Returns
| Name | Type | Description |
| image | Image | The new Image. |
Notes
The supported image file formats are png, jpg, hdr, dds, ktx1, ktx2, and astc.
DDS and KTX files can contain cubemaps and array textures, in any of the texture formats LÖVR supports.