png/reader
src/png/reader.tur
defn
png-read
(png-read [path :cstr] :ptr<void>)
read a PNG file from disk into an RGBA image handle.
Parameters
| path | filesystem path to the PNG file |
Returns
(ok handle) on success; (err 0) on failure. The image is always converted to 8-bit RGBA (4 channels). Free with img-free when done.
Example
(let [r (png-read "sprite.png")]
(if (ok? r) (let [img (ok-val r)] ...) (println "read failed")))
Since: PN0
defn
img-free
(img-free [img :int] :void)
free an image handle allocated by png-read.
Parameters
| img | image handle (ok-val from png-read) |
Returns
void
Example
(img-free img)
Since: PN0
Internal definitions
__ok-- create an ok result wrapping integer value v.__err-- create an err result wrapping integer error value e.