]> git.ipfire.org Git - thirdparty/cups.git/blame - filter/image.h
Y2k copyright changes.
[thirdparty/cups.git] / filter / image.h
CommitLineData
1aac2486 1/*
71fe22b7 2 * "$Id: image.h,v 1.9 2000/01/04 13:45:46 mike Exp $"
1aac2486 3 *
ed19bd98 4 * Image library definitions for the Common UNIX Printing System (CUPS).
1aac2486 5 *
71fe22b7 6 * Copyright 1993-2000 by Easy Software Products.
1aac2486 7 *
ed19bd98 8 * These coded instructions, statements, and computer programs are the
9 * property of Easy Software Products and are protected by Federal
10 * copyright law. Distribution and use rights are outlined in the file
11 * "LICENSE.txt" which should have been included with this file. If this
12 * file is missing or damaged please contact Easy Software Products
13 * at:
1aac2486 14 *
ed19bd98 15 * Attn: CUPS Licensing Information
16 * Easy Software Products
17 * 44141 Airport View Drive, Suite 204
18 * Hollywood, Maryland 20636-3111 USA
4141606b 19 *
ed19bd98 20 * Voice: (301) 373-9603
21 * EMail: cups-info@cups.org
22 * WWW: http://www.cups.org
1aac2486 23 */
24
25#ifndef _IMAGE_H_
f30e3dce 26# define _IMAGE_H_
1aac2486 27
28/*
29 * Include necessary headers...
30 */
31
ed19bd98 32# include <stdio.h>
33# include <stdlib.h>
34# include <string.h>
35# include <errno.h>
36# include <config.h>
f30e3dce 37
38
39/*
40 * Colorspaces...
41 */
42
43# define IMAGE_CMYK -4 /* Cyan, magenta, yellow, and black */
44# define IMAGE_CMY -3 /* Cyan, magenta, and yellow */
45# define IMAGE_BLACK -1 /* Black */
46# define IMAGE_WHITE 1 /* White (luminance) */
47# define IMAGE_RGB 3 /* Red, green, and blue */
48
49/*
50 * Tile definitions...
51 */
52
53# define TILE_SIZE 256 /* 256x256 pixel tiles */
277e0d6b 54# define TILE_MINIMUM 10 /* Minimum number of tiles */
55
56/*
57 * min/max/abs macros...
58 */
59
60#ifndef max
61# define max(a,b) ((a) > (b) ? (a) : (b))
62#endif /* !max */
63#ifndef min
64# define min(a,b) ((a) < (b) ? (a) : (b))
65#endif /* !min */
66#ifndef abs
67# define abs(a) ((a) < 0 ? -(a) : (a))
68#endif /* !abs */
69
f30e3dce 70
71/*
72 * Image byte type...
73 */
74
75typedef unsigned char ib_t;
1aac2486 76
f30e3dce 77/*
78 * Tile cache structure...
79 */
80
81typedef struct ic_str
82{
83 struct ic_str *prev, /* Previous tile in cache */
84 *next; /* Next tile in cache */
85 void *tile; /* Tile this is attached to */
86 ib_t *pixels; /* Pixel data */
87} ic_t;
1aac2486 88
89/*
f30e3dce 90 * Tile structure...
1aac2486 91 */
92
93typedef struct
94{
ed19bd98 95 int dirty; /* True if tile is dirty */
96 long pos; /* Position of tile on disk (-1 if not written) */
f30e3dce 97 ic_t *ic; /* Pixel data */
98} itile_t;
99
100/*
101 * Image structure...
102 */
1aac2486 103
f30e3dce 104typedef struct
105{
ed19bd98 106 int colorspace; /* Colorspace of image */
107 unsigned xsize, /* Width of image in pixels */
f30e3dce 108 ysize, /* Height of image in pixels */
109 xppi, /* X resolution in pixels-per-inch */
110 yppi, /* Y resolution in pixels-per-inch */
111 num_ics, /* Number of cached tiles */
112 max_ics; /* Maximum number of cached tiles */
113 itile_t **tiles; /* Tiles in image */
114 ic_t *first, /* First cached tile in image */
115 *last; /* Last cached tile in image */
116 FILE *cachefile; /* Tile cache file */
117 char cachename[256]; /* Tile cache filename */
118} image_t;
1aac2486 119
120/*
121 * Image row zooming structure...
122 */
123
124typedef struct
125{
f30e3dce 126 image_t *img; /* Image to zoom */
ed19bd98 127 unsigned xorig,
f30e3dce 128 yorig,
129 width, /* Width of input area */
130 height, /* Height of input area */
131 depth, /* Number of bytes per pixel */
132 rotated, /* Non-zero if image needs to be rotated */
133 xsize, /* Width of output image */
134 ysize, /* Height of output image */
135 xmax, /* Maximum input image X position */
136 ymax, /* Maximum input image Y position */
137 xmod, /* Threshold for Bresenheim rounding */
ed19bd98 138 ymod; /* ... */
139 int xstep, /* Amount to step for each pixel along X */
f30e3dce 140 xincr,
141 instep, /* Amount to step pixel pointer along X */
142 inincr,
143 ystep, /* Amount to step for each pixel along Y */
144 yincr,
145 row; /* Current row */
146 ib_t *rows[2], /* Horizontally scaled pixel data */
147 *in; /* Unscaled input pixel data */
148} izoom_t;
149
150
151/*
152 * Basic image functions...
153 */
154
155extern image_t *ImageOpen(char *filename, int primary, int secondary,
081ab09a 156 int saturation, int hue, const ib_t *lut);
f30e3dce 157extern void ImageClose(image_t *img);
158extern void ImageSetMaxTiles(image_t *img, int max_tiles);
5b6dc462 159extern void ImageSetProfile(float d, float g, float matrix[3][3]);
f30e3dce 160
161#define ImageGetDepth(img) ((img)->colorspace < 0 ? -(img)->colorspace : (img)->colorspace)
162extern int ImageGetCol(image_t *img, int x, int y, int height, ib_t *pixels);
163extern int ImageGetRow(image_t *img, int x, int y, int width, ib_t *pixels);
081ab09a 164extern int ImagePutCol(image_t *img, int x, int y, int height, const ib_t *pixels);
165extern int ImagePutRow(image_t *img, int x, int y, int width, const ib_t *pixels);
f30e3dce 166
167/*
168 * File formats...
169 */
170
171extern int ImageReadGIF(image_t *img, FILE *fp, int primary, int secondary,
081ab09a 172 int saturation, int hue, const ib_t *lut);
f30e3dce 173extern int ImageReadJPEG(image_t *img, FILE *fp, int primary, int secondary,
081ab09a 174 int saturation, int hue, const ib_t *lut);
f30e3dce 175extern int ImageReadPNG(image_t *img, FILE *fp, int primary, int secondary,
081ab09a 176 int saturation, int hue, const ib_t *lut);
f30e3dce 177extern int ImageReadPNM(image_t *img, FILE *fp, int primary, int secondary,
081ab09a 178 int saturation, int hue, const ib_t *lut);
f30e3dce 179extern int ImageReadPhotoCD(image_t *img, FILE *fp, int primary,
081ab09a 180 int secondary, int saturation, int hue,
181 const ib_t *lut);
f30e3dce 182extern int ImageReadSGI(image_t *img, FILE *fp, int primary, int secondary,
081ab09a 183 int saturation, int hue, const ib_t *lut);
f30e3dce 184extern int ImageReadSunRaster(image_t *img, FILE *fp, int primary,
081ab09a 185 int secondary, int saturation, int hue,
186 const ib_t *lut);
f30e3dce 187extern int ImageReadTIFF(image_t *img, FILE *fp, int primary, int secondary,
081ab09a 188 int saturation, int hue, const ib_t *lut);
f30e3dce 189
190/*
191 * Colorspace conversions...
192 */
193
081ab09a 194extern void ImageWhiteToWhite(const ib_t *in, ib_t *out, int count);
195extern void ImageWhiteToRGB(const ib_t *in, ib_t *out, int count);
196extern void ImageWhiteToBlack(const ib_t *in, ib_t *out, int count);
197extern void ImageWhiteToCMY(const ib_t *in, ib_t *out, int count);
198extern void ImageWhiteToCMYK(const ib_t *in, ib_t *out, int count);
f30e3dce 199
081ab09a 200extern void ImageRGBToWhite(const ib_t *in, ib_t *out, int count);
201extern void ImageRGBToRGB(const ib_t *in, ib_t *out, int count);
202extern void ImageRGBToBlack(const ib_t *in, ib_t *out, int count);
203extern void ImageRGBToCMY(const ib_t *in, ib_t *out, int count);
204extern void ImageRGBToCMYK(const ib_t *in, ib_t *out, int count);
f30e3dce 205
206extern void ImageRGBAdjust(ib_t *pixels, int count, int saturation, int hue);
1aac2486 207
081ab09a 208extern void ImageLut(ib_t *pixels, int count, const ib_t *lut);
1aac2486 209
210/*
f30e3dce 211 * Image scaling operations...
1aac2486 212 */
213
f30e3dce 214extern izoom_t *ImageZoomAlloc(image_t *img, int x0, int y0, int x1, int y1,
215 int xsize, int ysize, int rotated);
6de9968b 216extern void ImageZoomFill(izoom_t *z, int iy);
217extern void ImageZoomQFill(izoom_t *z, int iy);
f30e3dce 218extern void ImageZoomFree(izoom_t *z);
1aac2486 219
1aac2486 220
221#endif /* !_IMAGE_H_ */
222
223/*
71fe22b7 224 * End of "$Id: image.h,v 1.9 2000/01/04 13:45:46 mike Exp $".
1aac2486 225 */