Blender V5.0
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::Premultipliedpremultiply_alpha (const ColorSceneLinear4f< Alpha > &color)
template<eAlpha Alpha>
ColorSceneLinear4f< eAlpha::Straightunpremultiply_alpha (const ColorSceneLinear4f< Alpha > &color)
BLI_INLINE ColorSceneLinear4f< eAlpha::Straightto_scene_linear (const ColorTheme4f &theme4f)
BLI_INLINE ColorSceneLinear4f< eAlpha::Straightto_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()

◆ decode()

◆ encode()

◆ get_luminance() [1/2]

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

◆ get_luminance() [2/2]

float blender::color::get_luminance ( ColorPaint4f c)
inlinestatic

◆ 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 Color.

Referenced by BLI_mix_colors().

◆ 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 Color.

Referenced by BLI_mix_colors().

◆ 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 Color.

Referenced by BLI_mix_colors().

◆ 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 Color, and sqrtf.

Referenced by BLI_mix_colors().

◆ 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 887 of file BLI_color_mix.hh.

References b, Color, hsv_to_rgb(), rgb_to_hsv(), and v2.

Referenced by BLI_mix_colors().

◆ 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 937 of file BLI_color_mix.hh.

References Color, and i.

Referenced by BLI_mix_colors().

◆ 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 Color.

Referenced by BLI_mix_colors().

◆ 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 Color, and get_luminance().

Referenced by BLI_mix_colors().

◆ 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 Color.

Referenced by BLI_mix_colors().

◆ 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 Color, and i.

Referenced by BLI_mix_colors().

◆ 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 Color, and i.

Referenced by BLI_mix_colors().

◆ 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, Color, hsv_to_rgb(), rgb_to_hsv(), and v2.

Referenced by BLI_mix_colors().

◆ 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 Color, and get_luminance().

Referenced by BLI_mix_colors().

◆ 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 972 of file BLI_color_mix.hh.

References Color, and i.

◆ 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 800 of file BLI_color_mix.hh.

References Color, and i.

Referenced by BLI_mix_colors().

◆ mix_luminosity()

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

Definition at line 572 of file BLI_color_mix.hh.

References b, Color, hsv_to_rgb(), rgb_to_hsv(), and v2.

Referenced by BLI_mix_colors().

◆ 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 Color.

Referenced by BLI_mix_colors().

◆ 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 Color, and i.

Referenced by BLI_mix_colors().

◆ 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 Color, and i.

Referenced by BLI_mix_colors().

◆ mix_saturation()

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

Definition at line 619 of file BLI_color_mix.hh.

References b, Color, EPS_SATURATION, hsv_to_rgb(), rgb_to_hsv(), and v2.

Referenced by BLI_mix_colors().

◆ 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 Color.

Referenced by BLI_mix_colors().

◆ 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 add(), Color, and i.

Referenced by BLI_mix_colors().

◆ 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 Color.

Referenced by BLI_mix_colors().

◆ 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 840 of file BLI_color_mix.hh.

References Color, and i.

Referenced by BLI_mix_colors().

◆ premultiply_alpha()

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

Convert color and alpha association to premultiplied alpha.

Does nothing when color already has a premultiplied alpha.

Definition at line 93 of file BLI_color.hh.

References blender::Straight, and straight_to_premul_v4_v4().

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

◆ 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.

◆ 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, and rgba_float_to_uchar().

Referenced by blender::tests::TEST().

◆ to_float() [1/2]

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

Change precision of color to float.

Definition at line 64 of file BLI_color.hh.

References BLI_INLINE, and rgba_uchar_to_float().

Referenced by blender::tests::TEST().

◆ 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.

◆ 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, and srgb_to_linearrgb_uchar4().

◆ to_scene_linear() [2/2]

BLI_INLINE ColorSceneLinear4f< eAlpha::Straight > blender::color::to_scene_linear ( const ColorTheme4f & theme4f)

Convert between theme and scene linear colors.

Definition at line 126 of file BLI_color.hh.

References BLI_INLINE, and srgb_to_linearrgb_v4().

Referenced by blender::tests::TEST().

◆ to_theme4b()

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

Definition at line 147 of file BLI_color.hh.

References BLI_INLINE, and linearrgb_to_srgb_uchar4().

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

◆ to_theme4f()

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

Definition at line 140 of file BLI_color.hh.

References BLI_INLINE, and linearrgb_to_srgb_v4().

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

◆ unpremultiply_alpha()

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

Convert color and alpha association to straight alpha.

Does nothing when color has straight alpha.

Definition at line 111 of file BLI_color.hh.

References premul_to_straight_v4_v4(), and blender::Premultiplied.

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