Header | cups/driver.h |
---|---|
Library | -lcupsdriver |
See Also | Programming: Introduction to CUPS Programming |
The driver API provides common dithering, color conversion, and utility functions for CUPS drivers.
Delete a color separation.
void cupsCMYKDelete (
cups_cmyk_t *cmyk
);
Do a black separation...
void cupsCMYKDoBlack (
const cups_cmyk_t *cmyk,
const unsigned char *input,
short *output,
int num_pixels
);
Do a CMYK separation...
void cupsCMYKDoCMYK (
const cups_cmyk_t *cmyk,
const unsigned char *input,
short *output,
int num_pixels
);
Do a grayscale separation...
void cupsCMYKDoGray (
const cups_cmyk_t *cmyk,
const unsigned char *input,
short *output,
int num_pixels
);
Do an sRGB separation...
void cupsCMYKDoRGB (
const cups_cmyk_t *cmyk,
const unsigned char *input,
short *output,
int num_pixels
);
Load a CMYK color profile from PPD attributes.
cups_cmyk_t *cupsCMYKLoad (
ppd_file_t *ppd,
const char *colormodel,
const char *media,
const char *resolution
);
CMYK color separation
Create a new CMYK color separation.
cups_cmyk_t *cupsCMYKNew (
int num_channels
);
New CMYK separation or NULL
Set the transition range for CMY to black.
void cupsCMYKSetBlack (
cups_cmyk_t *cmyk,
float lower,
float upper
);
Set a color transform curve using points.
void cupsCMYKSetCurve (
cups_cmyk_t *cmyk,
int channel,
int num_xypoints,
const float *xypoints
);
Set a color transform curve using gamma and density.
void cupsCMYKSetGamma (
cups_cmyk_t *cmyk,
int channel,
float gamval,
float density
);
Set the limit on the amount of ink.
void cupsCMYKSetInkLimit (
cups_cmyk_t *cmyk,
float limit
);
Set light/dark ink transforms.
void cupsCMYKSetLtDk (
cups_cmyk_t *cmyk,
int channel,
float light,
float dark
);
Check to see if all bytes are zero.
int cupsCheckBytes (
const unsigned char *bytes,
int length
);
1 if they match
Check to see if all bytes match the given value.
int cupsCheckValue (
const unsigned char *bytes,
int length,
const unsigned char value
);
1 if they match
Free a dithering buffer.
void cupsDitherDelete (
cups_dither_t *d
);
Returns 0 on success, -1 on failure.
Dither a line of pixels...
void cupsDitherLine (
cups_dither_t *d,
const cups_lut_t *lut,
const short *data,
int num_channels,
unsigned char *p
);
Create an error-diffusion dithering buffer.
cups_dither_t *cupsDitherNew (
int width
);
New state array
Find a PPD attribute based on the colormodel, media, and resolution.
ppd_attr_t *cupsFindAttr (
ppd_file_t *ppd,
const char *name,
const char *colormodel,
const char *media,
const char *resolution,
char *spec,
int specsize
);
Matching attribute or NULL
Free the memory used by a lookup table.
void cupsLutDelete (
cups_lut_t *lut
);
Load a LUT from a PPD file.
cups_lut_t *cupsLutLoad (
ppd_file_t *ppd,
const char *colormodel,
const char *media,
const char *resolution,
const char *ink
);
New lookup table
Make a lookup table from a list of pixel values.
cups_lut_t *cupsLutNew (
int num_values,
const float *values
);
New lookup table
Returns a pointer to the lookup table on success, NULL on failure.
Pack pixels horizontally...
void cupsPackHorizontal (
const unsigned char *ipixels,
unsigned char *obytes,
int width,
const unsigned char clearto,
const int step
);
Pack 2-bit pixels horizontally...
void cupsPackHorizontal2 (
const unsigned char *ipixels,
unsigned char *obytes,
int width,
const int step
);
Pack pixels horizontally by bit...
void cupsPackHorizontalBit (
const unsigned char *ipixels,
unsigned char *obytes,
int width,
const unsigned char clearto,
const unsigned char bit
);
Pack pixels vertically...
void cupsPackVertical (
const unsigned char *ipixels,
unsigned char *obytes,
int width,
const unsigned char bit,
const int step
);
Delete a color separation.
void cupsRGBDelete (
cups_rgb_t *rgbptr
);
Do a grayscale separation...
void cupsRGBDoGray (
cups_rgb_t *rgbptr,
const unsigned char *input,
unsigned char *output,
int num_pixels
);
Do a RGB separation...
void cupsRGBDoRGB (
cups_rgb_t *rgbptr,
const unsigned char *input,
unsigned char *output,
int num_pixels
);
Load a RGB color profile from a PPD file.
cups_rgb_t *cupsRGBLoad (
ppd_file_t *ppd,
const char *colormodel,
const char *media,
const char *resolution
);
New color profile
Create a new RGB color separation.
cups_rgb_t *cupsRGBNew (
int num_samples,
cups_sample_t *samples,
int cube_size,
int num_channels
);
New color separation or NULL
Simple CMYK lookup table
typedef struct cups_cmyk_s cups_cmyk_t;
Dithering State
typedef struct cups_dither_s cups_dither_t;
Lookup Table for Dithering
typedef struct cups_lut_s cups_lut_t;
Color separation lookup table
typedef struct cups_rgb_s cups_rgb_t;
Color sample point
typedef struct cups_sample_s cups_sample_t;
Simple CMYK lookup table
struct cups_cmyk_s {
unsigned char black_lut[256];
short *channels[CUPS_MAX_CHAN];
unsigned char color_lut[256];
int ink_limit;
int num_channels;
};
Dithering State
struct cups_dither_s {
int errors[96];
int row;
int width;
};
Lookup Table for Dithering
struct cups_lut_s {
int error;
short intensity;
short pixel;
};
Color separation lookup table
struct cups_rgb_s {
unsigned char black[CUPS_MAX_RGB];
int cache_init;
unsigned char ****colors;
int cube_index[256];
int cube_mult[256];
int cube_size;
int num_channels;
unsigned char white[CUPS_MAX_RGB];
};
Color sample point
struct cups_sample_s {
unsigned char colors[CUPS_MAX_RGB];
unsigned char rgb[3];
};
sRGB gamma lookup table (inverted)
extern const unsigned char cups_scmy_lut[256];
sRGB gamma lookup table
extern const unsigned char cups_srgb_lut[256];