KiCad PCB EDA Suite
KIGFX::COLOR4D Class Reference

A color representation with 4 components: red, green, blue, alpha. More...

#include <color4d.h>

Public Member Functions

 COLOR4D ()
 
 COLOR4D (double aRed, double aGreen, double aBlue, double aAlpha)
 
 COLOR4D (EDA_COLOR_T aColor)
 
COLOR4DFromCSSRGBA (int aRed, int aGreen, int aBlue, double aAlpha=1.0)
 Initialize the color from a RGBA value with 0-255 red/green/blue and 0-1 alpha. More...
 
 COLOR4D (const wxString &aColorStr)
 Defines a color from a CSS or HTML-type string. More...
 
 COLOR4D (const wxColour &aColor)
 
bool SetFromWxString (const wxString &aColorString)
 Set color values by parsing a string using wxColour::Set(). More...
 
wxString ToCSSString () const
 
bool SetFromHexString (const wxString &aColorString)
 
wxString ToHexString () const
 
wxColour ToColour () const
 
COLOR4D LegacyMix (const COLOR4D &aColor) const
 Mix this COLOR4D with an input COLOR4D using the OR-mixing of legacy canvas. More...
 
void ToHSL (double &aOutHue, double &aOutSaturation, double &aOutValue) const
 Converts current color (stored in RGB) to HSL format. More...
 
void FromHSL (double aInHue, double aInSaturation, double aInLightness)
 Change currently used color to the one given by hue, saturation and lightness parameters. More...
 
COLOR4DBrighten (double aFactor)
 Makes the color brighter by a given factor. More...
 
COLOR4DDarken (double aFactor)
 Makes the color darker by a given factor. More...
 
COLOR4DInvert ()
 Makes the color inverted, alpha remains the same. More...
 
COLOR4DSaturate (double aFactor)
 Saturates the color to a given factor (in HSV model) More...
 
COLOR4DDesaturate ()
 Removes color (in HSL model) More...
 
COLOR4D Brightened (double aFactor) const
 Return a color that is brighter by a given factor, without modifying object. More...
 
COLOR4D Darkened (double aFactor) const
 Return a color that is darker by a given factor, without modifying object. More...
 
COLOR4D Mix (const COLOR4D &aColor, double aFactor) const
 Return a color that is mixed with the input by a factor. More...
 
COLOR4D WithAlpha (double aAlpha) const
 Return a color with the same color, but the given alpha. More...
 
COLOR4D Inverted () const
 Returns an inverted color, alpha remains the same. More...
 
double GetBrightness () const
 Returns the brightness value of the color ranged from 0.0 to 1.0. More...
 
void ToHSV (double &aOutHue, double &aOutSaturation, double &aOutValue, bool aAlwaysDefineHue=false) const
 Convert current color (stored in RGB) to HSV format. More...
 
void FromHSV (double aInH, double aInS, double aInV)
 Changes currently used color to the one given by hue, saturation and value parameters. More...
 
double Distance (const COLOR4D &other) const
 Returns the distance (in RGB space) between two colors. More...
 

Static Public Member Functions

static EDA_COLOR_T FindNearestLegacyColor (int aR, int aG, int aB)
 Returns a legacy color ID that is closest to the given 8-bit RGB values. More...
 

Public Attributes

double r
 Red component. More...
 
double g
 Green component. More...
 
double b
 Blue component. More...
 
double a
 Alpha component. More...
 

Static Public Attributes

static const COLOR4D UNSPECIFIED
 For legacy support; used as a value to indicate color hasn't been set yet. More...
 
static const COLOR4D WHITE
 
static const COLOR4D BLACK
 
static const COLOR4D CLEAR
 

Detailed Description

A color representation with 4 components: red, green, blue, alpha.

Definition at line 101 of file color4d.h.

Constructor & Destructor Documentation

◆ COLOR4D() [1/5]

KIGFX::COLOR4D::COLOR4D ( )
inline

Definition at line 105 of file color4d.h.

105 :
106 r( 0 ),
107 g( 0 ),
108 b( 0 ),
109 a( 1.0 )
110 {
111 }
double r
Red component.
Definition: color4d.h:372
double g
Green component.
Definition: color4d.h:373
double a
Alpha component.
Definition: color4d.h:375
double b
Blue component.
Definition: color4d.h:374

Referenced by Brightened(), Darkened(), Inverted(), Mix(), and WithAlpha().

◆ COLOR4D() [2/5]

KIGFX::COLOR4D::COLOR4D ( double  aRed,
double  aGreen,
double  aBlue,
double  aAlpha 
)
inline
Parameters
aRedis the red component [0.0 .. 1.0].
aGreenis the green component [0.0 .. 1.0].
aBlueis the blue component [0.0 .. 1.0].
aAlphais the alpha value [0.0 .. 1.0].

Definition at line 119 of file color4d.h.

119 :
120 r( aRed ),
121 g( aGreen ),
122 b( aBlue ),
123 a( aAlpha )
124 {
125 wxASSERT( r >= 0.0 && r <= 1.0 );
126 wxASSERT( g >= 0.0 && g <= 1.0 );
127 wxASSERT( b >= 0.0 && b <= 1.0 );
128 wxASSERT( a >= 0.0 && a <= 1.0 );
129 }

References a, b, g, and r.

◆ COLOR4D() [3/5]

COLOR4D::COLOR4D ( EDA_COLOR_T  aColor)
Parameters
aColoris one of KiCad's palette colors.
See also
EDA_COLOR_T

Definition at line 83 of file color4d.cpp.

84{
85 if( aColor <= UNSPECIFIED_COLOR || aColor >= NBCOLORS )
86 {
88 return;
89 }
90
91 int candidate = 0;
92
93 for( ; candidate < NBCOLORS; ++candidate )
94 {
95 if( colorRefs()[candidate].m_Numcolor == aColor )
96 break;
97 }
98
99 if( candidate >= NBCOLORS )
100 {
101 *this = COLOR4D::UNSPECIFIED;
102 return;
103 }
104
105 r = colorRefs()[candidate].m_Red / 255.0;
106 g = colorRefs()[candidate].m_Green / 255.0;
107 b = colorRefs()[candidate].m_Blue / 255.0;
108 a = 1.0;
109}
static const COLOR4D UNSPECIFIED
For legacy support; used as a value to indicate color hasn't been set yet.
Definition: color4d.h:378
const StructColors * colorRefs()
Global list of legacy color names, still used all over the place for constructing COLOR4D's.
Definition: color4d.cpp:39
@ NBCOLORS
Number of colors.
Definition: color4d.h:77
unsigned char m_Blue
Definition: color4d.h:84
unsigned char m_Green
Definition: color4d.h:85
unsigned char m_Red
Definition: color4d.h:86

