Zephyr Scientific Library (zscilib)
Functions
Data Access Functions

Functions

int zsl_clr_illum_get (enum zsl_clr_obs obs, enum zsl_clr_illum illum, const struct zsl_clr_illum_data **data)
 Retrieves a pointer to the zsl_clr_illum_data for the specified illuminant. More...
 
void zsl_clr_obs_get (enum zsl_clr_obs obs, const struct zsl_clr_obs_data **data)
 Retrieves a pointer to the zsl_clr_obs_data for the specified CIE standard observer model. More...
 
void zsl_clr_lef_get (enum zsl_clr_lef lef, const struct zsl_clr_spd **data)
 Retrieves a pointer to the zsl_clr_spd data for the specified CIE luminous efficiency function. More...
 
int zsl_clr_lef_lerp (enum zsl_clr_lef lef, unsigned int nm, zsl_real_t *val)
 Interpolates a single value from the specified CIE luminous efficiency function using linear interpolation. More...
 
void zsl_clr_rgbccm_get (enum zsl_clr_rgb_ccm ccm, struct zsl_mtx **mtx)
 Retrieves a pointer to a standard 3x3 XYZ to RGB color space correlation matrix. More...
 

Detailed Description

Function to access various colorimetry datasets.

Function Documentation

◆ zsl_clr_illum_get()

int zsl_clr_illum_get ( enum zsl_clr_obs  obs,
enum zsl_clr_illum  illum,
const struct zsl_clr_illum_data **  data 
)

Retrieves a pointer to the zsl_clr_illum_data for the specified illuminant.

Parameters
obsThe standard observer associated with this #illum.
illumThe illuminant whose data should be retrieved.
dataPointer to the pointer where the const zsl_clr_illum_data should be made accessible.
Returns
0 on normal execution, otherwise an appropriate error code.

Example

The following example shows how to use the pointer to a pointer mechnaism to access illuminant A data in an resource efficient manner.

void
get_illum(void)
{
int rc;
const struct zsl_clr_illum_data *illum;
if (rc) {
// No matching illuminant found!
return;
}
printf("Illum %s - x = %f\n", illum->name, illum->data.xyz_z);
}

◆ zsl_clr_lef_get()

void zsl_clr_lef_get ( enum zsl_clr_lef  lef,
const struct zsl_clr_spd **  data 
)

Retrieves a pointer to the zsl_clr_spd data for the specified CIE luminous efficiency function.

Parameters
lefThe luminous efficiency func. whose data should be retrieved.
dataPointer to the pointer where the const zsl_clr_spd data should be made accessible.

◆ zsl_clr_lef_lerp()

int zsl_clr_lef_lerp ( enum zsl_clr_lef  lef,
unsigned int  nm,
zsl_real_t val 
)

Interpolates a single value from the specified CIE luminous efficiency function using linear interpolation.

Parameters
lefThe luminous efficiency function to use.
nmThe wavelength to interpolate.
valPointer to the interpolated value's placeholder.
Returns
0 on normal execution, otherwise an appropriate error code.

◆ zsl_clr_obs_get()

void zsl_clr_obs_get ( enum zsl_clr_obs  obs,
const struct zsl_clr_obs_data **  data 
)

Retrieves a pointer to the zsl_clr_obs_data for the specified CIE standard observer model.

Parameters
obsThe standard observer whose data should be retrieved.
dataPointer to the pointer where the const zsl_clr_obs_data should be made accessible.
Returns
0 on normal execution, otherwise an appropriate error code.

Example

The following example shows how to use the pointer to a pointer mechnaism to access standard 2 degree observer data in an resource efficient manner.

void
get_stdobs(void)
{
const struct zsl_clr_obs_data *obs;
zsl_clr_obs_get(ZSL_CLR_OBS_2DEG, &obs);
printf("obs: %s\n", obs->name);
}

◆ zsl_clr_rgbccm_get()

void zsl_clr_rgbccm_get ( enum zsl_clr_rgb_ccm  ccm,
struct zsl_mtx **  mtx 
)

Retrieves a pointer to a standard 3x3 XYZ to RGB color space correlation matrix.

Parameters
ccmThe XYZ to RGB color space correlation matrix to retrieve.
mtxPointer to the pointer where the const zsl_mtx data should be made accessible.
Returns
0 on normal execution, otherwise an appropriate error code.
zsl_clr_illum_get
int zsl_clr_illum_get(enum zsl_clr_obs obs, enum zsl_clr_illum illum, const struct zsl_clr_illum_data **data)
Retrieves a pointer to the zsl_clr_illum_data for the specified illuminant.
ZSL_CLR_ILLUM_A
@ ZSL_CLR_ILLUM_A
Definition: colorimetry.h:74
zsl_clr_illum_data::xyz_z
zsl_real_t xyz_z
Definition: colorimetry.h:445
zsl_clr_obs_data::name
char * name
Definition: colorimetry.h:457
zsl_clr_illum_data
CIE 1931 XYZ tristimulus values for a standard illuminant.
Definition: colorimetry.h:431
zsl_clr_illum_data::name
char * name
Definition: colorimetry.h:437
zsl_clr_obs_data
CIE 1931 XYZ tristimulus values for a standard observer model in 5 nm steps from 360-830 nm (95 steps...
Definition: colorimetry.h:453
zsl_clr_illum_data::data
struct zsl_clr_illum_data::@0 data
zsl_clr_obs_get
void zsl_clr_obs_get(enum zsl_clr_obs obs, const struct zsl_clr_obs_data **data)
Retrieves a pointer to the zsl_clr_obs_data for the specified CIE standard observer model.
ZSL_CLR_OBS_2_DEG
@ ZSL_CLR_OBS_2_DEG
Definition: colorimetry.h:56