1 // libpngrewrite.h - part of pngrewrite
2 // Copyright (C) 2010 by Jason Summers
3 
4 #ifndef LIBPNGREWRITE_H_INCLUDED
5 #define LIBPNGREWRITE_H_INCLUDED
6 
7 #ifdef __cplusplus
8 extern "C" {
9 #endif
10 
11 #if defined(_WIN32) && !defined(__GNUC__) && !defined(PNGRW_WINDOWS)
12 #define PNGRW_WINDOWS
13 #endif
14 
15 #ifdef PNGRW_WINDOWS
16 #include <tchar.h>
17 #define PNGRW_CHAR TCHAR
18 #else
19 #define PNGRW_CHAR char
20 #endif
21 
22 #include <stdio.h>
23 
24 struct pngrw_ctx;
25 struct pngrw_ctx *pngrw_create(void);
26 void pngrw_destroy(struct pngrw_ctx *ctx);
27 
28 int pngrw_read_filename(struct pngrw_ctx *ctx, const PNGRW_CHAR *in_filename);
29 int pngrw_write_filename(struct pngrw_ctx *ctx, const PNGRW_CHAR *out_filename);
30 
31 int pngrw_read_stdio(struct pngrw_ctx *ctx, FILE *infp);
32 int pngrw_write_stdio(struct pngrw_ctx *ctx, FILE *outfp);
33 
34 typedef void (*pngrw_print_fn_type)(struct pngrw_ctx *ctx, const PNGRW_CHAR *s);
35 
36 void pngrw_set_print_fn(struct pngrw_ctx *ctx, pngrw_print_fn_type prntfn);
37 void pngrw_set_error_fn(struct pngrw_ctx *ctx, pngrw_print_fn_type errfn);
38 
39 void pngrw_set_userdata(struct pngrw_ctx *ctx, void *u);
40 void *pngrw_get_userdata(struct pngrw_ctx *ctx);
41 void pngrw_set_sort_by_frequency(struct pngrw_ctx *ctx, int n);
42 
43 int pngrw_optimize_image(struct pngrw_ctx *ctx);
44 
45 const PNGRW_CHAR *pngrw_get_version_string(void);
46 
47 #ifdef __cplusplus
48 }
49 #endif
50 
51 #endif // LIBPNGREWRITE_H_INCLUDED
52