]>
git.ipfire.org Git - thirdparty/cups.git/blob - driver/driver.h
4 * Printer driver utilities header file for CUPS.
6 * Copyright 2007 by Apple Inc.
7 * Copyright 1993-2005 by Easy Software Products.
9 * These coded instructions, statements, and computer programs are the
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/".
16 #ifndef _CUPS_DRIVER_H_
17 # define _CUPS_DRIVER_H_
21 # endif /* __cplusplus */
24 * Include necessary headers...
32 # if defined(WIN32) || defined(__EMX__)
37 # endif /* WIN32 || __EMX__ */
39 # include <cups/cups.h>
40 # include <cups/raster.h>
48 # define min(a,b) ((a) < (b) ? (a) : (b))
49 # define max(a,b) ((a) > (b) ? (a) : (b))
57 #define CUPS_MAX_CHAN 15 /* Maximum number of color components */
58 #define CUPS_MAX_LUT 4095 /* Maximum LUT value */
59 #define CUPS_MAX_RGB 4 /* Maximum number of sRGB components */
63 * Types/structures for the various routines.
66 typedef struct cups_lut_s
/**** Lookup Table for Dithering ****/
68 short intensity
; /* Adjusted intensity */
69 short pixel
; /* Output pixel value */
70 int error
; /* Error from desired value */
73 typedef struct cups_dither_s
/**** Dithering State ****/
75 int width
; /* Width of buffer */
76 int row
; /* Current row */
77 int errors
[96]; /* Error values */
80 typedef struct cups_sample_s
/**** Color sample point ****/
82 unsigned char rgb
[3]; /* sRGB values */
83 unsigned char colors
[CUPS_MAX_RGB
]; /* Color values */
86 typedef struct cups_rgb_s
/**** Color separation lookup table ****/
88 int cube_size
; /* Size of color cube (2-N) on a side */
89 int num_channels
; /* Number of colors per sample */
90 unsigned char ****colors
; /* 4-D array of sample values */
91 int cube_index
[256]; /* Index into cube for a given sRGB value */
92 int cube_mult
[256]; /* Multiplier value for a given sRGB value */
93 int cache_init
; /* Are cached values initialized? */
94 unsigned char black
[CUPS_MAX_RGB
]; /* Cached black (sRGB = 0,0,0) */
95 unsigned char white
[CUPS_MAX_RGB
]; /* Cached white (sRGB = 255,255,255) */
98 typedef struct cups_cmyk_s
/**** Simple CMYK lookup table ****/
100 unsigned char black_lut
[256]; /* Black generation LUT */
101 unsigned char color_lut
[256]; /* Color removal LUT */
102 int ink_limit
; /* Ink limit */
103 int num_channels
; /* Number of components */
104 short *channels
[CUPS_MAX_CHAN
];
113 extern const unsigned char
115 /* sRGB gamma lookup table */
116 extern const unsigned char
118 /* sRGB gamma lookup table (inverted) */
126 * Attribute function...
129 extern ppd_attr_t
*cupsFindAttr(ppd_file_t
*ppd
, const char *name
,
130 const char *colormodel
,
132 const char *resolution
,
133 char *spec
, int specsize
);
136 * Byte checking functions...
139 extern int cupsCheckBytes(const unsigned char *, int);
140 extern int cupsCheckValue(const unsigned char *, int,
141 const unsigned char);
144 * Dithering functions...
147 extern void cupsDitherLine(cups_dither_t
*d
, const cups_lut_t
*lut
,
148 const short *data
, int num_channels
,
150 extern cups_dither_t
*cupsDitherNew(int width
);
151 extern void cupsDitherDelete(cups_dither_t
*);
154 * Lookup table functions for dithering...
157 extern cups_lut_t
*cupsLutNew(int num_vals
, const float *vals
);
158 extern void cupsLutDelete(cups_lut_t
*lut
);
159 extern cups_lut_t
*cupsLutLoad(ppd_file_t
*ppd
,
160 const char *colormodel
,
162 const char *resolution
,
167 * Bit packing functions...
170 extern void cupsPackHorizontal(const unsigned char *,
171 unsigned char *, int,
172 const unsigned char, const int);
173 extern void cupsPackHorizontal2(const unsigned char *,
174 unsigned char *, int, const int);
175 extern void cupsPackHorizontalBit(const unsigned char *,
176 unsigned char *, int,
178 const unsigned char);
179 extern void cupsPackVertical(const unsigned char *, unsigned char *,
180 int, const unsigned char, const int);
183 * Color separation functions...
186 extern void cupsRGBDelete(cups_rgb_t
*rgb
);
187 extern void cupsRGBDoGray(cups_rgb_t
*rgb
,
188 const unsigned char *input
,
189 unsigned char *output
, int num_pixels
);
190 extern void cupsRGBDoRGB(cups_rgb_t
*rgb
,
191 const unsigned char *input
,
192 unsigned char *output
, int num_pixels
);
193 extern cups_rgb_t
*cupsRGBLoad(ppd_file_t
*ppd
,
194 const char *colormodel
,
196 const char *resolution
);
197 extern cups_rgb_t
*cupsRGBNew(int num_samples
, cups_sample_t
*samples
,
198 int cube_size
, int num_channels
);
201 * CMYK separation functions...
204 extern cups_cmyk_t
*cupsCMYKNew(int num_channels
);
205 extern void cupsCMYKDelete(cups_cmyk_t
*cmyk
);
206 extern void cupsCMYKDoBlack(const cups_cmyk_t
*cmyk
,
207 const unsigned char *input
,
208 short *output
, int num_pixels
);
209 extern void cupsCMYKDoCMYK(const cups_cmyk_t
*cmyk
,
210 const unsigned char *input
,
211 short *output
, int num_pixels
);
212 extern void cupsCMYKDoGray(const cups_cmyk_t
*cmyk
,
213 const unsigned char *input
,
214 short *output
, int num_pixels
);
215 extern void cupsCMYKDoRGB(const cups_cmyk_t
*cmyk
,
216 const unsigned char *input
,
217 short *output
, int num_pixels
);
218 extern cups_cmyk_t
*cupsCMYKLoad(ppd_file_t
*ppd
,
219 const char *colormodel
,
221 const char *resolution
);
222 extern void cupsCMYKSetBlack(cups_cmyk_t
*cmyk
,
223 float lower
, float upper
);
224 extern void cupsCMYKSetCurve(cups_cmyk_t
*cmyk
, int channel
,
226 const float *xypoints
);
227 extern void cupsCMYKSetGamma(cups_cmyk_t
*cmyk
, int channel
,
228 float gamval
, float density
);
229 extern void cupsCMYKSetInkLimit(cups_cmyk_t
*cmyk
, float limit
);
230 extern void cupsCMYKSetLtDk(cups_cmyk_t
*cmyk
, int channel
,
231 float light
, float dark
);
235 * Convenience macro for writing print data...
238 # define cupsWritePrintData(s,n) fwrite((s), 1, (n), stdout)
242 # endif /* __cplusplus */
244 #endif /* !_CUPS_DRIVER_H_ */