]> git.ipfire.org Git - thirdparty/cups.git/blob - filter/image-private.h
Load cups into easysw/current.
[thirdparty/cups.git] / filter / image-private.h
1 /*
2 * "$Id: image-private.h 5191 2006-02-27 02:47:56Z mike $"
3 *
4 * Private image library definitions for the Common UNIX Printing
5 * System (CUPS).
6 *
7 * Copyright 1993-2006 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 typedef enum cups_iztype_e /**** Image zoom type ****/
79 {
80 CUPS_IZOOM_FAST, /* Use nearest-neighbor sampling */
81 CUPS_IZOOM_NORMAL, /* Use bilinear interpolation */
82 CUPS_IZOOM_BEST /* Use bicubic interpolation */
83 } cups_iztype_t;
84
85 struct cups_ic_s;
86
87 typedef struct cups_itile_s /**** Image tile ****/
88 {
89 int dirty; /* True if tile is dirty */
90 long pos; /* Position of tile on disk (-1 if not written) */
91 struct cups_ic_s *ic; /* Pixel data */
92 } cups_itile_t;
93
94 typedef struct cups_ic_s /**** Image tile cache ****/
95 {
96 struct cups_ic_s *prev, /* Previous tile in cache */
97 *next; /* Next tile in cache */
98 cups_itile_t *tile; /* Tile this is attached to */
99 cups_ib_t *pixels; /* Pixel data */
100 } cups_ic_t;
101
102 struct cups_image_s /**** Image file data ****/
103 {
104 cups_icspace_t colorspace; /* Colorspace of image */
105 unsigned xsize, /* Width of image in pixels */
106 ysize, /* Height of image in pixels */
107 xppi, /* X resolution in pixels-per-inch */
108 yppi, /* Y resolution in pixels-per-inch */
109 num_ics, /* Number of cached tiles */
110 max_ics; /* Maximum number of cached tiles */
111 cups_itile_t **tiles; /* Tiles in image */
112 cups_ic_t *first, /* First cached tile in image */
113 *last; /* Last cached tile in image */
114 FILE *cachefile; /* Tile cache file */
115 char cachename[256]; /* Tile cache filename */
116 };
117
118 struct cups_izoom_s /**** Image zoom data ****/
119 {
120 cups_image_t *img; /* Image to zoom */
121 cups_iztype_t type; /* Type of zooming */
122 unsigned xorig, /* X origin */
123 yorig, /* Y origin */
124 width, /* Width of input area */
125 height, /* Height of input area */
126 depth, /* Number of bytes per pixel */
127 rotated, /* Non-zero if image needs to be rotated */
128 xsize, /* Width of output image */
129 ysize, /* Height of output image */
130 xmax, /* Maximum input image X position */
131 ymax, /* Maximum input image Y position */
132 xmod, /* Threshold for Bresenheim rounding */
133 ymod; /* ... */
134 int xstep, /* Amount to step for each pixel along X */
135 xincr,
136 instep, /* Amount to step pixel pointer along X */
137 inincr,
138 ystep, /* Amount to step for each pixel along Y */
139 yincr,
140 row; /* Current row */
141 cups_ib_t *rows[2], /* Horizontally scaled pixel data */
142 *in; /* Unscaled input pixel data */
143 };
144
145
146 /*
147 * Prototypes...
148 */
149
150 extern int _cupsImagePutCol(cups_image_t *img, int x, int y,
151 int height, const cups_ib_t *pixels);
152 extern int _cupsImagePutRow(cups_image_t *img, int x, int y,
153 int width, const cups_ib_t *pixels);
154 extern int _cupsImageReadBMP(cups_image_t *img, FILE *fp,
155 cups_icspace_t primary,
156 cups_icspace_t secondary,
157 int saturation, int hue,
158 const cups_ib_t *lut);
159 extern int _cupsImageReadFPX(cups_image_t *img, FILE *fp,
160 cups_icspace_t primary,
161 cups_icspace_t secondary,
162 int saturation, int hue,
163 const cups_ib_t *lut);
164 extern int _cupsImageReadGIF(cups_image_t *img, FILE *fp,
165 cups_icspace_t primary,
166 cups_icspace_t secondary,
167 int saturation, int hue,
168 const cups_ib_t *lut);
169 extern int _cupsImageReadJPEG(cups_image_t *img, FILE *fp,
170 cups_icspace_t primary,
171 cups_icspace_t secondary,
172 int saturation, int hue,
173 const cups_ib_t *lut);
174 extern int _cupsImageReadPIX(cups_image_t *img, FILE *fp,
175 cups_icspace_t primary,
176 cups_icspace_t secondary,
177 int saturation, int hue,
178 const cups_ib_t *lut);
179 extern int _cupsImageReadPNG(cups_image_t *img, FILE *fp,
180 cups_icspace_t primary,
181 cups_icspace_t secondary,
182 int saturation, int hue,
183 const cups_ib_t *lut);
184 extern int _cupsImageReadPNM(cups_image_t *img, FILE *fp,
185 cups_icspace_t primary,
186 cups_icspace_t secondary,
187 int saturation, int hue,
188 const cups_ib_t *lut);
189 extern int _cupsImageReadPhotoCD(cups_image_t *img, FILE *fp,
190 cups_icspace_t primary,
191 cups_icspace_t secondary,
192 int saturation, int hue,
193 const cups_ib_t *lut);
194 extern int _cupsImageReadSGI(cups_image_t *img, FILE *fp,
195 cups_icspace_t primary,
196 cups_icspace_t secondary,
197 int saturation, int hue,
198 const cups_ib_t *lut);
199 extern int _cupsImageReadSunRaster(cups_image_t *img, FILE *fp,
200 cups_icspace_t primary,
201 cups_icspace_t secondary,
202 int saturation, int hue,
203 const cups_ib_t *lut);
204 extern int _cupsImageReadTIFF(cups_image_t *img, FILE *fp,
205 cups_icspace_t primary,
206 cups_icspace_t secondary,
207 int saturation, int hue,
208 const cups_ib_t *lut);
209 extern void _cupsImageZoomDelete(cups_izoom_t *z);
210 extern void _cupsImageZoomFill(cups_izoom_t *z, int iy);
211 extern cups_izoom_t *_cupsImageZoomNew(cups_image_t *img, int xc0, int yc0,
212 int xc1, int yc1, int xsize,
213 int ysize, int rotated,
214 cups_iztype_t type);
215
216
217 #endif /* !_CUPS_IMAGE_PRIVATE_H_ */
218
219 /*
220 * End of "$Id: image-private.h 5191 2006-02-27 02:47:56Z mike $".
221 */