37 UNSPECIFIED_COLOR = -1,
74 HIGHLIGHT_FLAG = ( 1<<19 ),
81 unsigned char m_Green;
83 EDA_COLOR_T m_Numcolor;
84 std::string m_ColorName;
85 EDA_COLOR_T m_LightColor;
115 COLOR4D(
double aRed,
double aGreen,
double aBlue,
double aAlpha ) :
121 wxASSERT(
r >= 0.0 &&
r <= 1.0 );
122 wxASSERT(
g >= 0.0 &&
g <= 1.0 );
123 wxASSERT(
b >= 0.0 &&
b <= 1.0 );
124 wxASSERT(
a >= 0.0 &&
a <= 1.0 );
142#ifdef WX_COMPATIBILITY
146 COLOR4D(
const wxColour& aColor );
154 bool SetFromWxString(
const wxString& aColorString );
156 wxString ToWxString(
long flags )
const;
158 bool SetFromHexString(
const wxString& aColorString );
161 wxColour ToColour()
const;
178 unsigned int ToU32()
const;
183 void FromU32(
unsigned int aPackedColor );
195 void ToHSL(
double& aOutHue,
double& aOutSaturation,
double& aOutValue )
const;
204 void FromHSL(
double aInHue,
double aInSaturation,
double aInLightness );
214 wxASSERT( aFactor >= 0.0 && aFactor <= 1.0 );
216 r =
r * ( 1.0 - aFactor ) + aFactor;
217 g =
g * ( 1.0 - aFactor ) + aFactor;
218 b =
b * ( 1.0 - aFactor ) + aFactor;
231 wxASSERT( aFactor >= 0.0 && aFactor <= 1.0 );
233 r =
r * ( 1.0 - aFactor );
234 g =
g * ( 1.0 - aFactor );
235 b =
b * ( 1.0 - aFactor );
267 wxASSERT( aFactor >= 0.0 && aFactor <= 1.0 );
269 return COLOR4D(
r * ( 1.0 - aFactor ) + aFactor,
g * ( 1.0 - aFactor ) + aFactor,
270 b * ( 1.0 - aFactor ) + aFactor,
a );
281 wxASSERT( aFactor >= 0.0 && aFactor <= 1.0 );
283 return COLOR4D(
r * ( 1.0 - aFactor ),
g * ( 1.0 - aFactor ),
b * ( 1.0 - aFactor ),
a );
294 wxASSERT( aFactor >= 0.0 && aFactor <= 1.0 );
296 return COLOR4D( aColor.
r * ( 1.0 - aFactor ) +
r * aFactor,
297 aColor.
g * ( 1.0 - aFactor ) +
g * aFactor,
298 aColor.
b * ( 1.0 - aFactor ) +
b * aFactor,
310 wxASSERT( aAlpha >= 0.0 && aAlpha <= 1.0 );
333 return r * 0.299 +
g * 0.587 +
b * 0.117;
348 void ToHSV(
double& aOutHue,
double& aOutSaturation,
double& aOutValue,
349 bool aAlwaysDefineHue =
false )
const;
358 void FromHSV(
double aInH,
double aInS,
double aInV );
394std::ostream &operator<<( std::ostream &aStream,
COLOR4D const &aColor );
A color representation with 4 components: red, green, blue, alpha.
Definition color4d.h:98
void ToHSL(double &aOutHue, double &aOutSaturation, double &aOutValue) const
Converts current color (stored in RGB) to HSL format.
Definition color4d.cpp:264
double r
Red component.
Definition color4d.h:371
double g
Green component.
Definition color4d.h:372
COLOR4D WithAlpha(double aAlpha) const
Return a color with the same color, but the given alpha.
Definition color4d.h:308
COLOR4D & Invert()
Makes the color inverted, alpha remains the same.
Definition color4d.h:245
void ToHSV(double &aOutHue, double &aOutSaturation, double &aOutValue, bool aAlwaysDefineHue=false) const
Convert current color (stored in RGB) to HSV format.
Definition color4d.cpp:336
int Distance(const COLOR4D &other) const
Returns the distance (in RGB space) between two colors.
Definition color4d.cpp:485
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.
Definition color4d.cpp:493
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:390
COLOR4D & Darken(double aFactor)
Makes the color darker by a given factor.
Definition color4d.h:229
COLOR4D Darkened(double aFactor) const
Return a color that is darker by a given factor, without modifying object.
Definition color4d.h:279
COLOR4D Inverted() const
Returns an inverted color, alpha remains the same.
Definition color4d.h:320
COLOR4D & Brighten(double aFactor)
Makes the color brighter by a given factor.
Definition color4d.h:212
double GetBrightness() const
Returns the brightness value of the color ranged from 0.0 to 1.0.
Definition color4d.h:330
double a
Alpha component.
Definition color4d.h:374
COLOR4D Brightened(double aFactor) const
Return a color that is brighter by a given factor, without modifying object.
Definition color4d.h:265
static const COLOR4D UNSPECIFIED
For legacy support; used as a value to indicate color hasn't been set yet.
Definition color4d.h:377
COLOR4D(double aRed, double aGreen, double aBlue, double aAlpha)
Definition color4d.h:115
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:295
COLOR4D Mix(const COLOR4D &aColor, double aFactor) const
Return a color that is mixed with the input by a factor.
Definition color4d.h:292
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.
Definition color4d.cpp:530
COLOR4D & Saturate(double aFactor)
Saturates the color to a given factor (in HSV model)
Definition color4d.cpp:464
double b
Blue component.
Definition color4d.h:373
Definition wx_compat.h:13