mirror of
https://github.com/IgorTimofeev/MineOS.git
synced 2025-12-20 19:19:21 +01:00
Updated Image API (markdown)
parent
3ff8610a31
commit
1dd859c029
20
Image-API.md
20
Image-API.md
@ -7,16 +7,16 @@ Every image is stored in RAM as a one-dimensional table, where the first two ele
|
|||||||
|
|
||||||
```lua
|
```lua
|
||||||
{
|
{
|
||||||
160, -- Image width
|
160, -- Image width
|
||||||
50, -- Image height
|
50, -- Image height
|
||||||
|
|
||||||
-- Begin of pixel data
|
-- Begin of pixel data
|
||||||
0xFF0000, -- Red background color
|
0xFF0000, -- Red background color
|
||||||
0x0000FF, -- Blue symbol color,
|
0x0000FF, -- Blue symbol color,
|
||||||
0x00, -- Alpha channel,
|
0x00, -- Alpha channel,
|
||||||
"Q", -- Symbol,
|
"Q", -- Symbol,
|
||||||
|
|
||||||
... -- Same for every pixel from left to right / top to bottom
|
... -- Same for every pixel from left to right / top to bottom
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -32,7 +32,7 @@ local result, reason = image.load("test.pic")
|
|||||||
if result then
|
if result then
|
||||||
-- Do your stuff like GUI.image(1, 1, result)
|
-- Do your stuff like GUI.image(1, 1, result)
|
||||||
else
|
else
|
||||||
-- Image is broken or not enough RAM
|
-- Image is broken or not enough RAM
|
||||||
end
|
end
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -47,7 +47,7 @@ local success, reason = image.load("test.pic")
|
|||||||
if success then
|
if success then
|
||||||
-- Image was saved
|
-- Image was saved
|
||||||
else
|
else
|
||||||
-- Image wasn't saved (fs is read-only, not enough RAM or HDD free space)
|
-- Image wasn't saved (fs is read-only, not enough RAM or HDD free space)
|
||||||
end
|
end
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user