author | Tero Marttila <terom@fixme.fi> |
Sun, 24 Jan 2010 23:20:39 +0200 | |
changeset 55 | a3542e78ecd8 |
parent 19 | ebcc49de97d0 |
child 56 | d5e3089906da |
permissions | -rw-r--r-- |
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 { |
|
19
ebcc49de97d0
implement pt_ctx threadpool and pt_image_tile_async
Tero Marttila <terom@fixme.fi>
parents:
18
diff
changeset
|
23 |
/** Cache to render from */ |
ebcc49de97d0
implement pt_ctx threadpool and pt_image_tile_async
Tero Marttila <terom@fixme.fi>
parents:
18
diff
changeset
|
24 |
struct pt_cache *cache; |
ebcc49de97d0
implement pt_ctx threadpool and pt_image_tile_async
Tero Marttila <terom@fixme.fi>
parents:
18
diff
changeset
|
25 |
|
18 | 26 |
/** Render spec */ |
27 |
struct pt_tile_info info; |
|
28 |
||
29 |
/** Output type */ |
|
30 |
enum pt_tile_output out_type; |
|
31 |
||
32 |
union { |
|
33 |
/** Output file */ |
|
34 |
FILE *file; |
|
35 |
||
36 |
/** Output buffer */ |
|
37 |
struct pt_tile_mem { |
|
38 |
char *base; |
|
39 |
size_t off, len; |
|
40 |
} mem; |
|
41 |
} out; |
|
42 |
}; |
|
43 |
||
44 |
/** |
|
19
ebcc49de97d0
implement pt_ctx threadpool and pt_image_tile_async
Tero Marttila <terom@fixme.fi>
parents:
18
diff
changeset
|
45 |
* Alloc a new pt_tile, which must be initialized using pt_tile_init_* |
ebcc49de97d0
implement pt_ctx threadpool and pt_image_tile_async
Tero Marttila <terom@fixme.fi>
parents:
18
diff
changeset
|
46 |
*/ |
ebcc49de97d0
implement pt_ctx threadpool and pt_image_tile_async
Tero Marttila <terom@fixme.fi>
parents:
18
diff
changeset
|
47 |
int pt_tile_new (struct pt_tile **tile_ptr); |
ebcc49de97d0
implement pt_ctx threadpool and pt_image_tile_async
Tero Marttila <terom@fixme.fi>
parents:
18
diff
changeset
|
48 |
|
ebcc49de97d0
implement pt_ctx threadpool and pt_image_tile_async
Tero Marttila <terom@fixme.fi>
parents:
18
diff
changeset
|
49 |
/** |
18 | 50 |
* Initialize to render with given params, writing output to given FILE* |
51 |
*/ |
|
19
ebcc49de97d0
implement pt_ctx threadpool and pt_image_tile_async
Tero Marttila <terom@fixme.fi>
parents:
18
diff
changeset
|
52 |
int pt_tile_init_file (struct pt_tile *tile, struct pt_cache *cache, const struct pt_tile_info *info, FILE *out); |
18 | 53 |
|
54 |
/** |
|
55 |
* Initialize to render with given params, writing output to a memory buffer |
|
56 |
*/ |
|
19
ebcc49de97d0
implement pt_ctx threadpool and pt_image_tile_async
Tero Marttila <terom@fixme.fi>
parents:
18
diff
changeset
|
57 |
int pt_tile_init_mem (struct pt_tile *tile, struct pt_cache *cache, const struct pt_tile_info *info); |
18 | 58 |
|
59 |
/** |
|
60 |
* Render PNG data from given cache according to parameters given to pt_tile_init_* |
|
61 |
*/ |
|
19
ebcc49de97d0
implement pt_ctx threadpool and pt_image_tile_async
Tero Marttila <terom@fixme.fi>
parents:
18
diff
changeset
|
62 |
int pt_tile_render (struct pt_tile *tile); |
18 | 63 |
|
64 |
/** |
|
65 |
* Abort any failed render process, cleaning up. |
|
66 |
*/ |
|
67 |
void pt_tile_abort (struct pt_tile *tile); |
|
68 |
||
19
ebcc49de97d0
implement pt_ctx threadpool and pt_image_tile_async
Tero Marttila <terom@fixme.fi>
parents:
18
diff
changeset
|
69 |
/** |
ebcc49de97d0
implement pt_ctx threadpool and pt_image_tile_async
Tero Marttila <terom@fixme.fi>
parents:
18
diff
changeset
|
70 |
* Destroy given pt_tile, aborting it and freeing it |
ebcc49de97d0
implement pt_ctx threadpool and pt_image_tile_async
Tero Marttila <terom@fixme.fi>
parents:
18
diff
changeset
|
71 |
*/ |
ebcc49de97d0
implement pt_ctx threadpool and pt_image_tile_async
Tero Marttila <terom@fixme.fi>
parents:
18
diff
changeset
|
72 |
void pt_tile_destroy (struct pt_tile *tile); |
ebcc49de97d0
implement pt_ctx threadpool and pt_image_tile_async
Tero Marttila <terom@fixme.fi>
parents:
18
diff
changeset
|
73 |
|
18 | 74 |
#endif |