References a, b, colorRefs(), g, StructColors::m_Blue, StructColors::m_Green, StructColors::m_Red, NBCOLORS, r, and UNSPECIFIED.

◆ COLOR4D() [4/5]

COLOR4D::COLOR4D ( const wxString &  aColorStr)

Defines a color from a CSS or HTML-type string.

Parameters
aColorStrinput string

Definition at line 112 of file color4d.cpp.

113{
114 if( !SetFromHexString( aColorStr ) )
115 SetFromWxString( aColorStr );
116}
bool SetFromWxString(const wxString &aColorString)
Set color values by parsing a string using wxColour::Set().
Definition: color4d.cpp:128
bool SetFromHexString(const wxString &aColorString)
Definition: color4d.cpp:176

References SetFromHexString(), and SetFromWxString().

◆ COLOR4D() [5/5]

COLOR4D::COLOR4D ( const wxColour &  aColor)
Parameters
aColoris the color type used by wxWidgets.

Definition at line 119 of file color4d.cpp.

120{
121 r = aColor.Red() / 255.0;
122 g = aColor.Green() / 255.0;
123 b = aColor.Blue() / 255.0;
124 a = aColor.Alpha() / 255.0;
125}

References a, b, g, and r.

Member Function Documentation

◆ Brighten()

COLOR4D & KIGFX::COLOR4D::Brighten ( double  aFactor)
inline

Makes the color brighter by a given factor.

Parameters
aFactorSpecifies how bright the color should become (valid values: 0.0 .. 1.0).
Returns
COLOR4D& Brightened color.

Definition at line 207 of file color4d.h.

208 {
209 wxASSERT( aFactor >= 0.0 && aFactor <= 1.0 );
210
211 r = r * ( 1.0 - aFactor ) + aFactor;
212 g = g * ( 1.0 - aFactor ) + aFactor;
213 b = b * ( 1.0 - aFactor ) + aFactor;
214
215 return *this;
216 }

References b, g, and r.

Referenced by KIGFX::PCB_RENDER_SETTINGS::GetColor().

◆ Brightened()

COLOR4D KIGFX::COLOR4D::Brightened ( double  aFactor) const
inline

Return a color that is brighter by a given factor, without modifying object.

Parameters
aFactorSpecifies how bright the color should become (valid values: 0.0 .. 1.0).
Returns
COLOR4D Highlighted color.

Definition at line 266 of file color4d.h.

267 {
268 wxASSERT( aFactor >= 0.0 && aFactor <= 1.0 );
269
270 return COLOR4D( r * ( 1.0 - aFactor ) + aFactor, g * ( 1.0 - aFactor ) + aFactor,
271 b * ( 1.0 - aFactor ) + aFactor, a );
272 }

References a, b, COLOR4D(), g, and r.

Referenced by KIGFX::SCH_PAINTER::drawDanglingSymbol(), KIGFX::SCH_PAINTER::drawPinDanglingSymbol(), KIGFX::DS_RENDER_SETTINGS::DS_RENDER_SETTINGS(), EXPORTER_PCB_VRML::EXPORTER_PCB_VRML(), KIGFX::GERBVIEW_RENDER_SETTINGS::LoadColors(), COLOR_SWATCH::MakeBitmap(), KIGFX::RENDER_SETTINGS::update(), and EDIT_POINTS::ViewDraw().

◆ Darken()

COLOR4D & KIGFX::COLOR4D::Darken ( double  aFactor)
inline

Makes the color darker by a given factor.

Parameters
aFactorSpecifies how dark the color should become (valid values: 0.0 .. 1.0).
Returns
COLOR4D& Darkened color.

Definition at line 224 of file color4d.h.

225 {
226 wxASSERT( aFactor >= 0.0 && aFactor <= 1.0 );
227
228 r = r * ( 1.0 - aFactor );
229 g = g * ( 1.0 - aFactor );
230 b = b * ( 1.0 - aFactor );
231
232 return *this;
233 }

References b, g, and r.

Referenced by KIGFX::PCB_RENDER_SETTINGS::GetColor().

◆ Darkened()

COLOR4D KIGFX::COLOR4D::Darkened ( double  aFactor) const
inline

Return a color that is darker by a given factor, without modifying object.

Parameters
aFactorSpecifies how dark the color should become (valid values: 0.0 .. 1.0).
Returns
COLOR4D Darkened color.

Definition at line 280 of file color4d.h.

281 {
282 wxASSERT( aFactor >= 0.0 && aFactor <= 1.0 );
283
284 return COLOR4D( r * ( 1.0 - aFactor ), g * ( 1.0 - aFactor ), b * ( 1.0 - aFactor ), a );
285 }

References a, b, COLOR4D(), g, and r.

Referenced by KIGFX::GERBVIEW_RENDER_SETTINGS::LoadColors(), COLOR_SWATCH::MakeBitmap(), KIGFX::RENDER_SETTINGS::update(), and EDIT_POINTS::ViewDraw().

◆ Desaturate()

COLOR4D & COLOR4D::Desaturate ( )

Removes color (in HSL model)

Returns
greyscale version of color

Definition at line 510 of file color4d.cpp.

511{
512 // One can desaturate a color only when r, v, b are not equal
513 if( r == g && r == b )
514 return *this;
515
516 double h, s, l;
517
518 ToHSL( h, s, l );
519 FromHSL( h, 0.0, l );
520
521 return *this;
522}
void ToHSL(double &aOutHue, double &aOutSaturation, double &aOutValue) const
Converts current color (stored in RGB) to HSL format.
Definition: color4d.cpp:295
void FromHSL(double aInHue, double aInSaturation, double aInLightness)
Change currently used color to the one given by hue, saturation and lightness parameters.
Definition: color4d.cpp:326

References b, FromHSL(), g, r, and ToHSL().

Referenced by KIGFX::SCH_PAINTER::draw(), LIB_PIN::PlotPinTexts(), LIB_SHAPE::print(), LIB_PIN::printPinTexts(), and KIGFX::SCH_PAINTER::setDeviceColors().

◆ Distance()

double COLOR4D::Distance ( const COLOR4D other) const

