update doc/*/scripting/ui.md

This commit is contained in:
MihailRis 2025-11-19 19:50:48 +03:00
parent 2095e82f1a
commit 9b2e81b617
2 changed files with 31 additions and 15 deletions

View File

@ -201,6 +201,14 @@ Here, *color* can be specified in the following ways:
| data:mul(*color* or Canvas) | multiplies a color by the specified color or canvas |
| data:add(*color* or Canvas) | adds a color or another canvas to a color |
| data:sub(*color* or Canvas) | subtracts a color or another canvas to a color |
| data:encode(format: str) | encodes image to specified format and returns bytearray |
To decode a byte array into a Canvas, use the static method:
```lua
Canvas.decode(data: Bytearray, format: str) -> Canvas
```
Currently, only png is supported.
## Inline frame (iframe)

View File

@ -187,7 +187,7 @@ document["worlds-panel"]:clear()
- r: int, g: int, b: int, a: int
| Метод | Описание |
|----------------------------------------------------------|------------------------------------------------------|
|----------------------------------------------------------|-----------------------------------------------------------------|
| data:at(x: int, y: int) | возвращает RGBA пиксель по указанным координатам |
| data:set(x: int, y: int, *цвет*) | изменяет RGBA пиксель по указанным координатам |
| data:line(x1: int, y1: int, x2: int, y2: int, *цвет*) | рисует линию с указанным RGBA цветом |
@ -201,6 +201,14 @@ document["worlds-panel"]:clear()
| data:mul(*цвет* или Canvas) | умножает увет на указанный цвет или холст |
| data:add(*цвет* или Canvas) | прибавляет цвет или другой холст к цвету |
| data:sub(*цвет* или Canvas) | вычитает цвет или другой холст к цвету |
| data:encode(format: str) | кодирует изображение в указанный формат и возращает массив байт |
Для декодирования массива байт в Canvas используйте статический метод:
```lua
Canvas.decode(data: Bytearray, format: str) -> Canvas
```
На данный момент, из форматов поддерживается только png.
## Рамка встраивания (iframe)