2.0 KiB
2.0 KiB
Image : VisualElement
This is the Image element class which can be used to display bimg format images. The bimg format is a universal ComputerCraft image format. See: https://github.com/SkyTheCodeMaster/bimg
Properties
| Property | Type | Default | Description |
|---|---|---|---|
| bimg | table | {} | The bimg image data |
| currentFrame | number | 1 | Current animation frame |
| metadata | table | {} | Image metadata (version, palette, etc) |
Functions
| Method | Returns | Description |
|---|---|---|
| Image.new | - | |
| Image:getPixelData | number? | |
| Image:init | - | |
| Image:loadBimg | - | |
| Image:nextFrame | - | |
| Image:render | - | |
| Image:setBg | - | |
| Image:setChar | - | |
| Image:setFg | - | |
| Image:setPixel | - |
Image.new()
Image:getPixelData(x, y)
Gets pixel information at position
Parameters
xnumberX positionynumberY position
Returns
number?fgForeground colornumber?bgBackground colorstring?charCharacter at position
Image:init()
Image:loadBimg(bimgData)
Loads a bimg format image
Parameters
bimgDatatableThe bimg image data
Image:nextFrame()
Image:render()
Image:setBg(x, y, color)
Sets background color at position
Parameters
xnumberX positionynumberY positioncolornumberColor value (0-15)
Image:setChar(x, y, char)
Sets character at position
Parameters
xnumberX positionynumberY positioncharstringSingle character to set
Image:setFg(x, y, color)
Sets foreground color at position
Parameters
xnumberX positionynumberY positioncolornumberColor value (0-15)
Image:setPixel(x, y, char, fg, bg)
Sets all properties at position
Parameters
xnumberX positionynumberY positioncharstring?Character to set (optional)fgnumber?Foreground color (optional)bgnumber?Background color (optional)