No matching definitions.

png/writer

src/png/writer.tur
defn

png-write

(png-write [path :cstr img :int] :ptr<void>)

write an image handle to a PNG file on disk.

pathdestination filesystem path for the PNG file
imgimage handle (ok-val from png-read in png/reader)

(ok 0) on success; (err 0) on failure.

(let [r (png-write "/tmp/out.png" img)]
    (if (ok? r) (println "written") (println "write failed")))

Since: PN0

defn

png-write-raw

(png-write-raw [path :cstr pixels :cstr width :int height :int channels :int bit-depth :int] :ptr<void>)

write raw pixel data to a PNG file on disk.

pathdestination filesystem path for the PNG file
pixelspointer to pixel data as :cstr (row-major interleaved bytes)
widthimage width in pixels
heightimage height in pixels
channelsnumber of channels: 1=GRAY, 2=GRAY_ALPHA, 3=RGB, 4=RGBA
bit-depthbit depth per channel (typically 8)

(ok 0) on success; (err 0) on failure.

(let [r (png-write-raw "/tmp/out.png" buf 256 256 4 8)]
    (if (ok? r) (println "written") (println "write failed")))

Since: PN0

Internal definitions
__ok-- create an ok result wrapping integer value v.
__err-- create an err result wrapping integer error value e.