Returns the distance (in RGB space) between two colors.

Definition at line 531 of file color4d.cpp.

532{
533 return ( r - other.r ) * ( r - other.r )
534 + ( g - other.g ) * ( g - other.g )
535 + ( b - other.b ) * ( b - other.b );
536}

References b, g, and r.

Referenced by EDIT_POINTS::ViewDraw().

◆ FindNearestLegacyColor()

EDA_COLOR_T COLOR4D::FindNearestLegacyColor ( int  aR,
int  aG,
int  aB 
)
static

Returns a legacy color ID that is closest to the given 8-bit RGB values.

Definition at line 539 of file color4d.cpp.

540{
542
543 /* Find the 'nearest' color in the palette. This is fun. There is
544 a gazilion of metrics for the color space and no one of the
545 useful one is in the RGB color space. Who cares, this is a CAD,
546 not a photosomething...
547
548 I hereby declare that the distance is the sum of the square of the
549 component difference. Think about the RGB color cube. Now get the
550 euclidean distance, but without the square root... for ordering
551 purposes it's the same, obviously. Also each component can't be
552 less of the target one, since I found this currently work better...
553 */
554 int nearest_distance = 255 * 255 * 3 + 1; // Can't beat this
555
557 trying = static_cast<EDA_COLOR_T>( int( trying ) + 1 ) )
558 {
559 const StructColors &c = colorRefs()[trying];
560 int distance = ( aR - c.m_Red ) * ( aR - c.m_Red ) +
561 ( aG - c.m_Green ) * ( aG - c.m_Green ) +
562 ( aB - c.m_Blue ) * ( aB - c.m_Blue );
563
564 if( distance < nearest_distance && c.m_Red >= aR &&
565 c.m_Green >= aG && c.m_Blue >= aB )
566 {
567 nearest_distance = distance;
568 candidate = trying;
569 }
570 }
571
572 return candidate;
573}
EDA_COLOR_T
Legacy color enumeration.
Definition: color4d.h:40
@ BLACK
Definition: color4d.h:42
static float distance(const SFVEC2UI &a, const SFVEC2UI &b)

References BLACK, colorRefs(), distance(), StructColors::m_Blue, StructColors::m_Green, StructColors::m_Red, and NBCOLORS.

◆ FromCSSRGBA()

COLOR4D & COLOR4D::FromCSSRGBA ( int  aRed,
int  aGreen,
int  aBlue,
double  aAlpha = 1.0 
)

Initialize the color from a RGBA value with 0-255 red/green/blue and 0-1 alpha.

Suitable for taking the values directly from the "CSS syntax" from ToWxString.

Returns
this color.

Definition at line 576 of file color4d.cpp.

577{
578 r = std::max( 0, std::min( 255, aRed ) ) / 255.0;
579 g = std::max( 0, std::min( 255, aGreen ) ) / 255.0;
580 b = std::max( 0, std::min( 255, aBlue ) ) / 255.0;
581 a = std::max( 0.0, std::min( 1.0, aAlpha ) );
582
583 return *this;
584}

References a, b, g, and r.

Referenced by GetColorFromInt().

◆ FromHSL()

void COLOR4D::FromHSL ( double  aInHue,
double  aInSaturation,
double  aInLightness 
)

Change currently used color to the one given by hue, saturation and lightness parameters.

Parameters
aInHueis hue component, in degrees (0.0 - 360.0).
aInSaturationis saturation component (0.0 - 1.0).
aInLightnessis lightness component (0.0 - 1.0).

Definition at line 326 of file color4d.cpp.

327{
328 const auto P = ( 1.0 - std::abs( 2.0 * aInLightness - 1.0 ) ) * aInSaturation;
329 const auto scaled_hue = aInHue / 60.0;
330 const auto Q = P * ( 1.0 - std::abs( std::fmod( scaled_hue, 2.0 ) - 1.0 ) );
331
332 r = g = b = aInLightness - P / 2.0;
333
334 if (scaled_hue < 1.0)
335 {
336 r += P;
337 g += Q;
338 }
339 else if (scaled_hue < 2.0)
340 {
341 r += Q;
342 g += P;
343 }
344 else if (scaled_hue < 3.0)
345 {
346 g += P;
347 b += Q;
348 }
349 else if (scaled_hue < 4.0)
350 {
351 g += Q;
352 b += P;
353 }
354 else if (scaled_hue < 5.0)
355 {
356 r += Q;
357 b += P;
358 }
359 else
360 {
361 r += P;
362 b += Q;
363 }
364}
EDA_ANGLE abs(const EDA_ANGLE &aAngle)
Definition: eda_angle.h:418

References std::abs(), b, g, and r.

Referenced by BOOST_AUTO_TEST_CASE(), and Desaturate().

◆ FromHSV()

void COLOR4D::FromHSV ( double  aInH,
double  aInS,
double  aInV 
)

Changes currently used color to the one given by hue, saturation and value parameters.

Parameters
aInHis hue component, in degrees.
aInSis saturation component.
aInVis value component.

Definition at line 421 of file color4d.cpp.

422{
423 if( aInS <= 0.0 )
424 {
425 r = aInV;
426 g = aInV;
427 b = aInV;
428 return;
429 }
430
431 double hh = aInH;
432
433 while( hh >= 360.0 )
434 hh -= 360.0;
435
436 /* Hue in degrees (0...360) is coded according to this table
437 * 0 or 360 : red
438 * 60 : yellow
439 * 120 : green
440 * 180 : cyan
441 * 240 : blue
442 * 300 : magenta
443 */
444 hh /= 60.0;
445
446 int i = (int) hh;
447 double ff = hh - i;
448
449 double p = aInV * ( 1.0 - aInS );
450 double q = aInV * ( 1.0 - ( aInS * ff ) );
451 double t = aInV * ( 1.0 - ( aInS * ( 1.0 - ff ) ) );
452
453 switch( i )
454 {
455 case 0:
456 r = aInV;
457 g = t;
458 b = p;
459 break;
460
461 case 1:
462 r = q;
463 g = aInV;
464 b = p;
465 break;
466
467 case 2:
468 r = p;
469 g = aInV;
470 b = t;
471 break;
472
473 case 3:
474 r = p;
475 g = q;
476 b = aInV;
477 break;
478
479 case 4:
480 r = t;
481 g = p;
482 b = aInV;
483 break;
484
485 case 5:
486 default:
487 r = aInV;
488 g = p;
489 b = q;
490 break;
491 }
492}

