render_png.h
author Tero Marttila <terom@fixme.fi>
Fri, 29 Aug 2008 23:31:17 +0300
changeset 48 1c67f512779b
parent 17 8e8b56b0e0f5
permissions -rw-r--r--
fix doc tpyos, rename some enums, fix printf format len for non-zero terminated strings (hg status), pass args to memcache_cmd_format_header via memcache_req_*, handle zero-length STORE requests, memcache_req is_buf_ours + free, other function name typos (keymemcache_req_key), fix req state behaviour re *_DATA_* for STORE requests and FETCH/END, better memcache_server connpool events/management, modular memcache_test with a working benchmark. This is a long commit message.
#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 */