## Contents

- Functions
- Structures
- Types
- Variables

## Functions

- `cupsCMYKDelete()`
- `cupsCMYKDoBlack()`
- `cupsCMYKDoCMYK()`
- `cupsCMYKDoGray()`
- `cupsCMYKDoRGB()`
- `cupsCMYKLoad()`
- `cupsCMYKNew()`
- `cupsCMYKSetBlack()`
- `cupsCMYKSetCurve()`
- `cupsCMYKSetGamma()`
- `cupsCMYKSetInkLimit()`
- `cupsCMYKSetLtDk()`
- `cupsCheckBytes()`
- `cupsCheckValue()`
- `cupsDitherDelete()`
- `cupsDitherLine()`
- `cupsDitherNew()`
- `cupsFindAttr()`
- `cupsLutDelete()`
- `cupsLutLoad()`
- `cupsLutNew()`
- `cupsPackHorizontal()`
- `cupsPackHorizontal2()`
- `cupsPackHorizontalBit()`
- `cupsPackVertical()`
- `cupsRGBDelete()`
- `cupsRGBDoGray()`
- `cupsRGBDoRGB()`
- `cupsRGBLoad()`
- `cupsRGBNew()`

### cupsCMYKDelete()

#### Description

Delete a color separation.

#### Syntax

    void
    cupsCMYKDelete(
        cups_cmyk_t * cmyk);

#### Arguments

Name | Description
--- | ---
`cmyk` | Color separation

#### Returns

Nothing.

### cupsCMYKDoBlack()

#### Description

Do a black separation...

#### Syntax

    void
    cupsCMYKDoBlack(
        const cups_cmyk_t * cmyk,
        const unsigned char * input,
        short * output,
        int num_pixels);

#### Arguments

Name | Description
--- | ---
`cmyk` | Color separation
`input` | Input grayscale pixels
`output` | Output Device-N pixels
`num_pixels` | Number of pixels

#### Returns

Nothing.

### cupsCMYKDoCMYK()

#### Description

Do a CMYK separation...

#### Syntax

    void
    cupsCMYKDoCMYK(
        const cups_cmyk_t * cmyk,
        const unsigned char * input,
        short * output,
        int num_pixels);

#### Arguments

Name | Description
--- | ---
`cmyk` | Color separation
`input` | Input grayscale pixels
`output` | Output Device-N pixels
`num_pixels` | Number of pixels

#### Returns

Nothing.

### cupsCMYKDoGray()

#### Description

Do a grayscale separation...

#### Syntax

    void
    cupsCMYKDoGray(
        const cups_cmyk_t * cmyk,
        const unsigned char * input,
        short * output,
        int num_pixels);

#### Arguments

Name | Description
--- | ---
`cmyk` | Color separation
`input` | Input grayscale pixels
`output` | Output Device-N pixels
`num_pixels` | Number of pixels

#### Returns

Nothing.

### cupsCMYKDoRGB()

#### Description

Do an sRGB separation...

#### Syntax

    void
    cupsCMYKDoRGB(
        const cups_cmyk_t * cmyk,
        const unsigned char * input,
        short * output,
        int num_pixels);

#### Arguments

Name | Description
--- | ---
`cmyk` | Color separation
`input` | Input grayscale pixels
`output` | Output Device-N pixels
`num_pixels` | Number of pixels

#### Returns

Nothing.

### cupsCMYKLoad()

#### Description

Load a CMYK color profile from PPD attributes.

#### Syntax

    cups_cmyk_t *
    cupsCMYKLoad(
        ppd_file_t * ppd,
        const char * colormodel,
        const char * media,
        const char * resolution);

#### Arguments

Name | Description
--- | ---
`ppd` | PPD file
`colormodel` | ColorModel value
`media` | MediaType value
`resolution` | Resolution value

#### Returns

CMYK color separation

### cupsCMYKNew()

#### Description

Create a new CMYK color separation.

#### Syntax

    cups_cmyk_t *
    cupsCMYKNew(
        int num_channels);

#### Arguments

Name | Description
--- | ---
`num_channels` | Number of color components

#### Returns

New CMYK separation or NULL

### cupsCMYKSetBlack()

#### Description

Set the transition range for CMY to black.

