#ifndef _CUPS_DRIVER_H_
# define _CUPS_DRIVER_H_
# ifdef __cplusplus
extern "C" {
# endif
# include <stdio.h>
# include <stdlib.h>
# include <time.h>
# include <math.h>
# if defined(WIN32) || defined(__EMX__)
# include <io.h>
# else
# include <unistd.h>
# include <fcntl.h>
# endif
# include <cups/cups.h>
# include <cups/raster.h>
# ifndef min
# define min(a,b) ((a) < (b) ? (a) : (b))
# define max(a,b) ((a) > (b) ? (a) : (b))
# endif
#define CUPS_MAX_CHAN 15
#define CUPS_MAX_LUT 4095
#define CUPS_MAX_RGB 4
typedef struct cups_lut_s
{
short intensity;
short pixel;
int error;
} cups_lut_t;
typedef struct cups_dither_s
{
int width;
int row;
int errors[96];
} cups_dither_t;
typedef struct cups_sample_s
{
unsigned char rgb[3];
unsigned char colors[CUPS_MAX_RGB];
} cups_sample_t;
typedef struct cups_rgb_s
{
int cube_size;
int num_channels;
unsigned char ****colors;
int cube_index[256];
int cube_mult[256];
int cache_init;
unsigned char black[CUPS_MAX_RGB];
unsigned char white[CUPS_MAX_RGB];
} cups_rgb_t;
typedef struct cups_cmyk_s
{
unsigned char black_lut[256];
unsigned char color_lut[256];
int ink_limit;
int num_channels;
short *channels[CUPS_MAX_CHAN];
} cups_cmyk_t;
extern const unsigned char
cups_srgb_lut[256];
extern const unsigned char
cups_scmy_lut[256];
extern ppd_attr_t *cupsFindAttr(ppd_file_t *ppd, const char *name,
const char *colormodel,
const char *media,
const char *resolution,
char *spec, int specsize);
extern int cupsCheckBytes(const unsigned char *, int);
extern int cupsCheckValue(const unsigned char *, int,
const unsigned char);
extern void cupsDitherLine(cups_dither_t *d, const cups_lut_t *lut,
const short *data, int num_channels,
unsigned char *p);
extern cups_dither_t *cupsDitherNew(int width);
extern void cupsDitherDelete(cups_dither_t *);
extern cups_lut_t *cupsLutNew(int num_vals, const float *vals);
extern void cupsLutDelete(cups_lut_t *lut);
extern cups_lut_t *cupsLutLoad(ppd_file_t *ppd,
const char *colormodel,
const char *media,
const char *resolution,
const char *ink);
extern void cupsPackHorizontal(const unsigned char *,
unsigned char *, int,
const unsigned char, const int);
extern void cupsPackHorizontal2(const unsigned char *,
unsigned char *, int, const int);
extern void cupsPackHorizontalBit(const unsigned char *,
unsigned char *, int,
const unsigned char,
const unsigned char);
extern void cupsPackVertical(const unsigned char *, unsigned char *,
int, const unsigned char, const int);
extern void cupsRGBDelete(cups_rgb_t *rgb);
extern void cupsRGBDoGray(cups_rgb_t *rgb,
const unsigned char *input,
unsigned char *output, int num_pixels);
extern void cupsRGBDoRGB(cups_rgb_t *rgb,
const unsigned char *input,
unsigned char *output, int num_pixels);
extern cups_rgb_t *cupsRGBLoad(ppd_file_t *ppd,
const char *colormodel,
const char *media,
const char *resolution);
extern cups_rgb_t *cupsRGBNew(int num_samples, cups_sample_t *samples,
int cube_size, int num_channels);
extern cups_cmyk_t *cupsCMYKNew(int num_channels);
extern void cupsCMYKDelete(cups_cmyk_t *cmyk);
extern void cupsCMYKDoBlack(const cups_cmyk_t *cmyk,
const unsigned char *input,
short *output, int num_pixels);
extern void cupsCMYKDoCMYK(const cups_cmyk_t *cmyk,
const unsigned char *input,
short *output, int num_pixels);
extern void cupsCMYKDoGray(const cups_cmyk_t *cmyk,
const unsigned char *input,
short *output, int num_pixels);
extern void cupsCMYKDoRGB(const cups_cmyk_t *cmyk,
const unsigned char *input,
short *output, int num_pixels);
extern cups_cmyk_t *cupsCMYKLoad(ppd_file_t *ppd,
const char *colormodel,
const char *media,
const char *resolution);
extern void cupsCMYKSetBlack(cups_cmyk_t *cmyk,
float lower, float upper);
extern void cupsCMYKSetCurve(cups_cmyk_t *cmyk, int channel,
int num_xypoints,
const float *xypoints);
extern void cupsCMYKSetGamma(cups_cmyk_t *cmyk, int channel,
float gamval, float density);
extern void cupsCMYKSetInkLimit(cups_cmyk_t *cmyk, float limit);
extern void cupsCMYKSetLtDk(cups_cmyk_t *cmyk, int channel,
float light, float dark);
# define cupsWritePrintData(s,n) fwrite((s), 1, (n), stdout)
# ifdef __cplusplus
}
# endif
#endif