1 /*---------------------------------------------------------------------------
3 wpng - simple PNG-writing program writepng.h
5 ---------------------------------------------------------------------------
7 Copyright (c) 1998-2000 Greg Roelofs. All rights reserved.
9 This software is provided "as is," without warranty of any kind,
10 express or implied. In no event shall the author or contributors
11 be held liable for any damages arising in any way from the use of
14 Permission is granted to anyone to use this software for any purpose,
15 including commercial applications, and to alter it and redistribute
16 it freely, subject to the following restrictions:
18 1. Redistributions of source code must retain the above copyright
19 notice, disclaimer, and this list of conditions.
20 2. Redistributions in binary form must reproduce the above copyright
21 notice, disclaimer, and this list of conditions in the documenta-
22 tion and/or other materials provided with the distribution.
23 3. All advertising materials mentioning features or use of this
24 software must display the following acknowledgment:
26 This product includes software developed by Greg Roelofs
27 and contributors for the book, "PNG: The Definitive Guide,"
28 published by O'Reilly and Associates.
30 ---------------------------------------------------------------------------*/
38 # define MAX(a,b) ((a) > (b)? (a) : (b))
39 # define MIN(a,b) ((a) < (b)? (a) : (b))
43 # define Trace(x) {fprintf x ; fflush(stderr); fflush(stdout);}
48 #define TEXT_TITLE 0x01
49 #define TEXT_AUTHOR 0x02
50 #define TEXT_DESC 0x04
51 #define TEXT_COPY 0x08
52 #define TEXT_EMAIL 0x10
55 #define TEXT_TITLE_OFFSET 0
56 #define TEXT_AUTHOR_OFFSET 72
57 #define TEXT_COPY_OFFSET (2*72)
58 #define TEXT_EMAIL_OFFSET (3*72)
59 #define TEXT_URL_OFFSET (4*72)
60 #define TEXT_DESC_OFFSET (5*72)
62 typedef unsigned char uch;
63 typedef unsigned short ush;
64 typedef unsigned long ulg;
66 typedef struct _mainprog_info {
83 int filter; /* command-line-filter flag, not PNG row filter! */
97 /* prototypes for public functions in writepng.c */
99 void writepng_version_info(void);
101 int writepng_init(mainprog_info *mainprog_ptr);
103 int writepng_encode_image(mainprog_info *mainprog_ptr);
105 int writepng_encode_row(mainprog_info *mainprog_ptr);
107 int writepng_encode_finish(mainprog_info *mainprog_ptr);
109 void writepng_cleanup(mainprog_info *mainprog_ptr);