mirror of
https://github.com/IgorTimofeev/MineOS.git
synced 2026-01-07 19:52:40 +01:00
Spelling for the most part.
parent
68413dc269
commit
67faf6ecb9
12
Image-API.md
12
Image-API.md
@ -1,6 +1,6 @@
|
||||
|
||||
|
||||
This library implements its own image format for OpenComputers with a simple loseless compression algorithm. It allows you to load and save pictures in .pic format, as well as to perform simple operations like string serialization/deserialization/scaling/transforming.
|
||||
This library implements its own image format for OpenComputers with a simple lossless compression algorithm. It allows you to load and save pictures in .pic format, as well as to perform simple operations like string serialization/de-serialization/scaling/transforming.
|
||||
|
||||
## How does it work inside?
|
||||
|
||||
@ -42,7 +42,7 @@ end
|
||||
|
||||
Tries to save a given `picture` to a given `path`, using a specified `encoding method`.
|
||||
If no encoding method is given, it will be set to **6** automatically.
|
||||
Returns `true` if image was saved successfully, `false` and an `reason` if not (maybe filesystem is readonly or there's not enough disk space to save it)
|
||||
Returns `true` if image was saved successfully, `false` and an `reason` if not (maybe filesystem is read-only or there's not enough disk space to save it)
|
||||
|
||||
```lua
|
||||
local success, reason = image.load("test.pic")
|
||||
@ -54,11 +54,11 @@ else
|
||||
end
|
||||
```
|
||||
|
||||
## String searialization
|
||||
## String serialization
|
||||
|
||||
### image.**toString**(*table* picture): *string* result
|
||||
|
||||
Serializes `picture` to string. Searialization is nearly **slow**, you **should avoid** this method if you don't really **know what you're doing**. It can be used for saving picture on disk in **text** (not **binary**) format and creating small standalone scripts that contains pictures directly in code with no need to load them from external file
|
||||
Serializes `picture` to string. Serialization is nearly **slow**, you **should avoid** this method if you don't really **know what you're doing**. It can be used for saving picture on disk in **text** (not **binary**) format and creating small standalone scripts that contains pictures directly in code with no need to load them from external file
|
||||
|
||||
This method applies basic **24bit to 8bit** color compression, but doesn't apply color grouping compression to result, and it will be stored as linear sequence
|
||||
|
||||
@ -71,7 +71,7 @@ image.toString(myImage)
|
||||
|
||||
### image.**fromString**(*string* string): *table* result
|
||||
|
||||
Deserializes `string` as picture table. This method is not so fast as **image.load**(), but still useful for standalone scripts with directly included pictures instread of files
|
||||
De-serializes `string` as picture table. This method is not so fast as **image.load**(), but still useful for standalone scripts with directly included pictures instead of files
|
||||
|
||||
Take a note: when using **very long** serialized strings in code, you should use **[[...]]** string syntax instead of **"..."**, because of lua machine can truncate them:
|
||||
|
||||
@ -100,7 +100,7 @@ Returns pixel width of given `picture`. You can also access this value via `pict
|
||||
|
||||
### image.**getHeight**(*table* picture): *int* height
|
||||
|
||||
Returns pixel heightof given `picture`. You can also access this value via `picture[2]`
|
||||
Returns pixel height of given `picture`. You can also access this value via `picture[2]`
|
||||
|
||||
### image.**get**(*table* picture, *int* x, *int* y): *int* background, *int* foreground, *byte* transparency, *string* symbol
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user