Debian Codegraph @

src/rwpng.h

raw ◀ ▶
Source reconstructed at patch state 0 of 1 — not the installed (fully patched) source.
1 Debian patch touch this file
1 /*---------------------------------------------------------------------------
2
3 pngquant: RGBA -> RGBA-palette quantization program rwpng.h
4
5 ---------------------------------------------------------------------------
6
7 Copyright (c) 1998-2000 Greg Roelofs. All rights reserved.
8
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
12 this software.
13
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:
17
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:
25
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.
29
30 ---------------------------------------------------------------------------*/
31
32 #ifndef TRUE
33 # define TRUE 1
34 # define FALSE 0
35 #endif
36
37 #ifndef MAX
38 # define MAX(a,b) ((a) > (b)? (a) : (b))
39 # define MIN(a,b) ((a) < (b)? (a) : (b))
40 #endif
41
42 #ifdef DEBUG
43 # define Trace(x) {fprintf x ; fflush(stderr); fflush(stdout);}
44 #else
45 # define Trace(x) ;
46 #endif
47
48 #define TEXT_TITLE 1
49 #define TEXT_AUTHOR 1
50 #define TEXT_DESC 1
51 #define TEXT_COPY 1
52 #define TEXT_EMAIL 1
53 #define TEXT_URL 1
54
55
56 typedef unsigned char uch;
57 typedef unsigned short ush;
58 typedef unsigned long ulg;
59
60 typedef struct _rwpng_color_struct {
61 png_byte red;
62 png_byte green;
63 png_byte blue;
64 } rwpng_color;
65
66 typedef struct _mainprog_info {
67 double gamma;
68 ulg width; /* read/write */
69 ulg height; /* read/write */
70 ulg rowbytes; /* read */
71 void *png_ptr; /* read/write */
72 void *info_ptr; /* read/write */
73 rwpng_color palette[256]; /* write */
74 uch trans[256]; /* write */
75 uch *rgba_data; /* read */
76 uch *indexed_data; /* write */
77 uch **row_pointers; /* read/write */
78 jmp_buf jmpbuf; /* read/write */
79 int interlaced; /* read/write */
80 int channels; /* read (currently not used) */
81 int sample_depth; /* write */
82 int num_palette; /* write */
83 int num_trans; /* write */
84 int retval; /* read/write */
85 int have_bg;
86 uch bg_red;
87 uch bg_green;
88 uch bg_blue;
89 int have_time;
90 time_t modtime;
91 int have_text;
92 char *title;
93 char *author;
94 char *copyright;
95 char *desc;
96 char *email;
97 char *url;
98 } mainprog_info;
99
100
101 /* prototypes for public functions in rwpng.c */
102
103 void rwpng_version_info(void);
104
105 int rwpng_read_image(FILE *infile, mainprog_info *mainprog_ptr);
106
107 int rwpng_write_image_init(FILE *outfile, mainprog_info *mainprog_ptr);
108
109 int rwpng_write_image_whole(mainprog_info *mainprog_ptr);
110
111 int rwpng_write_image_row(mainprog_info *mainprog_ptr);
112
113 int rwpng_write_image_finish(mainprog_info *mainprog_ptr);