Mapper  0.9.0
API documentation
Functions
color.c File Reference

(be6b54f on 16 Apr 2013)

#include <math.h>
#include "libocad.h"
Include dependency graph for color.c:

Functions

int ocad_color_count (OCADFile *pfile)
 Returns the number of colors defined in the color table, or -1 if the file isn't valid. More...
 
OCADColor * ocad_color_at (OCADFile *pfile, int index)
 Returns a pointer to a particular color in the color table. More...
 
OCADColor * ocad_color (OCADFile *pfile, u8 number)
 Returns a pointer to a color in the color table with the given number. More...
 
void ocad_color_to_rgb (const OCADColor *c, int *arr)
 Converts an OCADColor to an RGB triplet in the provided array of ints. More...
 
void ocad_color_to_rgbf (const OCADColor *c, float *arr)
 Converts an OCADColor to an RGB triplet in the provided array of floats. More...
 
int ocad_separation_count (OCADFile *pfile)
 Returns the number of spot colors defined in the separations table. More...
 
OCADColorSeparation * ocad_separation_at (OCADFile *pfile, int index)
 Returns a pointer to a particular spot color definition in the separations table. More...
 

Function Documentation

◆ ocad_color()

OCADColor* ocad_color ( OCADFile pfile,
u8  number 
)

Returns a pointer to a color in the color table with the given number.

If a color with that number is not found, nullptr is returned.

◆ ocad_color_at()

OCADColor* ocad_color_at ( OCADFile pfile,
int  index 
)

Returns a pointer to a particular color in the color table.

If index is less than zero or greater than the maximum color index, then nullptr is returned. Otherwise, a valid pointer to a color is returned. Note that the color index defined the order that colors are drawn (from top to bottom), and is independent from the color number that is used by symbol definition. The color number is available from (OCADColor *)->number.

◆ ocad_color_count()

int ocad_color_count ( OCADFile pfile)

Returns the number of colors defined in the color table, or -1 if the file isn't valid.

◆ ocad_color_to_rgb()

void ocad_color_to_rgb ( const OCADColor *  c,
int *  arr 
)

Converts an OCADColor to an RGB triplet in the provided array of ints.

The RGB values range from 0 to 255, and the array must have at least three valid elements.

◆ ocad_color_to_rgbf()

void ocad_color_to_rgbf ( const OCADColor *  c,
float *  arr 
)

Converts an OCADColor to an RGB triplet in the provided array of floats.

The RGB values range from 0.0f to 1.0f, and the array must have at least three valid elements.

◆ ocad_separation_at()

OCADColorSeparation* ocad_separation_at ( OCADFile pfile,
int  index 
)

Returns a pointer to a particular spot color definition in the separations table.

If index is less than zero, greater than the maximum color index or greater than 32, then nullptr is returned. The index corresponds to the index in the spot color table at OCADColor::spot.

◆ ocad_separation_count()

int ocad_separation_count ( OCADFile pfile)

Returns the number of spot colors defined in the separations table.

Returns -1 if the file isn't valid, or returns the negative value if the number in the file exceeds 32.