]>
Commit | Line | Data |
---|---|---|
ef416fc2 | 1 | /* |
75bd9771 | 2 | * "$Id: image-private.h 7473 2008-04-21 17:51:58Z mike $" |
ef416fc2 | 3 | * |
4 | * Private image library definitions for the Common UNIX Printing | |
5 | * System (CUPS). | |
6 | * | |
3dfe78b3 | 7 | * Copyright 2007-2008 by Apple Inc. |
b423cd4c | 8 | * Copyright 1993-2006 by Easy Software Products. |
ef416fc2 | 9 | * |
10 | * These coded instructions, statements, and computer programs are the | |
bc44d920 | 11 | * property of Apple Inc. and are protected by Federal copyright |
12 | * law. Distribution and use rights are outlined in the file "LICENSE.txt" | |
13 | * which should have been included with this file. If this file is | |
14 | * file is missing or damaged, see the license at "http://www.cups.org/". | |
ef416fc2 | 15 | * |
16 | * This file is subject to the Apple OS-Developed Software exception. | |
17 | */ | |
18 | ||
19 | #ifndef _CUPS_IMAGE_PRIVATE_H_ | |
20 | # define _CUPS_IMAGE_PRIVATE_H_ | |
21 | ||
22 | /* | |
23 | * Include necessary headers... | |
24 | */ | |
25 | ||
26 | # include "image.h" | |
27 | # include <cups/cups.h> | |
28 | # include <cups/debug.h> | |
29 | # include <cups/string.h> | |
30 | # include <stdlib.h> | |
31 | # include <string.h> | |
32 | # include <unistd.h> | |
33 | # include <errno.h> | |
34 | # include <math.h> | |
35 | ||
36 | ||
37 | /* | |
38 | * Constants... | |
39 | */ | |
40 | ||
41 | # define CUPS_IMAGE_MAX_WIDTH 0x07ffffff | |
42 | /* 2^27-1 to allow for 15-channel data */ | |
43 | # define CUPS_IMAGE_MAX_HEIGHT 0x7fffffff | |
44 | /* 2^31-1 */ | |
45 | ||
46 | # define CUPS_TILE_SIZE 256 /* 256x256 pixel tiles */ | |
47 | # define CUPS_TILE_MINIMUM 10 /* Minimum number of tiles */ | |
48 | ||
49 | ||
50 | /* | |
51 | * min/max/abs macros... | |
52 | */ | |
53 | ||
54 | # ifndef max | |
55 | # define max(a,b) ((a) > (b) ? (a) : (b)) | |
56 | # endif /* !max */ | |
57 | # ifndef min | |
58 | # define min(a,b) ((a) < (b) ? (a) : (b)) | |
59 | # endif /* !min */ | |
60 | # ifndef abs | |
61 | # define abs(a) ((a) < 0 ? -(a) : (a)) | |
62 | # endif /* !abs */ | |
63 | ||
64 | ||
65 | /* | |
66 | * Types and structures... | |
67 | */ | |
68 | ||
b423cd4c | 69 | typedef enum cups_iztype_e /**** Image zoom type ****/ |
70 | { | |
71 | CUPS_IZOOM_FAST, /* Use nearest-neighbor sampling */ | |
72 | CUPS_IZOOM_NORMAL, /* Use bilinear interpolation */ | |
73 | CUPS_IZOOM_BEST /* Use bicubic interpolation */ | |
74 | } cups_iztype_t; | |
75 | ||
ef416fc2 | 76 | struct cups_ic_s; |
77 | ||
78 | typedef struct cups_itile_s /**** Image tile ****/ | |
79 | { | |
80 | int dirty; /* True if tile is dirty */ | |
3dfe78b3 | 81 | off_t pos; /* Position of tile on disk (-1 if not written) */ |
ef416fc2 | 82 | struct cups_ic_s *ic; /* Pixel data */ |
83 | } cups_itile_t; | |
84 | ||
85 | typedef struct cups_ic_s /**** Image tile cache ****/ | |
86 | { | |
87 | struct cups_ic_s *prev, /* Previous tile in cache */ | |
88 | *next; /* Next tile in cache */ | |
89 | cups_itile_t *tile; /* Tile this is attached to */ | |
90 | cups_ib_t *pixels; /* Pixel data */ | |
91 | } cups_ic_t; | |
92 | ||
93 | struct cups_image_s /**** Image file data ****/ | |
94 | { | |
95 | cups_icspace_t colorspace; /* Colorspace of image */ | |
96 | unsigned xsize, /* Width of image in pixels */ | |
97 | ysize, /* Height of image in pixels */ | |
98 | xppi, /* X resolution in pixels-per-inch */ | |
99 | yppi, /* Y resolution in pixels-per-inch */ | |
100 | num_ics, /* Number of cached tiles */ | |
101 | max_ics; /* Maximum number of cached tiles */ | |
102 | cups_itile_t **tiles; /* Tiles in image */ | |
103 | cups_ic_t *first, /* First cached tile in image */ | |
104 | *last; /* Last cached tile in image */ | |
3dfe78b3 | 105 | int cachefile; /* Tile cache file */ |
ef416fc2 | 106 | char cachename[256]; /* Tile cache filename */ |
107 | }; | |
108 | ||
109 | struct cups_izoom_s /**** Image zoom data ****/ | |
110 | { | |
111 | cups_image_t *img; /* Image to zoom */ | |
112 | cups_iztype_t type; /* Type of zooming */ | |
113 | unsigned xorig, /* X origin */ | |
114 | yorig, /* Y origin */ | |
115 | width, /* Width of input area */ | |
116 | height, /* Height of input area */ | |
117 | depth, /* Number of bytes per pixel */ | |
118 | rotated, /* Non-zero if image needs to be rotated */ | |
119 | xsize, /* Width of output image */ | |
120 | ysize, /* Height of output image */ | |
121 | xmax, /* Maximum input image X position */ | |
122 | ymax, /* Maximum input image Y position */ | |
123 | xmod, /* Threshold for Bresenheim rounding */ | |
124 | ymod; /* ... */ | |
125 | int xstep, /* Amount to step for each pixel along X */ | |
126 | xincr, | |
127 | instep, /* Amount to step pixel pointer along X */ | |
128 | inincr, | |
129 | ystep, /* Amount to step for each pixel along Y */ | |
130 | yincr, | |
131 | row; /* Current row */ | |
132 | cups_ib_t *rows[2], /* Horizontally scaled pixel data */ | |
133 | *in; /* Unscaled input pixel data */ | |
134 | }; | |
135 | ||
136 | ||
137 | /* | |
138 | * Prototypes... | |
139 | */ | |
140 | ||
141 | extern int _cupsImagePutCol(cups_image_t *img, int x, int y, | |
142 | int height, const cups_ib_t *pixels); | |
143 | extern int _cupsImagePutRow(cups_image_t *img, int x, int y, | |
144 | int width, const cups_ib_t *pixels); | |
145 | extern int _cupsImageReadBMP(cups_image_t *img, FILE *fp, | |
146 | cups_icspace_t primary, | |
147 | cups_icspace_t secondary, | |
148 | int saturation, int hue, | |
149 | const cups_ib_t *lut); | |
150 | extern int _cupsImageReadFPX(cups_image_t *img, FILE *fp, | |
151 | cups_icspace_t primary, | |
152 | cups_icspace_t secondary, | |
153 | int saturation, int hue, | |
154 | const cups_ib_t *lut); | |
155 | extern int _cupsImageReadGIF(cups_image_t *img, FILE *fp, | |
156 | cups_icspace_t primary, | |
157 | cups_icspace_t secondary, | |
158 | int saturation, int hue, | |
159 | const cups_ib_t *lut); | |
160 | extern int _cupsImageReadJPEG(cups_image_t *img, FILE *fp, | |
161 | cups_icspace_t primary, | |
162 | cups_icspace_t secondary, | |
163 | int saturation, int hue, | |
164 | const cups_ib_t *lut); | |
165 | extern int _cupsImageReadPIX(cups_image_t *img, FILE *fp, | |
166 | cups_icspace_t primary, | |
167 | cups_icspace_t secondary, | |
168 | int saturation, int hue, | |
169 | const cups_ib_t *lut); | |
170 | extern int _cupsImageReadPNG(cups_image_t *img, FILE *fp, | |
171 | cups_icspace_t primary, | |
172 | cups_icspace_t secondary, | |
173 | int saturation, int hue, | |
174 | const cups_ib_t *lut); | |
175 | extern int _cupsImageReadPNM(cups_image_t *img, FILE *fp, | |
176 | cups_icspace_t primary, | |
177 | cups_icspace_t secondary, | |
178 | int saturation, int hue, | |
179 | const cups_ib_t *lut); | |
180 | extern int _cupsImageReadPhotoCD(cups_image_t *img, FILE *fp, | |
181 | cups_icspace_t primary, | |
182 | cups_icspace_t secondary, | |
183 | int saturation, int hue, | |
184 | const cups_ib_t *lut); | |
185 | extern int _cupsImageReadSGI(cups_image_t *img, FILE *fp, | |
186 | cups_icspace_t primary, | |
187 | cups_icspace_t secondary, | |
188 | int saturation, int hue, | |
189 | const cups_ib_t *lut); | |
190 | extern int _cupsImageReadSunRaster(cups_image_t *img, FILE *fp, | |
191 | cups_icspace_t primary, | |
192 | cups_icspace_t secondary, | |
193 | int saturation, int hue, | |
194 | const cups_ib_t *lut); | |
195 | extern int _cupsImageReadTIFF(cups_image_t *img, FILE *fp, | |
196 | cups_icspace_t primary, | |
197 | cups_icspace_t secondary, | |
198 | int saturation, int hue, | |
199 | const cups_ib_t *lut); | |
b423cd4c | 200 | extern void _cupsImageZoomDelete(cups_izoom_t *z); |
201 | extern void _cupsImageZoomFill(cups_izoom_t *z, int iy); | |
202 | extern cups_izoom_t *_cupsImageZoomNew(cups_image_t *img, int xc0, int yc0, | |
203 | int xc1, int yc1, int xsize, | |
204 | int ysize, int rotated, | |
205 | cups_iztype_t type); | |
ef416fc2 | 206 | |
b86bc4cf | 207 | extern int _cupsRasterExecPS(cups_page_header2_t *h, |
208 | int *preferred_bits, | |
209 | const char *code); | |
f7deaa1a | 210 | extern void _cupsRasterAddError(const char *f, ...); |
211 | extern void _cupsRasterClearError(void); | |
ef416fc2 | 212 | |
213 | #endif /* !_CUPS_IMAGE_PRIVATE_H_ */ | |
214 | ||
215 | /* | |
75bd9771 | 216 | * End of "$Id: image-private.h 7473 2008-04-21 17:51:58Z mike $". |
ef416fc2 | 217 | */ |