]> git.ipfire.org Git - thirdparty/cups.git/blame - filter/image-private.h
Import changes from CUPS 1.4.1 (r8801)
[thirdparty/cups.git] / filter / image-private.h
CommitLineData
ef416fc2 1/*
75bd9771 2 * "$Id: image-private.h 7473 2008-04-21 17:51:58Z mike $"
ef416fc2 3 *
4 * Private image library definitions for the Common UNIX Printing
5 * System (CUPS).
6 *
3dfe78b3 7 * Copyright 2007-2008 by Apple Inc.
b423cd4c 8 * Copyright 1993-2006 by Easy Software Products.
ef416fc2 9 *
10 * These coded instructions, statements, and computer programs are the
bc44d920 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/".
ef416fc2 15 *
16 * This file is subject to the Apple OS-Developed Software exception.
17 */
18
19#ifndef _CUPS_IMAGE_PRIVATE_H_
20# define _CUPS_IMAGE_PRIVATE_H_
21
22/*
23 * Include necessary headers...
24 */
25
26# include "image.h"
27# include <cups/cups.h>
28# include <cups/debug.h>
29# include <cups/string.h>
30# include <stdlib.h>
31# include <string.h>
7a0cbd5e
MS
32# ifdef WIN32
33# include <io.h>
34# else
35# include <unistd.h>
36# endif /* WIN32 */
ef416fc2 37# include <errno.h>
38# include <math.h>
39
40
41/*
42 * Constants...
43 */
44
45# define CUPS_IMAGE_MAX_WIDTH 0x07ffffff
46 /* 2^27-1 to allow for 15-channel data */
e07d4801
MS
47# define CUPS_IMAGE_MAX_HEIGHT 0x3fffffff
48 /* 2^30-1 */
ef416fc2 49
50# define CUPS_TILE_SIZE 256 /* 256x256 pixel tiles */
51# define CUPS_TILE_MINIMUM 10 /* Minimum number of tiles */
52
53
54/*
55 * min/max/abs macros...
56 */
57
58# ifndef max
59# define max(a,b) ((a) > (b) ? (a) : (b))
60# endif /* !max */
61# ifndef min
62# define min(a,b) ((a) < (b) ? (a) : (b))
63# endif /* !min */
64# ifndef abs
65# define abs(a) ((a) < 0 ? -(a) : (a))
66# endif /* !abs */
67
68
69/*
70 * Types and structures...
71 */
72
b423cd4c 73typedef enum cups_iztype_e /**** Image zoom type ****/
74{
75 CUPS_IZOOM_FAST, /* Use nearest-neighbor sampling */
76 CUPS_IZOOM_NORMAL, /* Use bilinear interpolation */
77 CUPS_IZOOM_BEST /* Use bicubic interpolation */
78} cups_iztype_t;
79
ef416fc2 80struct cups_ic_s;
81
82typedef struct cups_itile_s /**** Image tile ****/
83{
84 int dirty; /* True if tile is dirty */
3dfe78b3 85 off_t pos; /* Position of tile on disk (-1 if not written) */
ef416fc2 86 struct cups_ic_s *ic; /* Pixel data */
87} cups_itile_t;
88
89typedef struct cups_ic_s /**** Image tile cache ****/
90{
91 struct cups_ic_s *prev, /* Previous tile in cache */
92 *next; /* Next tile in cache */
93 cups_itile_t *tile; /* Tile this is attached to */
94 cups_ib_t *pixels; /* Pixel data */
95} cups_ic_t;
96
97struct cups_image_s /**** Image file data ****/
98{
99 cups_icspace_t colorspace; /* Colorspace of image */
100 unsigned xsize, /* Width of image in pixels */
101 ysize, /* Height of image in pixels */
102 xppi, /* X resolution in pixels-per-inch */
103 yppi, /* Y resolution in pixels-per-inch */
104 num_ics, /* Number of cached tiles */
105 max_ics; /* Maximum number of cached tiles */
106 cups_itile_t **tiles; /* Tiles in image */
107 cups_ic_t *first, /* First cached tile in image */
108 *last; /* Last cached tile in image */
3dfe78b3 109 int cachefile; /* Tile cache file */
ef416fc2 110 char cachename[256]; /* Tile cache filename */
111};
112
113struct cups_izoom_s /**** Image zoom data ****/
114{
115 cups_image_t *img; /* Image to zoom */
116 cups_iztype_t type; /* Type of zooming */
117 unsigned xorig, /* X origin */
118 yorig, /* Y origin */
119 width, /* Width of input area */
120 height, /* Height of input area */
121 depth, /* Number of bytes per pixel */
122 rotated, /* Non-zero if image needs to be rotated */
123 xsize, /* Width of output image */
124 ysize, /* Height of output image */
125 xmax, /* Maximum input image X position */
126 ymax, /* Maximum input image Y position */
127 xmod, /* Threshold for Bresenheim rounding */
128 ymod; /* ... */
129 int xstep, /* Amount to step for each pixel along X */
130 xincr,
131 instep, /* Amount to step pixel pointer along X */
132 inincr,
133 ystep, /* Amount to step for each pixel along Y */
134 yincr,
135 row; /* Current row */
136 cups_ib_t *rows[2], /* Horizontally scaled pixel data */
137 *in; /* Unscaled input pixel data */
138};
139
140
141/*
142 * Prototypes...
143 */
144
145extern int _cupsImagePutCol(cups_image_t *img, int x, int y,
146 int height, const cups_ib_t *pixels);
147extern int _cupsImagePutRow(cups_image_t *img, int x, int y,
148 int width, const cups_ib_t *pixels);
149extern int _cupsImageReadBMP(cups_image_t *img, FILE *fp,
150 cups_icspace_t primary,
151 cups_icspace_t secondary,
152 int saturation, int hue,
153 const cups_ib_t *lut);
154extern int _cupsImageReadFPX(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);
159extern int _cupsImageReadGIF(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);
164extern int _cupsImageReadJPEG(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);
169extern int _cupsImageReadPIX(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);
174extern int _cupsImageReadPNG(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);
179extern int _cupsImageReadPNM(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);
184extern int _cupsImageReadPhotoCD(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);
189extern int _cupsImageReadSGI(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);
194extern int _cupsImageReadSunRaster(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);
199extern int _cupsImageReadTIFF(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);
b423cd4c 204extern void _cupsImageZoomDelete(cups_izoom_t *z);
205extern void _cupsImageZoomFill(cups_izoom_t *z, int iy);
206extern cups_izoom_t *_cupsImageZoomNew(cups_image_t *img, int xc0, int yc0,
207 int xc1, int yc1, int xsize,
208 int ysize, int rotated,
209 cups_iztype_t type);
ef416fc2 210
b86bc4cf 211extern int _cupsRasterExecPS(cups_page_header2_t *h,
212 int *preferred_bits,
213 const char *code);
f7deaa1a 214extern void _cupsRasterAddError(const char *f, ...);
215extern void _cupsRasterClearError(void);
ef416fc2 216
217#endif /* !_CUPS_IMAGE_PRIVATE_H_ */
218
219/*
75bd9771 220 * End of "$Id: image-private.h 7473 2008-04-21 17:51:58Z mike $".
ef416fc2 221 */