Blender V5.3
blender::color Namespace Reference

Classes

struct  ByteTraits
struct  FloatTraits
struct  TraitsType
struct  TraitsType< ColorPaint4f >
struct  TraitsType< ColorPaint4b >

Typedefs

template<typename T>
using Traits = typename TraitsType<T>::type

Functions

BLI_INLINE ColorTheme4b to_byte (const ColorTheme4f &theme4f)
BLI_INLINE ColorTheme4b to_byte (const ColorTheme4b &theme4b)
template<eAlpha Alpha>
BLI_INLINE ColorSceneLinearByteEncoded4b< Alpha > encode (const ColorSceneLinear4f< Alpha > &color)
BLI_INLINE ColorTheme4f to_float (const ColorTheme4b &theme4b)
BLI_INLINE ColorTheme4f to_float (const ColorTheme4f &theme4f)
template<eAlpha Alpha>
BLI_INLINE ColorSceneLinear4f< Alpha > decode (const ColorSceneLinearByteEncoded4b< Alpha > &color)
template<eAlpha Alpha>
ColorSceneLinear4f< eAlpha::Premultiplied > premultiply_alpha (const ColorSceneLinear4f< Alpha > &color)
template<eAlpha Alpha>
ColorSceneLinear4f< eAlpha::Straight > unpremultiply_alpha (const ColorSceneLinear4f< Alpha > &color)
BLI_INLINE ColorSceneLinear4f< eAlpha::Straight > to_scene_linear (const ColorTheme4f &theme4f)
BLI_INLINE ColorSceneLinear4f< eAlpha::Straight > to_scene_linear (const ColorTheme4b &theme4b)
BLI_INLINE ColorTheme4f to_theme4f (const ColorSceneLinear4f< eAlpha::Straight > &scene_linear)
BLI_INLINE ColorTheme4b to_theme4b (const ColorSceneLinear4f< eAlpha::Straight > &scene_linear)
static float get_luminance (ColorPaint4f c)
static int get_luminance (ColorPaint4b c)
Color Blending Modes
template<typename Color, typename Traits>
static Color mix_blend (Color col_src, Color col_dst, typename Traits::BlendType fac)
template<typename Color, typename Traits>
static Color mix_add (Color col_src, Color col_dst, typename Traits::BlendType fac)
template<typename Color, typename Traits>
static Color mix_sub (Color col_src, Color col_dst, typename Traits::BlendType fac)
template<typename Color, typename Traits>
static Color mix_mul (Color col_src, Color col_dst, typename Traits::BlendType fac)
template<typename Color, typename Traits>
static Color mix_lighten (Color col_src, Color col_dst, typename Traits::BlendType fac)
template<typename Color, typename Traits>
static Color mix_darken (Color col_src, Color col_dst, typename Traits::BlendType fac)
template<typename Color, typename Traits>
static Color mix_colordodge (Color col_src, Color col_dst, typename Traits::BlendType fac)
template<typename Color, typename Traits>
static Color mix_difference (Color col_src, Color col_dst, typename Traits::BlendType fac)
template<typename Color, typename Traits>
static Color mix_screen (Color col_src, Color col_dst, typename Traits::BlendType fac)
template<typename Color, typename Traits>
static Color mix_hardlight (Color col_src, Color col_dst, typename Traits::BlendType fac)
template<typename Color, typename Traits>
static Color mix_overlay (Color col_src, Color col_dst, typename Traits::BlendType fac)
template<typename Color, typename Traits>
static Color mix_softlight (Color col_src, Color col_dst, typename Traits::BlendType fac)
template<typename Color, typename Traits>
static Color mix_exclusion (Color col_src, Color col_dst, typename Traits::BlendType fac)
template<typename Color, typename Traits>
static Color mix_luminosity (Color col_src, Color col_dst, typename Traits::BlendType fac)
template<typename Color, typename Traits>
static Color mix_saturation (Color col_src, Color col_dst, typename Traits::BlendType fac)
template<typename Color, typename Traits>
static Color mix_hue (Color col_src, Color col_dst, typename Traits::BlendType fac)
template<typename Color, typename Traits>
static Color mix_alpha_add (Color col_src, typename Traits::BlendType fac)
template<typename Color, typename Traits>
static Color mix_alpha_sub (Color col_src, typename Traits::BlendType fac)
template<typename Color, typename Traits>
static Color mix_pinlight (Color col_src, Color col_dst, typename Traits::BlendType fac)
template<typename Color, typename Traits>
static Color mix_linearlight (Color col_src, Color col_dst, typename Traits::BlendType fac)
template<typename Color, typename Traits>
static Color mix_vividlight (Color col_src, Color col_dst, typename Traits::BlendType fac)
template<typename Color, typename Traits>
static Color mix_color (Color col_src, Color col_dst, typename Traits::BlendType fac)
template<typename Color, typename Traits>
static Color mix_colorburn (Color col_src, Color col_dst, typename Traits::BlendType fac)
template<typename Color, typename Traits>
static Color mix_linearburn (Color col_src, Color col_dst, typename Traits::BlendType fac)
template<typename Color, typename Traits>
BLI_INLINE Color BLI_mix_colors (const IMB_BlendMode tool, const Color a, const Color b, const typename Traits::BlendType alpha)

