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