18
|
1 |
#ifndef PNGTILE_TILE_H
|
|
2 |
#define PNGTILE_TILE_H
|
|
3 |
|
|
4 |
/**
|
|
5 |
* Generating PNG tiles from a cache
|
|
6 |
*/
|
|
7 |
#include "pngtile.h"
|
|
8 |
#include "cache.h"
|
|
9 |
|
|
10 |
/** Types of tile output */
|
|
11 |
enum pt_tile_output {
|
|
12 |
PT_TILE_OUT_FILE,
|
|
13 |
PT_TILE_OUT_MEM,
|
|
14 |
};
|
|
15 |
|
|
16 |
/** Initial size of out.mem.base, 16k */
|
|
17 |
#define PT_TILE_BUF_SIZE (16 * 1024)
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
/** Per-tile-render state */
|
|
22 |
struct pt_tile {
|
|
23 |
/** Render spec */
|
|
24 |
struct pt_tile_info info;
|
|
25 |
|
|
26 |
/** Output type */
|
|
27 |
enum pt_tile_output out_type;
|
|
28 |
|
|
29 |
union {
|
|
30 |
/** Output file */
|
|
31 |
FILE *file;
|
|
32 |
|
|
33 |
/** Output buffer */
|
|
34 |
struct pt_tile_mem {
|
|
35 |
char *base;
|
|
36 |
size_t off, len;
|
|
37 |
} mem;
|
|
38 |
} out;
|
|
39 |
};
|
|
40 |
|
|
41 |
/**
|
|
42 |
* Initialize to render with given params, writing output to given FILE*
|
|
43 |
*/
|
|
44 |
int pt_tile_init_file (struct pt_tile *tile, const struct pt_tile_info *info, FILE *out);
|
|
45 |
|
|
46 |
/**
|
|
47 |
* Initialize to render with given params, writing output to a memory buffer
|
|
48 |
*/
|
|
49 |
int pt_tile_init_mem (struct pt_tile *tile, const struct pt_tile_info *info);
|
|
50 |
|
|
51 |
/**
|
|
52 |
* Render PNG data from given cache according to parameters given to pt_tile_init_*
|
|
53 |
*/
|
|
54 |
int pt_tile_render (struct pt_tile *tile, struct pt_cache *cache);
|
|
55 |
|
|
56 |
/**
|
|
57 |
* Abort any failed render process, cleaning up.
|
|
58 |
*/
|
|
59 |
void pt_tile_abort (struct pt_tile *tile);
|
|
60 |
|
|
61 |
#endif
|