2 * "$Id: image-private.h 6649 2007-07-11 21:46:42Z mike $"
4 * Private image library definitions for the Common UNIX Printing
7 * Copyright 2007 by Apple Inc.
8 * Copyright 1993-2006 by Easy Software Products.
10 * These coded instructions, statements, and computer programs are the
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/".
16 * This file is subject to the Apple OS-Developed Software exception.
19 #ifndef _CUPS_IMAGE_PRIVATE_H_
20 # define _CUPS_IMAGE_PRIVATE_H_
23 * Include necessary headers...
28 # include <cups/cups.h>
29 # include <cups/debug.h>
30 # include <cups/string.h>
42 # define CUPS_IMAGE_MAX_WIDTH 0x07ffffff
43 /* 2^27-1 to allow for 15-channel data */
44 # define CUPS_IMAGE_MAX_HEIGHT 0x7fffffff
47 # define CUPS_TILE_SIZE 256 /* 256x256 pixel tiles */
48 # define CUPS_TILE_MINIMUM 10 /* Minimum number of tiles */
52 * min/max/abs macros...
56 # define max(a,b) ((a) > (b) ? (a) : (b))
59 # define min(a,b) ((a) < (b) ? (a) : (b))
62 # define abs(a) ((a) < 0 ? -(a) : (a))
67 * Types and structures...
70 typedef enum cups_iztype_e
/**** Image zoom type ****/
72 CUPS_IZOOM_FAST
, /* Use nearest-neighbor sampling */
73 CUPS_IZOOM_NORMAL
, /* Use bilinear interpolation */
74 CUPS_IZOOM_BEST
/* Use bicubic interpolation */
79 typedef struct cups_itile_s
/**** Image tile ****/
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 */
86 typedef struct cups_ic_s
/**** Image tile cache ****/
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 */
94 struct cups_image_s
/**** Image file data ****/
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 */
110 struct cups_izoom_s
/**** Image zoom data ****/
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 */
126 int xstep
, /* Amount to step for each pixel along X */
128 instep
, /* Amount to step pixel pointer along X */
130 ystep
, /* Amount to step for each pixel along Y */
132 row
; /* Current row */
133 cups_ib_t
*rows
[2], /* Horizontally scaled pixel data */
134 *in
; /* Unscaled input pixel data */
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
);
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
,
208 extern int _cupsRasterExecPS(cups_page_header2_t
*h
,
211 extern void _cupsRasterAddError(const char *f
, ...);
212 extern void _cupsRasterClearError(void);
214 #endif /* !_CUPS_IMAGE_PRIVATE_H_ */
217 * End of "$Id: image-private.h 6649 2007-07-11 21:46:42Z mike $".