#### Syntax

    void
    cupsCMYKSetBlack(
        cups_cmyk_t * cmyk,
        float lower,
        float upper);

#### Arguments

Name | Description
--- | ---
`cmyk` | CMYK color separation
`lower` | No black ink
`upper` | Only black ink

#### Returns

Nothing.

### cupsCMYKSetCurve()

#### Description

Set a color transform curve using points.

#### Syntax

    void
    cupsCMYKSetCurve(
        cups_cmyk_t * cmyk,
        int channel,
        int num_xypoints,
        const float * xypoints);

#### Arguments

Name | Description
--- | ---
`cmyk` | CMYK color separation
`channel` | Color channel
`num_xypoints` | Number of X,Y points
`xypoints` | X,Y points

#### Returns

Nothing.

### cupsCMYKSetGamma()

#### Description

Set a color transform curve using gamma and density.

#### Syntax

    void
    cupsCMYKSetGamma(
        cups_cmyk_t * cmyk,
        int channel,
        float gamval,
        float density);

#### Arguments

Name | Description
--- | ---
`cmyk` | CMYK color separation
`channel` | Ink channel
`gamval` | Gamma correction
`density` | Maximum density

#### Returns

Nothing.

### cupsCMYKSetInkLimit()

#### Description

Set the limit on the amount of ink.

#### Syntax

    void
    cupsCMYKSetInkLimit(
        cups_cmyk_t * cmyk,
        float limit);

#### Arguments

Name | Description
--- | ---
`cmyk` | CMYK color separation
`limit` | Limit of ink

#### Returns

Nothing.

### cupsCMYKSetLtDk()

#### Description

Set light/dark ink transforms.

#### Syntax

    void
    cupsCMYKSetLtDk(
        cups_cmyk_t * cmyk,
        int channel,
        float light,
        float dark);

#### Arguments

Name | Description
--- | ---
`cmyk` | CMYK color separation
`channel` | Dark ink channel (+1 for light)
`light` | Light ink only level
`dark` | Dark ink only level

#### Returns

Nothing.

### cupsCheckBytes()

#### Description

Check to see if all bytes are zero.

#### Syntax

    int
    cupsCheckBytes(
        const unsigned char * bytes,
        int length);

#### Arguments

Name | Description
--- | ---
`bytes` | Bytes to check
`length` | Number of bytes to check

#### Returns

1 if they match

### cupsCheckValue()

#### Description

Check to see if all bytes match the given value.

#### Syntax

    int
    cupsCheckValue(
        const unsigned char * bytes,
        int length,
        const unsigned char value);

#### Arguments

Name | Description
--- | ---
`bytes` | Bytes to check
`length` | Number of bytes to check
`value` | Value to check

#### Returns

1 if they match

### cupsDitherDelete()

#### Description

Free a dithering buffer. Returns 0 on success, -1 on failure.

#### Syntax

    void
    cupsDitherDelete(
        cups_dither_t * d);

#### Arguments

Name | Description
--- | ---
`d` | Dithering buffer

#### Returns

Nothing.

### cupsDitherLine()

#### Description

Dither a line of pixels...

#### Syntax

    void
    cupsDitherLine(
        cups_dither_t * d,
        const cups_lut_t * lut,
        const short * data,
        int num_channels,
        unsigned char * p);

#### Arguments

Name | Description
--- | ---
`d` | Dither data
`lut` | Lookup table
`data` | Separation data
`num_channels` | Number of components
`p` | Pixels

#### Returns

Nothing.

### cupsDitherNew()

#### Description

Create an error-diffusion dithering buffer.

#### Syntax

    cups_dither_t *
    cupsDitherNew(
        int width);

#### Arguments

Name | Description
--- | ---
`width` | Width of output in pixels

#### Returns

New state array

### cupsFindAttr()

#### Description

Find a PPD attribute based on the colormodel, media, and resolution.

#### Syntax

    ppd_attr_t *
    cupsFindAttr(
        ppd_file_t * ppd,
        const char * name,
        const char * colormodel,
        const char * media,
        const char * resolution,
        char * spec,
        int specsize);

#### Arguments

Name | Description
--- | ---
`ppd` | PPD file
`name` | Attribute name
`colormodel` | Color model
`media` | Media type
`resolution` | Resolution
`spec` | Final selection string
`specsize` | Size of string buffer

