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