References b, g, and r.

Referenced by BOOST_AUTO_TEST_CASE(), DIALOG_COLOR_PICKER::OnChangeBrightness(), DIALOG_COLOR_PICKER::OnChangeEditHue(), DIALOG_COLOR_PICKER::OnChangeEditSat(), Saturate(), and DIALOG_COLOR_PICKER::setHSvaluesFromCursor().

◆ GetBrightness()

double KIGFX::COLOR4D::GetBrightness ( ) const
inline

Returns the brightness value of the color ranged from 0.0 to 1.0.

Returns
The brightness value.

Definition at line 331 of file color4d.h.

332 {
333 // Weighted W3C formula
334 return r * 0.299 + g * 0.587 + b * 0.117;
335 }

References b, g, and r.

Referenced by RC_TREE_MODEL::GetAttr(), KIGFX::PREVIEW::GetShadowColor(), KIGFX::SCH_RENDER_SETTINGS::IsBackgroundDark(), KIGFX::DS_RENDER_SETTINGS::IsBackgroundDark(), KIGFX::PCB_RENDER_SETTINGS::IsBackgroundDark(), COLOR_SWATCH::MakeBitmap(), and EDIT_POINTS::ViewDraw().

◆ Invert()

COLOR4D & KIGFX::COLOR4D::Invert ( )
inline

Makes the color inverted, alpha remains the same.

Returns
COLOR4D& Inverted color.

Definition at line 240 of file color4d.h.

241 {
242 r = ( 1.0 - r );
243 g = ( 1.0 - g );
244 b = ( 1.0 - b );
245
246 return *this;
247 }

References b, g, and r.

Referenced by EDIT_POINTS::ViewDraw().

◆ Inverted()

COLOR4D KIGFX::COLOR4D::Inverted ( ) const
inline

Returns an inverted color, alpha remains the same.

Returns
COLOR4D& Inverted color.

Definition at line 321 of file color4d.h.

322 {
323 return COLOR4D( 1.0 - r, 1.0 - g, 1.0 - b, a );
324 }

References a, b, COLOR4D(), g, and r.

Referenced by KIGFX::PCB_RENDER_SETTINGS::LoadColors().

◆ LegacyMix()

COLOR4D COLOR4D::LegacyMix ( const COLOR4D aColor) const

Mix this COLOR4D with an input COLOR4D using the OR-mixing of legacy canvas.

Can be removed once legacy canvas is removed. Depends on wxColour for simplicity, but could be re-written to avoid this dependency if desired.

Parameters
aColorThe color to mix with this one

Definition at line 230 of file color4d.cpp.

231{
232 COLOR4D candidate;
233
234 // Blend the two colors (i.e. OR the RGB values)
235 candidate.r = ( (unsigned) ( 255.0 * r ) | (unsigned) ( 255.0 * aColor.r ) ) / 255.0,
236 candidate.g = ( (unsigned) ( 255.0 * g ) | (unsigned) ( 255.0 * aColor.g ) ) / 255.0,
237 candidate.b = ( (unsigned) ( 255.0 * b ) | (unsigned) ( 255.0 * aColor.b ) ) / 255.0,
238
239 // the alpha channel can be reinitialized but what is the best value?
240 candidate.a = ( aColor.a + a ) / 2;
241
242 return candidate;
243}
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:102

References a, b, g, and r.

◆ Mix()

COLOR4D KIGFX::COLOR4D::Mix ( const COLOR4D aColor,
double  aFactor 
) const
inline

Return a color that is mixed with the input by a factor.

Parameters
aFactorSpecifies how much of the original color to keep (valid values: 0.0 .. 1.0).
Returns
COLOR4D Mixed color.

Definition at line 293 of file color4d.h.

294 {
295 wxASSERT( aFactor >= 0.0 && aFactor <= 1.0 );
296
297 return COLOR4D( aColor.r * ( 1.0 - aFactor ) + r * aFactor,
298 aColor.g * ( 1.0 - aFactor ) + g * aFactor,
299 aColor.b * ( 1.0 - aFactor ) + b * aFactor,
300 a );
301 }

References a, b, COLOR4D(), g, and r.

Referenced by KIGFX::SCH_PAINTER::draw(), EXPORTER_PCB_VRML::EXPORTER_PCB_VRML(), getBorderColour(), BOARD_ADAPTER::InitSettings(), WX_PANEL::OnPaint(), CURSOR::Plot(), LIB_PIN::PlotPinTexts(), LIB_SHAPE::print(), LIB_PIN::printPinTexts(), KIGFX::SCH_PAINTER::setDeviceColors(), SCINTILLA_TRICKS::setupStyles(), and KIGFX::RENDER_SETTINGS::update().

◆ Saturate()

COLOR4D & COLOR4D::Saturate ( double  aFactor)

Saturates the color to a given factor (in HSV model)

Definition at line 495 of file color4d.cpp.

496{
497 // One can saturate a color only when r, v, b are not equal
498 if( r == g && r == b )
499 return *this;
500
501 double h, s, v;
502
503 ToHSV( h, s, v, true );
504 FromHSV( h, aFactor, 1.0 );
505
506 return *this;
507}
void ToHSV(double &aOutHue, double &aOutSaturation, double &aOutValue, bool aAlwaysDefineHue=false) const
Convert current color (stored in RGB) to HSV format.
Definition: color4d.cpp:367
void FromHSV(double aInH, double aInS, double aInV)
Changes currently used color to the one given by hue, saturation and value parameters.
Definition: color4d.cpp:421

References b, FromHSV(), g, r, and ToHSV().

◆ SetFromHexString()

bool COLOR4D::SetFromHexString ( const wxString &  aColorString)

Definition at line 176 of file color4d.cpp.

177{
178 wxString str = aColorString;
179 str.Trim( true );
180 str.Trim( false );
181
182 if( str.length() < 7 || str.GetChar( 0 ) != '#' )
183 return false;
184
185 unsigned long tmp;
186
187 if( wxSscanf( str.wx_str() + 1, wxT( "%lx" ), &tmp ) != 1 )
188 return false;
189
190 if( str.length() >= 9 )
191 {
192 r = ( (tmp >> 24) & 0xFF ) / 255.0;
193 g = ( (tmp >> 16) & 0xFF ) / 255.0;
194 b = ( (tmp >> 8) & 0xFF ) / 255.0;
195 a = ( tmp & 0xFF ) / 255.0;
196 }
197 else
198 {
199 r = ( (tmp >> 16) & 0xFF ) / 255.0;
200 g = ( (tmp >> 8) & 0xFF ) / 255.0;
201 b = ( tmp & 0xFF ) / 255.0;
202 a = 1.0;
203 }
204
205 return true;
206}

