terom@11: #ifndef RENDER_PNG_H terom@11: #define RENDER_PNG_H terom@11: terom@11: #include "render.h" terom@11: terom@11: /* terom@11: * For rendering PNG images terom@11: */ terom@11: struct render_png; terom@11: terom@11: /* terom@11: * Build and return a render_png that can be used to render a PNG of the given struct render. terom@11: * terom@13: * The dimensions of the PNG image will be read from render. If render's I/O terom@13: * was set using render_io_stream, then the PNG data will be written to that terom@13: * stream. If it was set using render_io_custom, then the write_fn will be terom@13: * called with chunks of PNG data, and flush_fn from time to time as a hint to terom@13: * flush the data, but this may be omitted. terom@11: * terom@11: * returns NULL on failure. terom@11: */ terom@17: struct render_png *render_png_alloc (struct render *render); terom@11: terom@11: /* terom@11: * Feed a full row of raw pixel data into the PNG image. terom@11: * terom@13: * buf must be render.img_w bytes wide. terom@11: */ terom@11: int render_png_row (struct render_png *ctx, unsigned char *rowbuf); terom@11: terom@11: /* terom@11: * Mark the render as complete and free the render_png, flushing out any remaining data. terom@11: */ terom@11: int render_png_done (struct render_png *ctx); terom@11: terom@11: /* terom@11: * Abort the render, free the render_png, and discard any remaining data. terom@11: */ terom@11: int render_png_abort (struct render_png *ctx); terom@11: terom@11: #endif /* RENDER_PNG_H */