Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
color_vocabulary.h File Reference
#include "common/colorspaces_inline_conversions.h"
#include <glib.h>
+ Include dependency graph for color_vocabulary.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  gaussian_stats_t
 
struct  range_t
 
struct  ethnicity_t
 
struct  skin_color_t
 

Macros

#define SKINS   16
 

Typedefs

typedef struct gaussian_stats_t gaussian_stats_t
 
typedef struct range_t range_t
 
typedef enum ethnicities_t ethnicities_t
 
typedef struct ethnicity_t ethnicity_t
 
typedef struct skin_color_t skin_color_t
 

Enumerations

enum  ethnicities_t {
  ETHNIE_CHINESE = 0 ,
  ETHNIE_THAI = 1 ,
  ETHNIE_KURDISH = 2 ,
  ETHNIE_CAUCASIAN = 3 ,
  ETHNIE_AFRICAN_AM = 4 ,
  ETHNIE_MEXICAN = 5 ,
  ETHNIE_END = 6
}
 

Functions

char * Lch_to_color_name (dt_aligned_pixel_t color)
 Name the colour at color in plain language, e.g. "salmon" or "olive drab".
 
void get_skin_tones_range ()
 

Macro Definition Documentation

◆ SKINS

#define SKINS   16

Definition at line 77 of file color_vocabulary.h.

Typedef Documentation

◆ ethnicities_t

◆ ethnicity_t

typedef struct ethnicity_t ethnicity_t

◆ gaussian_stats_t

◆ range_t

typedef struct range_t range_t

◆ skin_color_t

typedef struct skin_color_t skin_color_t

Enumeration Type Documentation

◆ ethnicities_t

Enumerator
ETHNIE_CHINESE 
ETHNIE_THAI 
ETHNIE_KURDISH 
ETHNIE_CAUCASIAN 
ETHNIE_AFRICAN_AM 
ETHNIE_MEXICAN 
ETHNIE_END 

Definition at line 46 of file color_vocabulary.h.

Function Documentation

◆ get_skin_tones_range()

◆ Lch_to_color_name()

char * Lch_to_color_name ( dt_aligned_pixel_t  color)

Name the colour at color in plain language, e.g. "salmon" or "olive drab".

Classifies by hue and lightness against a 15 x 5 grid of names, after two special cases: a chroma below 2.0 is "gray", and a colour falling inside the measured spread of any reference skin tone is named as such instead ("average Thai skin tone"), listing every ethnicity whose range it matches, one per line.

Parameters
colorCIE Lab 1976 turned into polar coordinates (Lch), as produced by dt_Lab_2_LCH(): L in percent, chroma, and hue NORMALIZED to [0, 1] – not degrees. Passing degrees puts every lookup out of the table's domain.
Returns
a newly-allocated, translated, human-readable name. The caller owns it and must g_free() it. Never NULL: a colour outside the table's domain gives "color not found" rather than a NULL a "%s" would then read.
Note
Ownership used to depend on which branch answered – the skin-tone path returned an allocated string while every other path returned a static literal, behind a const char * that told the caller neither. The one call site leaked whenever a skin tone matched. Allocating on every path is what makes the contract statable.

Definition at line 224 of file color_vocabulary.c.

References _compute_range(), _get_ethnicity_name(), _lch_color_names, skin_color_t::a, skin_color_t::b, color, dt_util_dstrcat(), skin_color_t::ethnicity, ETHNIE_END, FALSE, get_skin_color(), IS_NULL_PTR, skin_color_t::L, L, Lab, LCH_HUE_SECTORS, LCH_LIGHTNESS_SECTORS, out, SKINS, and TRUE.

Referenced by _sample_tooltip_callback().