2 * "$Id: image-private.h 7473 2008-04-21 17:51:58Z mike $"
4 * Private image library definitions for the Common UNIX Printing
7 * Copyright 2007-2008 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...
27 # include <cups/cups.h>
28 # include <cups/debug.h>
29 # include <cups/string.h>
41 # define CUPS_IMAGE_MAX_WIDTH 0x07ffffff
42 /* 2^27-1 to allow for 15-channel data */
43 # define CUPS_IMAGE_MAX_HEIGHT 0x7fffffff
46 # define CUPS_TILE_SIZE 256 /* 256x256 pixel tiles */
47 # define CUPS_TILE_MINIMUM 10 /* Minimum number of tiles */
51 * min/max/abs macros...
55 # define max(a,b) ((a) > (b) ? (a) : (b))
58 # define min(a,b) ((a) < (b) ? (a) : (b))
61 # define abs(a) ((a) < 0 ? -(a) : (a))
66 * Types and structures...
69 typedef enum cups_iztype_e
/**** Image zoom type ****/
71 CUPS_IZOOM_FAST
, /* Use nearest-neighbor sampling */
72 CUPS_IZOOM_NORMAL
, /* Use bilinear interpolation */
73 CUPS_IZOOM_BEST
/* Use bicubic interpolation */
78 typedef struct cups_itile_s
/**** Image tile ****/
80 int dirty
; /* True if tile is dirty */
81 off_t pos
; /* Position of tile on disk (-1 if not written) */
82 struct cups_ic_s
*ic
; /* Pixel data */
85 typedef struct cups_ic_s
/**** Image tile cache ****/
87 struct cups_ic_s
*prev
, /* Previous tile in cache */
88 *next
; /* Next tile in cache */
89 cups_itile_t
*tile
; /* Tile this is attached to */
90 cups_ib_t
*pixels
; /* Pixel data */
93 struct cups_image_s
/**** Image file data ****/
95 cups_icspace_t colorspace
; /* Colorspace of image */
96 unsigned xsize
, /* Width of image in pixels */
97 ysize
, /* Height of image in pixels */
98 xppi
, /* X resolution in pixels-per-inch */
99 yppi
, /* Y resolution in pixels-per-inch */
100 num_ics
, /* Number of cached tiles */
101 max_ics
; /* Maximum number of cached tiles */
102 cups_itile_t
**tiles
; /* Tiles in image */
103 cups_ic_t
*first
, /* First cached tile in image */
104 *last
; /* Last cached tile in image */
105 int cachefile
; /* Tile cache file */
106 char cachename
[256]; /* Tile cache filename */
109 struct cups_izoom_s
/**** Image zoom data ****/
111 cups_image_t
*img
; /* Image to zoom */
112 cups_iztype_t type
; /* Type of zooming */
113 unsigned xorig
, /* X origin */
114 yorig
, /* Y origin */
115 width
, /* Width of input area */
116 height
, /* Height of input area */
117 depth
, /* Number of bytes per pixel */
118 rotated
, /* Non-zero if image needs to be rotated */
119 xsize
, /* Width of output image */
120 ysize
, /* Height of output image */
121 xmax
, /* Maximum input image X position */
122 ymax
, /* Maximum input image Y position */
123 xmod
, /* Threshold for Bresenheim rounding */
125 int xstep
, /* Amount to step for each pixel along X */
127 instep
, /* Amount to step pixel pointer along X */
129 ystep
, /* Amount to step for each pixel along Y */
131 row
; /* Current row */
132 cups_ib_t
*rows
[2], /* Horizontally scaled pixel data */
133 *in
; /* Unscaled input pixel data */
141 extern int _cupsImagePutCol(cups_image_t
*img
, int x
, int y
,
142 int height
, const cups_ib_t
*pixels
);
143 extern int _cupsImagePutRow(cups_image_t
*img
, int x
, int y
,
144 int width
, const cups_ib_t
*pixels
);
145 extern int _cupsImageReadBMP(cups_image_t
*img
, FILE *fp
,
146 cups_icspace_t primary
,
147 cups_icspace_t secondary
,
148 int saturation
, int hue
,
149 const cups_ib_t
*lut
);
150 extern int _cupsImageReadFPX(cups_image_t
*img
, FILE *fp
,
151 cups_icspace_t primary
,
152 cups_icspace_t secondary
,
153 int saturation
, int hue
,
154 const cups_ib_t
*lut
);
155 extern int _cupsImageReadGIF(cups_image_t
*img
, FILE *fp
,
156 cups_icspace_t primary
,
157 cups_icspace_t secondary
,
158 int saturation
, int hue
,
159 const cups_ib_t
*lut
);
160 extern int _cupsImageReadJPEG(cups_image_t
*img
, FILE *fp
,
161 cups_icspace_t primary
,
162 cups_icspace_t secondary
,
163 int saturation
, int hue
,
164 const cups_ib_t
*lut
);
165 extern int _cupsImageReadPIX(cups_image_t
*img
, FILE *fp
,
166 cups_icspace_t primary
,
167 cups_icspace_t secondary
,
168 int saturation
, int hue
,
169 const cups_ib_t
*lut
);
170 extern int _cupsImageReadPNG(cups_image_t
*img
, FILE *fp
,
171 cups_icspace_t primary
,
172 cups_icspace_t secondary
,
173 int saturation
, int hue
,
174 const cups_ib_t
*lut
);
175 extern int _cupsImageReadPNM(cups_image_t
*img
, FILE *fp
,
176 cups_icspace_t primary
,
177 cups_icspace_t secondary
,
178 int saturation
, int hue
,
179 const cups_ib_t
*lut
);
180 extern int _cupsImageReadPhotoCD(cups_image_t
*img
, FILE *fp
,
181 cups_icspace_t primary
,
182 cups_icspace_t secondary
,
183 int saturation
, int hue
,
184 const cups_ib_t
*lut
);
185 extern int _cupsImageReadSGI(cups_image_t
*img
, FILE *fp
,
186 cups_icspace_t primary
,
187 cups_icspace_t secondary
,
188 int saturation
, int hue
,
189 const cups_ib_t
*lut
);
190 extern int _cupsImageReadSunRaster(cups_image_t
*img
, FILE *fp
,
191 cups_icspace_t primary
,
192 cups_icspace_t secondary
,
193 int saturation
, int hue
,
194 const cups_ib_t
*lut
);
195 extern int _cupsImageReadTIFF(cups_image_t
*img
, FILE *fp
,
196 cups_icspace_t primary
,
197 cups_icspace_t secondary
,
198 int saturation
, int hue
,
199 const cups_ib_t
*lut
);
200 extern void _cupsImageZoomDelete(cups_izoom_t
*z
);
201 extern void _cupsImageZoomFill(cups_izoom_t
*z
, int iy
);
202 extern cups_izoom_t
*_cupsImageZoomNew(cups_image_t
*img
, int xc0
, int yc0
,
203 int xc1
, int yc1
, int xsize
,
204 int ysize
, int rotated
,
207 extern int _cupsRasterExecPS(cups_page_header2_t
*h
,
210 extern void _cupsRasterAddError(const char *f
, ...);
211 extern void _cupsRasterClearError(void);
213 #endif /* !_CUPS_IMAGE_PRIVATE_H_ */
216 * End of "$Id: image-private.h 7473 2008-04-21 17:51:58Z mike $".