2 * "$Id: image-private.h 5191 2006-02-27 02:47:56Z 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...
36 # include <cups/cups.h>
37 # include <cups/debug.h>
38 # include <cups/string.h>
50 # define CUPS_IMAGE_MAX_WIDTH 0x07ffffff
51 /* 2^27-1 to allow for 15-channel data */
52 # define CUPS_IMAGE_MAX_HEIGHT 0x7fffffff
55 # define CUPS_TILE_SIZE 256 /* 256x256 pixel tiles */
56 # define CUPS_TILE_MINIMUM 10 /* Minimum number of tiles */
60 * min/max/abs macros...
64 # define max(a,b) ((a) > (b) ? (a) : (b))
67 # define min(a,b) ((a) < (b) ? (a) : (b))
70 # define abs(a) ((a) < 0 ? -(a) : (a))
75 * Types and structures...
78 typedef enum cups_iztype_e
/**** Image zoom type ****/
80 CUPS_IZOOM_FAST
, /* Use nearest-neighbor sampling */
81 CUPS_IZOOM_NORMAL
, /* Use bilinear interpolation */
82 CUPS_IZOOM_BEST
/* Use bicubic interpolation */
87 typedef struct cups_itile_s
/**** Image tile ****/
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 */
94 typedef struct cups_ic_s
/**** Image tile cache ****/
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 */
102 struct cups_image_s
/**** Image file data ****/
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 */
118 struct cups_izoom_s
/**** Image zoom data ****/
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 */
134 int xstep
, /* Amount to step for each pixel along X */
136 instep
, /* Amount to step pixel pointer along X */
138 ystep
, /* Amount to step for each pixel along Y */
140 row
; /* Current row */
141 cups_ib_t
*rows
[2], /* Horizontally scaled pixel data */
142 *in
; /* Unscaled input pixel data */
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
,
217 #endif /* !_CUPS_IMAGE_PRIVATE_H_ */
220 * End of "$Id: image-private.h 5191 2006-02-27 02:47:56Z mike $".