aboutsummaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorhecks <42101236+hecktest@users.noreply.github.com>2021-07-29 05:10:10 +0200
committerGitHub <noreply@github.com>2021-07-29 05:10:10 +0200
commit80d12dbedb67191a5eb3e4f3c36b04baed1f8afb (patch)
treeca8346be45852e0c08f444f8a8eb6c0cdfd37e39 /doc
parent2866918f3293c486609ff46ad0bfa5ce833aaaf2 (diff)
downloadminetest-80d12dbedb67191a5eb3e4f3c36b04baed1f8afb.tar.gz
minetest-80d12dbedb67191a5eb3e4f3c36b04baed1f8afb.tar.bz2
minetest-80d12dbedb67191a5eb3e4f3c36b04baed1f8afb.zip
Add a simple PNG image encoder with Lua API (#11485)
* Add a simple PNG image encoder with Lua API Add ColorSpec to RGBA converter Make a safety wrapper for the encoder Create devtest examples Co-authored-by: hecktest <> Co-authored-by: sfan5 <sfan5@live.de>
Diffstat (limited to 'doc')
-rw-r--r--doc/lua_api.txt19
1 files changed, 18 insertions, 1 deletions
diff --git a/doc/lua_api.txt b/doc/lua_api.txt
index 7ee9a3f2c..21e34b1ec 100644
--- a/doc/lua_api.txt
+++ b/doc/lua_api.txt
@@ -4611,6 +4611,23 @@ Utilities
* `minetest.colorspec_to_colorstring(colorspec)`: Converts a ColorSpec to a
ColorString. If the ColorSpec is invalid, returns `nil`.
* `colorspec`: The ColorSpec to convert
+* `minetest.colorspec_to_bytes(colorspec)`: Converts a ColorSpec to a raw
+ string of four bytes in an RGBA layout, returned as a string.
+ * `colorspec`: The ColorSpec to convert
+* `minetest.encode_png(width, height, data, [compression])`: Encode a PNG
+ image and return it in string form.
+ * `width`: Width of the image
+ * `height`: Height of the image
+ * `data`: Image data, one of:
+ * array table of ColorSpec, length must be width*height
+ * string with raw RGBA pixels, length must be width*height*4
+ * `compression`: Optional zlib compression level, number in range 0 to 9.
+ The data is one-dimensional, starting in the upper left corner of the image
+ and laid out in scanlines going from left to right, then top to bottom.
+ Please note that it's not safe to use string.char to generate raw data,
+ use `colorspec_to_bytes` to generate raw RGBA values in a predictable way.
+ The resulting PNG image is always 32-bit. Palettes are not supported at the moment.
+ You may use this to procedurally generate textures during server init.
Logging
-------
@@ -7631,7 +7648,7 @@ Used by `minetest.register_node`.
leveled_max = 127,
-- Maximum value for `leveled` (0-127), enforced in
-- `minetest.set_node_level` and `minetest.add_node_level`.
- -- Values above 124 might causes collision detection issues.
+ -- Values above 124 might causes collision detection issues.
liquid_range = 8,
-- Maximum distance that flowing liquid nodes can spread around