References a, b, g, and r.

Referenced by COLOR4D(), and DIALOG_COLOR_PICKER::OnColorValueText().

◆ SetFromWxString()

bool COLOR4D::SetFromWxString ( const wxString &  aColorString)

Set color values by parsing a string using wxColour::Set().

Parameters
aColorStringis a color string that wxColour can understand.
Returns
true if color was set successfully.

Definition at line 128 of file color4d.cpp.

129{
130 wxColour c;
131
132 if( c.Set( aColorString ) )
133 {
134 r = c.Red() / 255.0;
135 g = c.Green() / 255.0;
136 b = c.Blue() / 255.0;
137 a = c.Alpha() / 255.0;
138
139 return true;
140 }
141
142 return false;
143}

References a, b, g, and r.

Referenced by GRID_CELL_COLOR_SELECTOR::BeginEdit(), COLOR4D(), KIGFX::from_json(), and NET_GRID_TABLE::SetValue().

◆ ToColour()

◆ ToCSSString()

wxString COLOR4D::ToCSSString ( ) const

Definition at line 146 of file color4d.cpp.

147{
148 wxColour c = ToColour();
149 wxString str;
150
151 const int red = c.Red();
152 const int green = c.Green();
153 const int blue = c.Blue();
154 const int alpha = c.Alpha();
155
156 if ( alpha == wxALPHA_OPAQUE )
157 {
158 str.Printf( wxT( "rgb(%d, %d, %d)" ), red, green, blue );
159 }
160 else // use rgba() form
161 {
162 wxString alpha_str = wxString::FromCDouble( alpha / 255.0, 3 );
163
164 // The wxC2S_CSS_SYNTAX is particularly sensitive to ','s (as it uses them for value
165 // delimiters), and wxWidgets is known to be buggy in this respect when dealing with
166 // Serbian and Russian locales (at least), so we enforce an extra level of safety.
167 alpha_str.Replace( wxT( "," ), wxT( "." ) );
168
169 str.Printf( wxT( "rgba(%d, %d, %d, %s)" ), red, green, blue, alpha_str );
170 }
171
172 return str;
173}
wxColour ToColour() const
Definition: color4d.cpp:219

References red, and ToColour().

Referenced by COLOR_SETTINGS::COLOR_SETTINGS(), GRID_CELL_COLOR_SELECTOR::GetValue(), KIGFX::operator<<(), SCH_LEGACY_PLUGIN::saveLine(), SIMULATOR_FRAME::SaveWorkbook(), and KIGFX::to_json().

◆ ToHexString()

wxString COLOR4D::ToHexString ( ) const

Definition at line 209 of file color4d.cpp.

210{
211 return wxString::Format( wxT("#%02X%02X%02X%02X" ),
212 KiROUND( r * 255.0 ),
213 KiROUND( g * 255.0 ),
214 KiROUND( b * 255.0 ),
215 KiROUND( a * 255.0 ) );
216}
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:200
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: util.h:85

References a, b, Format(), g, KiROUND(), and r.

Referenced by DIALOG_COLOR_PICKER::SetEditVals().

◆ ToHSL()

void COLOR4D::ToHSL ( double &  aOutHue,
double &  aOutSaturation,
double &  aOutValue 
) const

Converts current color (stored in RGB) to HSL format.

Parameters
aOutHueis the conversion result for hue component, in degrees 0 ... 360.0.
aOutSaturationis the conversion result for saturation component (0 ... 1.0).
aOutLightnessis conversion result for value component (0 ... 1.0).
Note
saturation is set to 0.0 for black color if r = g = b,

Definition at line 295 of file color4d.cpp.

296{
297 auto min = std::min( r, std::min( g, b ) );
298 auto max = std::max( r, std::max( g, b ) );
299 auto diff = max - min;
300
301 aOutLightness = ( max + min ) / 2.0;
302
303 if( aOutLightness >= 1.0 )
304 aOutSaturation = 0.0;
305 else
306 aOutSaturation = diff / ( 1.0 - std::abs( 2.0 * aOutLightness - 1.0 ) );
307
308 double hue;
309
310 if( diff <= 0.0 )
311 hue = 0.0;
312 else if( max == r )
313 hue = ( g - b ) / diff;
314 else if( max == g )
315 hue = ( b - r ) / diff + 2.0;
316 else
317 hue = ( r - g ) / diff + 4.0;
318
319 aOutHue = hue > 0.0 ? hue * 60.0 : hue * 60.0 + 360.0;
320
321 while( aOutHue < 0.0 )
322 aOutHue += 360.0;
323}

References std::abs(), b, g, and r.

Referenced by Desaturate(), and PNS_TUNE_STATUS_POPUP::UpdateStatus().

◆ ToHSV()

void COLOR4D::ToHSV ( double &  aOutHue,
double &  aOutSaturation,
double &  aOutValue,
bool  aAlwaysDefineHue = false 
) const

Convert current color (stored in RGB) to HSV format.

Parameters
aOutHueis the conversion result for hue component, in degrees 0 ... 360.0.
aOutSaturationis the conversion result for saturation component (0 ... 1.0).
aOutValueis conversion result for value component (0 ... 1.0).
aAlwaysDefineHuecontrols the way hue is defined when r = v = b
Note
saturation is set to 0.0 for black color (r = v = b = 0), and if r = v = b, hue is set to 0.0 if aAlwaysDefineHue = true, and set to NAN if aAlwaysDefineHue = false. this option is useful to convert a 4D color to a legacy color, because Red has hue = 0, therefore aAlwaysDefineHue = false makes difference between Red and Gray colors.

Definition at line 367 of file color4d.cpp.

