2 * "$Id: image-private.h 6274 2007-02-13 21:05:28Z mike $"
4 * Private image library definitions for the Common UNIX Printing
7 * Copyright 1993-2006 by Easy Software Products.
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
16 * Attn: CUPS Licensing Information
17 * Easy Software Products
18 * 44141 Airport View Drive, Suite 204
19 * Hollywood, Maryland 20636 USA
21 * Voice: (301) 373-9600
22 * EMail: cups-info@cups.org
23 * WWW: http://www.cups.org
25 * This file is subject to the Apple OS-Developed Software exception.
28 #ifndef _CUPS_IMAGE_PRIVATE_H_
29 # define _CUPS_IMAGE_PRIVATE_H_
32 * Include necessary headers...
37 # include <cups/cups.h>
38 # include <cups/debug.h>
39 # include <cups/string.h>
51 # define CUPS_IMAGE_MAX_WIDTH 0x07ffffff
52 /* 2^27-1 to allow for 15-channel data */
53 # define CUPS_IMAGE_MAX_HEIGHT 0x7fffffff
56 # define CUPS_TILE_SIZE 256 /* 256x256 pixel tiles */
57 # define CUPS_TILE_MINIMUM 10 /* Minimum number of tiles */
61 * min/max/abs macros...
65 # define max(a,b) ((a) > (b) ? (a) : (b))
68 # define min(a,b) ((a) < (b) ? (a) : (b))
71 # define abs(a) ((a) < 0 ? -(a) : (a))
76 * Types and structures...
79 typedef enum cups_iztype_e
/**** Image zoom type ****/
81 CUPS_IZOOM_FAST
, /* Use nearest-neighbor sampling */
82 CUPS_IZOOM_NORMAL
, /* Use bilinear interpolation */
83 CUPS_IZOOM_BEST
/* Use bicubic interpolation */
88 typedef struct cups_itile_s
/**** Image tile ****/
90 int dirty
; /* True if tile is dirty */
91 long pos
; /* Position of tile on disk (-1 if not written) */
92 struct cups_ic_s
*ic
; /* Pixel data */
95 typedef struct cups_ic_s
/**** Image tile cache ****/
97 struct cups_ic_s
*prev
, /* Previous tile in cache */
98 *next
; /* Next tile in cache */
99 cups_itile_t
*tile
; /* Tile this is attached to */
100 cups_ib_t
*pixels
; /* Pixel data */
103 struct cups_image_s
/**** Image file data ****/
105 cups_icspace_t colorspace
; /* Colorspace of image */
106 unsigned xsize
, /* Width of image in pixels */
107 ysize
, /* Height of image in pixels */
108 xppi
, /* X resolution in pixels-per-inch */
109 yppi
, /* Y resolution in pixels-per-inch */
110 num_ics
, /* Number of cached tiles */
111 max_ics
; /* Maximum number of cached tiles */
112 cups_itile_t
**tiles
; /* Tiles in image */
113 cups_ic_t
*first
, /* First cached tile in image */
114 *last
; /* Last cached tile in image */
115 FILE *cachefile
; /* Tile cache file */
116 char cachename
[256]; /* Tile cache filename */
119 struct cups_izoom_s
/**** Image zoom data ****/
121 cups_image_t
*img
; /* Image to zoom */
122 cups_iztype_t type
; /* Type of zooming */
123 unsigned xorig
, /* X origin */
124 yorig
, /* Y origin */
125 width
, /* Width of input area */
126 height
, /* Height of input area */
127 depth
, /* Number of bytes per pixel */
128 rotated
, /* Non-zero if image needs to be rotated */
129 xsize
, /* Width of output image */
130 ysize
, /* Height of output image */
131 xmax
, /* Maximum input image X position */
132 ymax
, /* Maximum input image Y position */
133 xmod
, /* Threshold for Bresenheim rounding */
135 int xstep
, /* Amount to step for each pixel along X */
137 instep
, /* Amount to step pixel pointer along X */
139 ystep
, /* Amount to step for each pixel along Y */
141 row
; /* Current row */
142 cups_ib_t
*rows
[2], /* Horizontally scaled pixel data */
143 *in
; /* Unscaled input pixel data */
151 extern int _cupsImagePutCol(cups_image_t
*img
, int x
, int y
,
152 int height
, const cups_ib_t
*pixels
);
153 extern int _cupsImagePutRow(cups_image_t
*img
, int x
, int y
,
154 int width
, const cups_ib_t
*pixels
);
155 extern int _cupsImageReadBMP(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 _cupsImageReadFPX(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 _cupsImageReadGIF(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 _cupsImageReadJPEG(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 _cupsImageReadPIX(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 _cupsImageReadPNG(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 _cupsImageReadPNM(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 _cupsImageReadPhotoCD(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 _cupsImageReadSGI(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 int _cupsImageReadSunRaster(cups_image_t
*img
, FILE *fp
,
201 cups_icspace_t primary
,
202 cups_icspace_t secondary
,
203 int saturation
, int hue
,
204 const cups_ib_t
*lut
);
205 extern int _cupsImageReadTIFF(cups_image_t
*img
, FILE *fp
,
206 cups_icspace_t primary
,
207 cups_icspace_t secondary
,
208 int saturation
, int hue
,
209 const cups_ib_t
*lut
);
210 extern void _cupsImageZoomDelete(cups_izoom_t
*z
);
211 extern void _cupsImageZoomFill(cups_izoom_t
*z
, int iy
);
212 extern cups_izoom_t
*_cupsImageZoomNew(cups_image_t
*img
, int xc0
, int yc0
,
213 int xc1
, int yc1
, int xsize
,
214 int ysize
, int rotated
,
217 extern int _cupsRasterExecPS(cups_page_header2_t
*h
,
220 extern void _cupsRasterAddError(const char *f
, ...);
221 extern void _cupsRasterClearError(void);
223 #endif /* !_CUPS_IMAGE_PRIVATE_H_ */
226 * End of "$Id: image-private.h 6274 2007-02-13 21:05:28Z mike $".