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