369{
370 double min, max, delta;
371
372 min = r < g ? r : g;
373 min = min < b ? min : b;
374
375 max = r > g ? r : g;
376 max = max > b ? max : b;
377
378 aOutValue = max; // value
379 delta = max - min;
380
381 if( max > 0.0 )
382 {
383 aOutSaturation = ( delta / max );
384 }
385 else // for black color (r = g = b = 0 ) saturation is set to 0.
386 {
387 aOutSaturation = 0.0;
388 aOutHue = aAlwaysDefineHue ? 0.0 : NAN;
389 return;
390 }
391
392 /* Hue in degrees (0...360) is coded according to this table
393 * 0 or 360 : red
394 * 60 : yellow
395 * 120 : green
396 * 180 : cyan
397 * 240 : blue
398 * 300 : magenta
399 */
400 if( delta != 0.0 )
401 {
402 if( r >= max )
403 aOutHue = ( g - b ) / delta; // between yellow & magenta
404 else if( g >= max )
405 aOutHue = 2.0 + ( b - r ) / delta; // between cyan & yellow
406 else
407 aOutHue = 4.0 + ( r - g ) / delta; // between magenta & cyan
408
409 aOutHue *= 60.0; // degrees
410
411 if( aOutHue < 0.0 )
412 aOutHue += 360.0;
413 }
414 else // delta = 0 means r = g = b. hue is set to 0.0
415 {
416 aOutHue = aAlwaysDefineHue ? 0.0 : NAN;
417 }
418}
constexpr int delta

References b, delta, g, and r.

Referenced by DIALOG_COLOR_PICKER::buttColorClick(), DIALOG_COLOR_PICKER::DIALOG_COLOR_PICKER(), DIALOG_COLOR_PICKER::OnColorValueText(), DIALOG_COLOR_PICKER::OnResetButton(), DIALOG_COLOR_PICKER::onRGBMouseDrag(), Saturate(), and DIALOG_COLOR_PICKER::SetEditVals().

◆ WithAlpha()

COLOR4D KIGFX::COLOR4D::WithAlpha ( double  aAlpha) const
inline

Return a color with the same color, but the given alpha.

Parameters
aAlphaspecifies the alpha of the new color
Returns
COLOR4D color with that alpha

Definition at line 309 of file color4d.h.

310 {
311 wxASSERT( aAlpha >= 0.0 && aAlpha <= 1.0 );
312
313 return COLOR4D( r, g, b, aAlpha );
314 }

References b, COLOR4D(), g, and r.

Referenced by PNS_PCBNEW_DEBUG_DECORATOR::AddItem(), PNS_PCBNEW_DEBUG_DECORATOR::AddShape(), PNS_LOG_VIEWER_OVERLAY::Arc(), deemphasise(), LAYER_SELECTOR::DrawColorSwatch(), BOARD_PRINTOUT::DrawPage(), FAB_LAYER_COLOR::GetColor(), KIGFX::PCB_RENDER_SETTINGS::GetColor(), COLOR_SWATCH::MakeBitmap(), PCB_GRID_HELPER::PCB_GRID_HELPER(), PCB_EDIT_FRAME::PrepareLayerIndicator(), SCINTILLA_TRICKS::setupStyles(), and EDIT_POINTS::ViewDraw().

Member Data Documentation

◆ a

double KIGFX::COLOR4D::a

Alpha component.

Definition at line 375 of file color4d.h.

Referenced by KIGFX::OPENGL_GAL::BitmapText(), KIGFX::OPENGL_GAL::blitCursor(), KIGFX::CAIRO_GAL_BASE::blitCursor(), Brightened(), DIALOG_COLOR_PICKER::buttColorClick(), KIGFX::CAIRO_GAL_BASE::ChangeGroupColor(), KIGFX::VERTEX_MANAGER::ChangeItemColor(), KIGFX::VERTEX_MANAGER::Color(), COLOR4D(), CUSTOM_COLOR_ITEM::CUSTOM_COLOR_ITEM(), Darkened(), DIALOG_COLOR_PICKER::DIALOG_COLOR_PICKER(), KIGFX::PCB_PAINTER::draw(), KIGFX::OPENGL_GAL::DrawArc(), KIGFX::CAIRO_GAL_BASE::DrawArcSegment(), KIGFX::OPENGL_GAL::DrawArcSegment(), KIGFX::CAIRO_GAL_BASE::drawAxes(), KIGFX::OPENGL_GAL::drawBitmapOverbar(), KIGFX::OPENGL_GAL::drawCircle(), KIGFX::OPENGL_GAL::DrawGrid(), KIGFX::CAIRO_GAL_BASE::drawGridCross(), KIGFX::CAIRO_GAL_BASE::drawGridLine(), KIGFX::CAIRO_GAL_BASE::drawGridPoint(), KIGFX::CAIRO_GAL_BASE::DrawGroup(), KIGFX::OPENGL_GAL::DrawLine(), KIGFX::OPENGL_GAL::drawPolygon(), KIGFX::OPENGL_GAL::drawPolyline(), KIGFX::OPENGL_GAL::DrawRectangle(), KIGFX::CAIRO_GAL_BASE::DrawSegment(), KIGFX::OPENGL_GAL::drawSegment(), KIGFX::OPENGL_GAL::drawSegmentChain(), KIGFX::OPENGL_GAL::drawSemiCircle(), KIGFX::OPENGL_GAL::drawTriangulatedPolyset(), EXPORTER_PCB_VRML::EXPORTER_PCB_VRML(), KIGFX::CAIRO_GAL_BASE::flushPath(), DS_DATA_MODEL_IO::format(), formatFill(), FromCSSRGBA(), BOARD_ADAPTER::GetColor(), BOARD_ADAPTER::InitSettings(), Inverted(), KI_TEST::IsColorNear(), KI_TEST::IsColorNearHex(), PCB_CONTROL::LayerAlphaDec(), PCB_CONTROL::LayerAlphaInc(), LegacyMix(), KIGFX::GERBVIEW_RENDER_SETTINGS::LoadColors(), KIGFX::PCB_RENDER_SETTINGS::LoadColors(), PANEL_PREVIEW_3D_MODEL::loadSettings(), Mix(), DIALOG_COLOR_PICKER::OnChangeAlpha(), DIALOG_COLOR_PICKER::OnResetButton(), KIGFX::operator<(), KIGFX::operator==(), DRAWING_SHEET_PARSER::parseText(), SCH_SEXPR_PLUGIN::saveJunction(), SCH_SEXPR_PLUGIN::saveSheet(), DIALOG_COLOR_PICKER::SetEditVals(), KIGFX::CAIRO_GAL_BASE::SetFillColor(), SetFromHexString(), SetFromWxString(), SCH_LINE::SetLineColor(), KIGFX::CAIRO_GAL_BASE::SetStrokeColor(), SCINTILLA_TRICKS::setupStyles(), KIGFX::CAIRO_GAL_BASE::storePath(), ToColour(), ToHexString(), and ROUTER_PREVIEW_ITEM::Update().