#### Returns

Matching attribute or NULL

### cupsLutDelete()

#### Description

Free the memory used by a lookup table.

#### Syntax

    void
    cupsLutDelete(
        cups_lut_t * lut);

#### Arguments

Name | Description
--- | ---
`lut` | Lookup table to free

#### Returns

Nothing.

### cupsLutLoad()

#### Description

Load a LUT from a PPD file.

#### Syntax

    cups_lut_t *
    cupsLutLoad(
        ppd_file_t * ppd,
        const char * colormodel,
        const char * media,
        const char * resolution,
        const char * ink);

#### Arguments

Name | Description
--- | ---
`ppd` | PPD file
`colormodel` | Color model
`media` | Media type
`resolution` | Resolution
`ink` | Ink name

#### Returns

New lookup table

### cupsLutNew()

#### Description

Make a lookup table from a list of pixel values. Returns a pointer to the lookup table on success, NULL on failure.

#### Syntax

    cups_lut_t *
    cupsLutNew(
        int num_values,
        const float * values);

#### Arguments

Name | Description
--- | ---
`num_values` | Number of values
`values` | Lookup table values

#### Returns

New lookup table

### cupsPackHorizontal()

#### Description

Pack pixels horizontally...

#### Syntax

    void
    cupsPackHorizontal(
        const unsigned char * ipixels,
        unsigned char * obytes,
        int width,
        const unsigned char clearto,
        const int step);

#### Arguments

Name | Description
--- | ---
`ipixels` | Input pixels
`obytes` | Output bytes
`width` | Number of pixels
`clearto` | Initial value of bytes
`step` | Step value between pixels

#### Returns

Nothing.

### cupsPackHorizontal2()

#### Description

Pack 2-bit pixels horizontally...

#### Syntax

    void
    cupsPackHorizontal2(
        const unsigned char * ipixels,
        unsigned char * obytes,
        int width,
        const int step);

#### Arguments

Name | Description
--- | ---
`ipixels` | Input pixels
`obytes` | Output bytes
`width` | Number of pixels
`step` | Stepping value

#### Returns

Nothing.

### cupsPackHorizontalBit()

#### Description

Pack pixels horizontally by bit...

#### Syntax

    void
    cupsPackHorizontalBit(
        const unsigned char * ipixels,
        unsigned char * obytes,
        int width,
        const unsigned char clearto,
        const unsigned char bit);

#### Arguments

Name | Description
--- | ---
`ipixels` | Input pixels
`obytes` | Output bytes
`width` | Number of pixels
`clearto` | Initial value of bytes
`bit` | Bit to check

#### Returns

Nothing.

### cupsPackVertical()

#### Description

Pack pixels vertically...

#### Syntax

    void
    cupsPackVertical(
        const unsigned char * ipixels,
        unsigned char * obytes,
        int width,
        const unsigned char bit,
        const int step);

#### Arguments

Name | Description
--- | ---
`ipixels` | Input pixels
`obytes` | Output bytes
`width` | Number of input pixels
`bit` | Output bit
`step` | Number of bytes between columns

#### Returns

Nothing.

### cupsRGBDelete()

#### Description

Delete a color separation.

#### Syntax

    void
    cupsRGBDelete(
        cups_rgb_t * rgbptr);

#### Arguments

Name | Description
--- | ---
`rgbptr` | Color separation

#### Returns

Nothing.

### cupsRGBDoGray()

#### Description

Do a grayscale separation...

#### Syntax

    void
    cupsRGBDoGray(
        cups_rgb_t * rgbptr,
        const unsigned char * input,
        unsigned char * output,
        int num_pixels);

#### Arguments

Name | Description
--- | ---
`rgbptr` | Color separation
`input` | Input grayscale pixels
`output` | Output Device-N pixels
`num_pixels` | Number of pixels

#### Returns

Nothing.

### cupsRGBDoRGB()

#### Description

Do a RGB separation...

#### Syntax

    void
    cupsRGBDoRGB(
        cups_rgb_t * rgbptr,
        const unsigned char * input,
        unsigned char * output,
        int num_pixels);

#### Arguments

Name | Description
--- | ---
`rgbptr` | Color separation
`input` | Input RGB pixels
`output` | Output Device-N pixels
`num_pixels` | Number of pixels

