png/reader
src/png/reader.tur
defn
png-read
(png-read [path : cstr] :)
read a PNG file from disk into an RGBA image handle.
Parameters
| path | filesystem path to the PNG file |
Returns
(Result Img int) -- ok carries the Img handle; err carries 0 on failure (file-open or libpng 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 : Img] :)
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