◆ b

double KIGFX::COLOR4D::b

Blue component.

Definition at line 374 of file color4d.h.

Referenced by KIGFX::OPENGL_GAL::BitmapText(), KIGFX::OPENGL_GAL::blitCursor(), KIGFX::CAIRO_GAL_BASE::blitCursor(), Brighten(), Brightened(), DIALOG_COLOR_PICKER::buttColorClick(), KIGFX::CAIRO_GAL_BASE::ChangeGroupColor(), KIGFX::VERTEX_MANAGER::ChangeItemColor(), KIGFX::OPENGL_COMPOSITOR::ClearBuffer(), KIGFX::CAIRO_GAL_BASE::ClearScreen(), KIGFX::VERTEX_MANAGER::Color(), COLOR4D(), EXPORTER_STEP::composePCB(), CUSTOM_COLOR_ITEM::CUSTOM_COLOR_ITEM(), Darken(), Darkened(), Desaturate(), Distance(), KIGFX::OPENGL_GAL::DrawArc(), KIGFX::CAIRO_GAL_BASE::DrawArcSegment(), KIGFX::OPENGL_GAL::DrawArcSegment(), KIGFX::CAIRO_GAL_BASE::drawAxes(), KIGFX::OPENGL_GAL::drawBitmapOverbar(), KIGFX::OPENGL_GAL::drawCircle(), KIGFX::OPENGL_GAL::DrawGrid(), KIGFX::CAIRO_GAL_BASE::drawGridCross(), KIGFX::CAIRO_GAL_BASE::drawGridLine(), KIGFX::CAIRO_GAL_BASE::drawGridPoint(), KIGFX::CAIRO_GAL_BASE::DrawGroup(), KIGFX::OPENGL_GAL::DrawLine(), KIGFX::OPENGL_GAL::drawPolygon(), KIGFX::OPENGL_GAL::drawPolyline(), KIGFX::OPENGL_GAL::DrawRectangle(), DIALOG_COLOR_PICKER::drawRGBPalette(), KIGFX::CAIRO_GAL_BASE::DrawSegment(), KIGFX::OPENGL_GAL::drawSegment(), KIGFX::OPENGL_GAL::drawSegmentChain(), KIGFX::OPENGL_GAL::drawSemiCircle(), KIGFX::OPENGL_GAL::drawTriangulatedPolyset(), EXPORTER_PCB_VRML::EXPORTER_PCB_VRML(), KIGFX::CAIRO_GAL_BASE::flushPath(), DS_DATA_MODEL_IO::format(), formatFill(), FromCSSRGBA(), FromHSL(), FromHSV(), GetBrightness(), BOARD_ADAPTER::GetColor(), FAB_LAYER_COLOR::GetColorAsString(), getDXFColorName(), TRANSLINE::Init(), Invert(), Inverted(), KI_TEST::IsColorNear(), KI_TEST::IsColorNearHex(), LegacyMix(), PANEL_PREVIEW_3D_MODEL::loadSettings(), Mix(), DIALOG_COLOR_PICKER::OnChangeEditBlue(), DIALOG_COLOR_PICKER::OnResetButton(), DIALOG_COLOR_PICKER::onRGBMouseDrag(), KIGFX::operator<(), KIGFX::operator==(), DRAWING_SHEET_PARSER::parseText(), Saturate(), SCH_SEXPR_PLUGIN::saveJunction(), SCH_SEXPR_PLUGIN::saveSheet(), DIALOG_COLOR_PICKER::SetEditVals(), KIGFX::CAIRO_GAL_BASE::SetFillColor(), SetFromHexString(), SetFromWxString(), PANEL_TRANSLINE::SetPrmBgColor(), KIGFX::CAIRO_GAL_BASE::SetStrokeColor(), KIGFX::CAIRO_GAL_BASE::storePath(), ToColour(), ToHexString(), ToHSL(), ToHSV(), KIGFX::RENDER_SETTINGS::update(), RATSNEST_VIEW_ITEM::ViewDraw(), and WithAlpha().

◆ BLACK

◆ CLEAR

const COLOR4D COLOR4D::CLEAR
static

Definition at line 383 of file color4d.h.

Referenced by KIGFX::PCB_PAINTER::draw(), and KIGFX::PCB_RENDER_SETTINGS::GetColor().

◆ g

double KIGFX::COLOR4D::g

Green component.

Definition at line 373 of file color4d.h.

Referenced by KIGFX::OPENGL_GAL::BitmapText(), KIGFX::OPENGL_GAL::blitCursor(), KIGFX::CAIRO_GAL_BASE::blitCursor(), Brighten(), Brightened(), DIALOG_COLOR_PICKER::buttColorClick(), KIGFX::CAIRO_GAL_BASE::ChangeGroupColor(), KIGFX::VERTEX_MANAGER::ChangeItemColor(), KIGFX::OPENGL_COMPOSITOR::ClearBuffer(), KIGFX::CAIRO_GAL_BASE::ClearScreen(), KIGFX::VERTEX_MANAGER::Color(), COLOR4D(), EXPORTER_STEP::composePCB(), CUSTOM_COLOR_ITEM::CUSTOM_COLOR_ITEM(), Darken(), Darkened(), Desaturate(), Distance(), KIGFX::OPENGL_GAL::DrawArc(), KIGFX::CAIRO_GAL_BASE::DrawArcSegment(), KIGFX::OPENGL_GAL::DrawArcSegment(), KIGFX::CAIRO_GAL_BASE::drawAxes(), KIGFX::OPENGL_GAL::drawBitmapOverbar(), KIGFX::OPENGL_GAL::drawCircle(), KIGFX::OPENGL_GAL::DrawGrid(), KIGFX::CAIRO_GAL_BASE::drawGridCross(), KIGFX::CAIRO_GAL_BASE::drawGridLine(), KIGFX::CAIRO_GAL_BASE::drawGridPoint(), KIGFX::CAIRO_GAL_BASE::DrawGroup(), KIGFX::OPENGL_GAL::DrawLine(), KIGFX::OPENGL_GAL::drawPolygon(), KIGFX::OPENGL_GAL::drawPolyline(), KIGFX::OPENGL_GAL::DrawRectangle(), DIALOG_COLOR_PICKER::drawRGBPalette(), KIGFX::CAIRO_GAL_BASE::DrawSegment(), KIGFX::OPENGL_GAL::drawSegment(), KIGFX::OPENGL_GAL::drawSegmentChain(), KIGFX::OPENGL_GAL::drawSemiCircle(), KIGFX::OPENGL_GAL::drawTriangulatedPolyset(), EXPORTER_PCB_VRML::EXPORTER_PCB_VRML(), KIGFX::CAIRO_GAL_BASE::flushPath(), DS_DATA_MODEL_IO::format(), formatFill(), FromCSSRGBA(), FromHSL(), FromHSV(), GetBrightness(), BOARD_ADAPTER::GetColor(), FAB_LAYER_COLOR::GetColorAsString(), getDXFColorName(), TRANSLINE::Init(), Invert(), Inverted(), KI_TEST::IsColorNear(), KI_TEST::IsColorNearHex(), LegacyMix(), PANEL_PREVIEW_3D_MODEL::loadSettings(), Mix(), DIALOG_COLOR_PICKER::OnChangeEditGreen(), DIALOG_COLOR_PICKER::OnResetButton(), DIALOG_COLOR_PICKER::onRGBMouseDrag(), KIGFX::operator<(), KIGFX::operator==(), DRAWING_SHEET_PARSER::parseText(), Saturate(), SCH_SEXPR_PLUGIN::saveJunction(), SCH_SEXPR_PLUGIN::saveSheet(), DIALOG_COLOR_PICKER::SetEditVals(), KIGFX::CAIRO_GAL_BASE::SetFillColor(), SetFromHexString(), SetFromWxString(), PANEL_TRANSLINE::SetPrmBgColor(), KIGFX::CAIRO_GAL_BASE::SetStrokeColor(), KIGFX::CAIRO_GAL_BASE::storePath(), ToColour(), ToHexString(), ToHSL(), ToHSV(), and WithAlpha().