Typedef Documentation

◆ Traits

template<typename T>
using blender::color::Traits = typename TraitsType<T>::type

Definition at line 99 of file BLI_color_mix.hh.

Function Documentation

◆ BLI_mix_colors()

template<typename Color, typename Traits>
BLI_INLINE Color blender::color::BLI_mix_colors ( const IMB_BlendMode tool,
const Color a,
const Color b,
const typename Traits::BlendType alpha )

◆ decode()

◆ encode()

◆ get_luminance() [1/2]

int blender::color::get_luminance ( ColorPaint4b c)
inlinestatic

◆ get_luminance() [2/2]

◆ mix_add()

template<typename Color, typename Traits>
Color blender::color::mix_add ( Color col_src,
Color col_dst,
typename Traits::BlendType fac )
static

Definition at line 162 of file BLI_color_mix.hh.

References mix_add().

Referenced by BLI_mix_colors(), and mix_add().

◆ mix_alpha_add()

template<typename Color, typename Traits>
Color blender::color::mix_alpha_add ( Color col_src,
typename Traits::BlendType fac )
static

Definition at line 714 of file BLI_color_mix.hh.

References mix_alpha_add().

Referenced by BLI_mix_colors(), and mix_alpha_add().

◆ mix_alpha_sub()

template<typename Color, typename Traits>
Color blender::color::mix_alpha_sub ( Color col_src,
typename Traits::BlendType fac )
static

Definition at line 737 of file BLI_color_mix.hh.

References mix_alpha_sub().

Referenced by BLI_mix_colors(), and mix_alpha_sub().

◆ mix_blend()

template<typename Color, typename Traits>
Color blender::color::mix_blend ( Color col_src,
Color col_dst,
typename Traits::BlendType fac )
static

Definition at line 118 of file BLI_color_mix.hh.

References mix_blend(), and sqrtf.

Referenced by BLI_mix_colors(), and mix_blend().

◆ mix_color()

template<typename Color, typename Traits>
Color blender::color::mix_color ( Color col_src,
Color col_dst,
typename Traits::BlendType fac )
static

Definition at line 886 of file BLI_color_mix.hh.

References b, blender::hsv_to_rgb(), mix_color(), blender::rgb_to_hsv(), and blender::v2.

Referenced by BLI_mix_colors(), and mix_color().

◆ mix_colorburn()

template<typename Color, typename Traits>
Color blender::color::mix_colorburn ( Color col_src,
Color col_dst,
typename Traits::BlendType fac )
static

Definition at line 936 of file BLI_color_mix.hh.

References mix_colorburn().

Referenced by BLI_mix_colors(), and mix_colorburn().

◆ mix_colordodge()

template<typename Color, typename Traits>
Color blender::color::mix_colordodge ( Color col_src,
Color col_dst,
typename Traits::BlendType fac )
static

Definition at line 324 of file BLI_color_mix.hh.

References mix_colordodge().

Referenced by BLI_mix_colors(), and mix_colordodge().

◆ mix_darken()

template<typename Color, typename Traits>
Color blender::color::mix_darken ( Color col_src,
Color col_dst,
typename Traits::BlendType fac )
static

Definition at line 288 of file BLI_color_mix.hh.

References get_luminance(), and mix_darken().

Referenced by BLI_mix_colors(), and mix_darken().

◆ mix_difference()

template<typename Color, typename Traits>
Color blender::color::mix_difference ( Color col_src,
Color col_dst,
typename Traits::BlendType fac )
static

Definition at line 365 of file BLI_color_mix.hh.

References abs, and mix_difference().

Referenced by BLI_mix_colors(), and mix_difference().

◆ mix_exclusion()

template<typename Color, typename Traits>
Color blender::color::mix_exclusion ( Color col_src,
Color col_dst,
typename Traits::BlendType fac )
static

Definition at line 541 of file BLI_color_mix.hh.

References mix_exclusion().

Referenced by BLI_mix_colors(), and mix_exclusion().

◆ mix_hardlight()

template<typename Color, typename Traits>
Color blender::color::mix_hardlight ( Color col_src,
Color col_dst,
typename Traits::BlendType fac )
static

Definition at line 435 of file BLI_color_mix.hh.

References mix_hardlight().

Referenced by BLI_mix_colors(), and mix_hardlight().

◆ mix_hue()

template<typename Color, typename Traits>
Color blender::color::mix_hue ( Color col_src,
Color col_dst,
typename Traits::BlendType fac )
static

Definition at line 667 of file BLI_color_mix.hh.

References b, blender::hsv_to_rgb(), mix_hue(), blender::rgb_to_hsv(), and blender::v2.

Referenced by BLI_mix_colors(), and mix_hue().

◆ mix_lighten()

template<typename Color, typename Traits>
Color blender::color::mix_lighten ( Color col_src,
Color col_dst,
typename Traits::BlendType fac )
static

Definition at line 251 of file BLI_color_mix.hh.

References get_luminance(), and mix_lighten().

Referenced by BLI_mix_colors(), and mix_lighten().

◆ mix_linearburn()

template<typename Color, typename Traits>
Color blender::color::mix_linearburn ( Color col_src,
Color col_dst,
typename Traits::BlendType fac )
static

Definition at line 971 of file BLI_color_mix.hh.

References mix_linearburn().

Referenced by BLI_mix_colors(), and mix_linearburn().

◆ mix_linearlight()

template<typename Color, typename Traits>
Color blender::color::mix_linearlight ( Color col_src,
Color col_dst,
typename Traits::BlendType fac )
static

Definition at line 799 of file BLI_color_mix.hh.

References mix_linearlight().

Referenced by BLI_mix_colors(), and mix_linearlight().

◆ mix_luminosity()

template<typename Color, typename Traits>
Color blender::color::mix_luminosity ( Color col_src,
Color col_dst,
typename Traits::BlendType fac )
static

◆ mix_mul()

template<typename Color, typename Traits>
Color blender::color::mix_mul ( Color col_src,
Color col_dst,
typename Traits::BlendType fac )
static

Definition at line 218 of file BLI_color_mix.hh.

References mix_mul().

Referenced by BLI_mix_colors(), and mix_mul().

◆ mix_overlay()

template<typename Color, typename Traits>
Color blender::color::mix_overlay ( Color col_src,
Color col_dst,
typename Traits::BlendType fac )
static

Definition at line 470 of file BLI_color_mix.hh.

References mix_overlay().

Referenced by BLI_mix_colors(), and mix_overlay().

◆ mix_pinlight()

template<typename Color, typename Traits>
Color blender::color::mix_pinlight ( Color col_src,
Color col_dst,
typename Traits::BlendType fac )
static

Definition at line 760 of file BLI_color_mix.hh.

References mix_pinlight().

Referenced by BLI_mix_colors(), and mix_pinlight().

◆ mix_saturation()

template<typename Color, typename Traits>
Color blender::color::mix_saturation ( Color col_src,
Color col_dst,
typename Traits::BlendType fac )
static

◆ mix_screen()

template<typename Color, typename Traits>
Color blender::color::mix_screen ( Color col_src,
Color col_dst,
typename Traits::BlendType fac )
static

Definition at line 396 of file BLI_color_mix.hh.

References mix_screen().

Referenced by BLI_mix_colors(), and mix_screen().

◆ mix_softlight()

template<typename Color, typename Traits>
Color blender::color::mix_softlight ( Color col_src,
Color col_dst,
typename Traits::BlendType fac )
static

Definition at line 505 of file BLI_color_mix.hh.

References mix_softlight().

Referenced by BLI_mix_colors(), and mix_softlight().

◆ mix_sub()

template<typename Color, typename Traits>
Color blender::color::mix_sub ( Color col_src,
Color col_dst,
typename Traits::BlendType fac )
static

Definition at line 192 of file BLI_color_mix.hh.

References mix_sub().

Referenced by BLI_mix_colors(), and mix_sub().

◆ mix_vividlight()

template<typename Color, typename Traits>
Color blender::color::mix_vividlight ( Color col_src,
Color col_dst,
typename Traits::BlendType fac )
static

Definition at line 839 of file BLI_color_mix.hh.

References mix_vividlight().

Referenced by BLI_mix_colors(), and mix_vividlight().

◆ premultiply_alpha()

template<eAlpha Alpha>
ColorSceneLinear4f< eAlpha::Premultiplied > blender::color::premultiply_alpha ( const ColorSceneLinear4f< Alpha > & color)

◆ to_byte() [1/2]

BLI_INLINE ColorTheme4b blender::color::to_byte ( const ColorTheme4b & theme4b)

Definition at line 44 of file BLI_color.hh.

References BLI_INLINE, and to_byte().

◆ to_byte() [2/2]

BLI_INLINE ColorTheme4b blender::color::to_byte ( const ColorTheme4f & theme4f)

Change precision of color to uint8_t.

Definition at line 37 of file BLI_color.hh.

References BLI_INLINE, blender::rgba_float_to_uchar(), and to_byte().

Referenced by blender::tests::TEST(), to_byte(), and to_byte().

◆ to_float() [1/2]

BLI_INLINE ColorTheme4f blender::color::to_float ( const ColorTheme4b & theme4b)

◆ to_float() [2/2]

BLI_INLINE ColorTheme4f blender::color::to_float ( const ColorTheme4f & theme4f)

Definition at line 71 of file BLI_color.hh.

References BLI_INLINE, and to_float().

◆ to_scene_linear() [1/2]

BLI_INLINE ColorSceneLinear4f< eAlpha::Straight > blender::color::to_scene_linear ( const ColorTheme4b & theme4b)

Definition at line 133 of file BLI_color.hh.

References BLI_INLINE, blender::srgb_to_linearrgb_uchar4(), and to_scene_linear().

◆ to_scene_linear() [2/2]

◆ to_theme4b()

BLI_INLINE ColorTheme4b blender::color::to_theme4b ( const ColorSceneLinear4f< eAlpha::Straight > & scene_linear)

◆ to_theme4f()

BLI_INLINE ColorTheme4f blender::color::to_theme4f ( const ColorSceneLinear4f< eAlpha::Straight > & scene_linear)

◆ unpremultiply_alpha()

template<eAlpha Alpha>
ColorSceneLinear4f< eAlpha::Straight > blender::color::unpremultiply_alpha ( const ColorSceneLinear4f< Alpha > & color)