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