crystal.Image
A UI element which draws a texture or a solid color.
Constructor
crystal.Image:new(texture)
The texture argument can be nil or a love.Texture. When constructing an Image with an initial texture, the image size will also be set to the size of the texture. Otherwise, it will default to 1x1 pixel.
Methods
| Name | Description |
|---|---|
| image_size | Returns the image size in pixels. |
| set_image_size | Sets the image size in pixels. |
| set_texture | Sets or clear the texture to draw. |
| texture | Returns the texture to draw, if any. |
Examples
local image = crystal.Image:new(crystal.assets.get("assets/ui/menu_background.png"));
print(image:image_size()); -- Prints the size of `menu_background.png`