#### Returns

Nothing.

### cupsRGBLoad()

#### Description

Load a RGB color profile from a PPD file.

#### Syntax

    cups_rgb_t *
    cupsRGBLoad(
        ppd_file_t * ppd,
        const char * colormodel,
        const char * media,
        const char * resolution);

#### Arguments

Name | Description
--- | ---
`ppd` | PPD file
`colormodel` | Color model
`media` | Media type
`resolution` | Resolution

#### Returns

New color profile

### cupsRGBNew()

#### Description

Create a new RGB color separation.

#### Syntax

    cups_rgb_t *
    cupsRGBNew(
        int num_samples,
        cups_sample_t * samples,
        int cube_size,
        int num_channels);

#### Arguments

Name | Description
--- | ---
`num_samples` | Number of samples
`samples` | Samples
`cube_size` | Size of LUT cube
`num_channels` | Number of color components

#### Returns

New color separation or NULL

## Structures

- `cups_cmyk_s`
- `cups_dither_s`
- `cups_lut_s`
- `cups_rgb_s`
- `cups_sample_s`

### cups_cmyk_s

#### Description

Simple CMYK lookup table

#### Definition

    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;
    };

#### Members

Name | Description
--- | ---
`black_lut[256]` | Black generation LUT
`channels[CUPS_MAX_CHAN]` | Lookup tables
`color_lut[256]` | Color removal LUT
`ink_limit` | Ink limit
`num_channels` | Number of components

### cups_dither_s

#### Description

Dithering State

#### Definition

    struct cups_dither_s
    {
      int errors[96];
      int row;
      int width;
    };

#### Members

Name | Description
--- | ---
`errors[96]` | Error values
`row` | Current row
`width` | Width of buffer

### cups_lut_s

#### Description

Lookup Table for Dithering

#### Definition

    struct cups_lut_s
    {
      int error;
      short intensity;
      short pixel;
    };

#### Members

Name | Description
--- | ---
`error` | Error from desired value
`intensity` | Adjusted intensity
`pixel` | Output pixel value

### cups_rgb_s

#### Description

Color separation lookup table

#### Definition

    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];
    };

#### Members

Name | Description
--- | ---
`black[CUPS_MAX_RGB]` | Cached black (sRGB = 0,0,0)
`cache_init` | Are cached values initialized?
`colors` | 4-D array of sample values
`cube_index[256]` | Index into cube for a given sRGB value
`cube_mult[256]` | Multiplier value for a given sRGB value
`cube_size` | Size of color cube (2-N) on a side
`num_channels` | Number of colors per sample
`white[CUPS_MAX_RGB]` | Cached white (sRGB = 255,255,255)

### cups_sample_s

#### Description

Color sample point

#### Definition

    struct cups_sample_s
    {
      unsigned char colors[CUPS_MAX_RGB];
      unsigned char rgb[3];
    };

#### Members

Name | Description
--- | ---
`colors[CUPS_MAX_RGB]` | Color values
`rgb[3]` | sRGB values

## Types

- `cups_cmyk_t`
- `cups_dither_t`
- `cups_lut_t`
- `cups_rgb_t`
- `cups_sample_t`

### cups_cmyk_t

#### Description

Simple CMYK lookup table

#### Definition

    typedef struct cups_cmyk_s cups_cmyk_t;

### cups_dither_t

#### Description

Dithering State

#### Definition

    typedef struct cups_dither_s cups_dither_t;

### cups_lut_t

#### Description

Lookup Table for Dithering

#### Definition

    typedef struct cups_lut_s cups_lut_t;

### cups_rgb_t

#### Description

Color separation lookup table

#### Definition

    typedef struct cups_rgb_s cups_rgb_t;

### cups_sample_t

#### Description

Color sample point

#### Definition

    typedef struct cups_sample_s cups_sample_t;

## Variables

- `cups_scmy_lut[256]`
- `cups_srgb_lut[256]`

### cups_scmy_lut[256]

#### Description

sRGB gamma lookup table (inverted)

#### Definition

    extern const unsigned char cups_scmy_lut[256];

### cups_srgb_lut[256]

#### Description

sRGB gamma lookup table

#### Definition

    extern const unsigned char cups_srgb_lut[256];