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