◆ r

double KIGFX::COLOR4D::r

Red component.

Definition at line 372 of file color4d.h.

Referenced by KIGFX::OPENGL_GAL::BitmapText(), KIGFX::OPENGL_GAL::blitCursor(), KIGFX::CAIRO_GAL_BASE::blitCursor(), Brighten(), Brightened(), DIALOG_COLOR_PICKER::buttColorClick(), KIGFX::CAIRO_GAL_BASE::ChangeGroupColor(), KIGFX::VERTEX_MANAGER::ChangeItemColor(), KIGFX::OPENGL_COMPOSITOR::ClearBuffer(), KIGFX::CAIRO_GAL_BASE::ClearScreen(), KIGFX::VERTEX_MANAGER::Color(), COLOR4D(), EXPORTER_STEP::composePCB(), CUSTOM_COLOR_ITEM::CUSTOM_COLOR_ITEM(), Darken(), Darkened(), Desaturate(), Distance(), KIGFX::OPENGL_GAL::DrawArc(), KIGFX::CAIRO_GAL_BASE::DrawArcSegment(), KIGFX::OPENGL_GAL::DrawArcSegment(), KIGFX::CAIRO_GAL_BASE::drawAxes(), KIGFX::OPENGL_GAL::drawBitmapOverbar(), KIGFX::OPENGL_GAL::drawCircle(), KIGFX::OPENGL_GAL::DrawGrid(), KIGFX::CAIRO_GAL_BASE::drawGridCross(), KIGFX::CAIRO_GAL_BASE::drawGridLine(), KIGFX::CAIRO_GAL_BASE::drawGridPoint(), KIGFX::CAIRO_GAL_BASE::DrawGroup(), KIGFX::OPENGL_GAL::DrawLine(), KIGFX::OPENGL_GAL::drawPolygon(), KIGFX::OPENGL_GAL::drawPolyline(), KIGFX::OPENGL_GAL::DrawRectangle(), DIALOG_COLOR_PICKER::drawRGBPalette(), KIGFX::CAIRO_GAL_BASE::DrawSegment(), KIGFX::OPENGL_GAL::drawSegment(), KIGFX::OPENGL_GAL::drawSegmentChain(), KIGFX::OPENGL_GAL::drawSemiCircle(), KIGFX::OPENGL_GAL::drawTriangulatedPolyset(), EXPORTER_PCB_VRML::EXPORTER_PCB_VRML(), KIGFX::CAIRO_GAL_BASE::flushPath(), DS_DATA_MODEL_IO::format(), formatFill(), FromCSSRGBA(), FromHSL(), FromHSV(), GetBrightness(), BOARD_ADAPTER::GetColor(), FAB_LAYER_COLOR::GetColorAsString(), getDXFColorName(), TRANSLINE::Init(), Invert(), Inverted(), KI_TEST::IsColorNear(), KI_TEST::IsColorNearHex(), LegacyMix(), PANEL_PREVIEW_3D_MODEL::loadSettings(), Mix(), DIALOG_COLOR_PICKER::OnChangeEditRed(), DIALOG_COLOR_PICKER::OnResetButton(), DIALOG_COLOR_PICKER::onRGBMouseDrag(), KIGFX::operator<(), KIGFX::operator==(), DRAWING_SHEET_PARSER::parseText(), Saturate(), SCH_SEXPR_PLUGIN::saveJunction(), SCH_SEXPR_PLUGIN::saveSheet(), DIALOG_COLOR_PICKER::SetEditVals(), KIGFX::CAIRO_GAL_BASE::SetFillColor(), SetFromHexString(), SetFromWxString(), PANEL_TRANSLINE::SetPrmBgColor(), KIGFX::CAIRO_GAL_BASE::SetStrokeColor(), KIGFX::CAIRO_GAL_BASE::storePath(), ToColour(), ToHexString(), ToHSL(), ToHSV(), and WithAlpha().

◆ UNSPECIFIED

const COLOR4D COLOR4D::UNSPECIFIED
static

For legacy support; used as a value to indicate color hasn't been set yet.

Definition at line 378 of file color4d.h.

Referenced by COLOR4D(), STROKE_PARAMS::Format(), KIGFX::DS_RENDER_SETTINGS::GetColor(), KIGFX::PCB_RENDER_SETTINGS::GetColor(), and KIGFX::SCH_PAINTER::getRenderColor().

◆ WHITE

const COLOR4D COLOR4D::WHITE
static

Definition at line 381 of file color4d.h.

Referenced by PNS_DEBUG_SHAPE::PNS_DEBUG_SHAPE().


The documentation for this class was generated from the following files: