]> git.ipfire.org Git - thirdparty/cups.git/blame - filter/image-private.h
Load cups into easysw/current.
[thirdparty/cups.git] / filter / image-private.h
CommitLineData
ef416fc2 1/*
f7deaa1a 2 * "$Id: image-private.h 6274 2007-02-13 21:05:28Z mike $"
ef416fc2 3 *
4 * Private image library definitions for the Common UNIX Printing
5 * System (CUPS).
6 *
b423cd4c 7 * Copyright 1993-2006 by Easy Software Products.
ef416fc2 8 *
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
14 * at:
15 *
16 * Attn: CUPS Licensing Information
17 * Easy Software Products
18 * 44141 Airport View Drive, Suite 204
19 * Hollywood, Maryland 20636 USA
20 *
21 * Voice: (301) 373-9600
22 * EMail: cups-info@cups.org
23 * WWW: http://www.cups.org
24 *
25 * This file is subject to the Apple OS-Developed Software exception.
26 */
27
28#ifndef _CUPS_IMAGE_PRIVATE_H_
29# define _CUPS_IMAGE_PRIVATE_H_
30
31/*
32 * Include necessary headers...
33 */
34
35# include "image.h"
b86bc4cf 36# include "raster.h"
ef416fc2 37# include <cups/cups.h>
38# include <cups/debug.h>
39# include <cups/string.h>
40# include <stdlib.h>
41# include <string.h>
42# include <unistd.h>
43# include <errno.h>
44# include <math.h>
45
46
47/*
48 * Constants...
49 */
50
51# define CUPS_IMAGE_MAX_WIDTH 0x07ffffff
52 /* 2^27-1 to allow for 15-channel data */
53# define CUPS_IMAGE_MAX_HEIGHT 0x7fffffff
54 /* 2^31-1 */
55
56# define CUPS_TILE_SIZE 256 /* 256x256 pixel tiles */
57# define CUPS_TILE_MINIMUM 10 /* Minimum number of tiles */
58
59
60/*
61 * min/max/abs macros...
62 */
63
64# ifndef max
65# define max(a,b) ((a) > (b) ? (a) : (b))
66# endif /* !max */
67# ifndef min
68# define min(a,b) ((a) < (b) ? (a) : (b))
69# endif /* !min */
70# ifndef abs
71# define abs(a) ((a) < 0 ? -(a) : (a))
72# endif /* !abs */
73
74
75/*
76 * Types and structures...
77 */
78
b423cd4c 79typedef enum cups_iztype_e /**** Image zoom type ****/
80{
81 CUPS_IZOOM_FAST, /* Use nearest-neighbor sampling */
82 CUPS_IZOOM_NORMAL, /* Use bilinear interpolation */
83 CUPS_IZOOM_BEST /* Use bicubic interpolation */
84} cups_iztype_t;
85
ef416fc2 86struct cups_ic_s;
87
88typedef struct cups_itile_s /**** Image tile ****/
89{
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 */
93} cups_itile_t;
94
95typedef struct cups_ic_s /**** Image tile cache ****/
96{
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 */
101} cups_ic_t;
102
103struct cups_image_s /**** Image file data ****/
104{
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 */
117};
118
119struct cups_izoom_s /**** Image zoom data ****/
120{
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 */
134 ymod; /* ... */
135 int xstep, /* Amount to step for each pixel along X */
136 xincr,
137 instep, /* Amount to step pixel pointer along X */
138 inincr,
139 ystep, /* Amount to step for each pixel along Y */
140 yincr,
141 row; /* Current row */
142 cups_ib_t *rows[2], /* Horizontally scaled pixel data */
143 *in; /* Unscaled input pixel data */
144};
145
146
147/*
148 * Prototypes...
149 */
150
151extern int _cupsImagePutCol(cups_image_t *img, int x, int y,
152 int height, const cups_ib_t *pixels);
153extern int _cupsImagePutRow(cups_image_t *img, int x, int y,
154 int width, const cups_ib_t *pixels);
155extern 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);
160extern 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);
165extern 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);
170extern 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);
175extern 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);
180extern 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);
185extern 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);
190extern 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);
195extern 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);
200extern 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);
205extern 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);
b423cd4c 210extern void _cupsImageZoomDelete(cups_izoom_t *z);
211extern void _cupsImageZoomFill(cups_izoom_t *z, int iy);
212extern cups_izoom_t *_cupsImageZoomNew(cups_image_t *img, int xc0, int yc0,
213 int xc1, int yc1, int xsize,
214 int ysize, int rotated,
215 cups_iztype_t type);
ef416fc2 216
b86bc4cf 217extern int _cupsRasterExecPS(cups_page_header2_t *h,
218 int *preferred_bits,
219 const char *code);
f7deaa1a 220extern void _cupsRasterAddError(const char *f, ...);
221extern void _cupsRasterClearError(void);
ef416fc2 222
223#endif /* !_CUPS_IMAGE_PRIVATE_H_ */
224
225/*
f7deaa1a 226 * End of "$Id: image-private.h 6274 2007-02-13 21:05:28Z mike $".
ef416fc2 227 */