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