KiCad PCB EDA Suite
color_rgb.h File Reference

Go to the source code of this file.

Classes

union  COLOR_RGB
 

Functions

COLOR_RGB BlendColor (const COLOR_RGB &aC1, const COLOR_RGB &aC2)
 
COLOR_RGB BlendColor (const COLOR_RGB &aC1, const COLOR_RGB &aC2, const COLOR_RGB &aC3)
 
COLOR_RGB BlendColor (const COLOR_RGB &aC1, const COLOR_RGB &aC2, const COLOR_RGB &aC3, const COLOR_RGB &aC4)
 

Function Documentation

◆ BlendColor() [1/3]

COLOR_RGB BlendColor ( const COLOR_RGB aC1,
const COLOR_RGB aC2 
)

Definition at line 41 of file color_rgb.cpp.

42{
43 const unsigned int r = aC1.r + aC2.r;
44 const unsigned int g = aC1.g + aC2.g;
45 const unsigned int b = aC1.b + aC2.b;
46
47 return COLOR_RGB( ( r >> 1 ), ( g >> 1 ), ( b >> 1 ) );
48}
unsigned char g
Definition: color_rgb.h:41
unsigned char r
Definition: color_rgb.h:40
unsigned char b
Definition: color_rgb.h:42

References COLOR_RGB::b, COLOR_RGB::g, and COLOR_RGB::r.

Referenced by RENDER_3D_RAYTRACE::renderPreview().

◆ BlendColor() [2/3]

COLOR_RGB BlendColor ( const COLOR_RGB aC1,
const COLOR_RGB aC2,
const COLOR_RGB aC3 
)

Definition at line 51 of file color_rgb.cpp.

52{
53 const unsigned int r = aC1.r + aC2.r + aC3.r;
54 const unsigned int g = aC1.g + aC2.g + aC3.g;
55 const unsigned int b = aC1.b + aC2.b + aC3.b;
56
57 return COLOR_RGB( ( r / 3 ), ( g / 3 ), ( b / 3 ) );
58}

References COLOR_RGB::b, COLOR_RGB::g, and COLOR_RGB::r.

◆ BlendColor() [3/3]

COLOR_RGB BlendColor ( const COLOR_RGB aC1,
const COLOR_RGB aC2,
const COLOR_RGB aC3,
const COLOR_RGB aC4 
)

Definition at line 61 of file color_rgb.cpp.

63{
64 const unsigned int r = aC1.r + aC2.r + aC3.r + aC4.r;
65 const unsigned int g = aC1.g + aC2.g + aC3.g + aC4.g;
66 const unsigned int b = aC1.b + aC2.b + aC3.b + aC4.b;
67
68 return COLOR_RGB( ( r >> 2 ), ( g >> 2 ), ( b >> 2 ) );
69}

References COLOR_RGB::b, COLOR_RGB::g, and COLOR_RGB::r.