2013-03-28 16:42:15 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KICAD, a free EDA CAD application.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2012 Torsten Hueter, torstenhtr <at> gmx.de
|
2020-12-21 23:42:21 +00:00
|
|
|
* Copyright (C) 2017-2020 Kicad Developers, see AUTHORS.txt for contributors.
|
2013-03-28 16:42:15 +00:00
|
|
|
*
|
|
|
|
* Color class
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, you may find one here:
|
|
|
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|
|
|
* or you may search the http://www.gnu.org website for the version 2 license,
|
|
|
|
* or you may write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef COLOR4D_H_
|
|
|
|
#define COLOR4D_H_
|
|
|
|
|
2021-08-05 19:14:00 +00:00
|
|
|
#include <wx/debug.h>
|
2020-10-18 11:31:07 +00:00
|
|
|
#include <wx/colour.h>
|
|
|
|
#include <wx/string.h>
|
2023-02-22 01:23:32 +00:00
|
|
|
#include <nlohmann/json_fwd.hpp>
|
|
|
|
|
2020-06-19 02:32:14 +00:00
|
|
|
|
|
|
|
/**
|
2020-12-21 23:42:21 +00:00
|
|
|
* Legacy color enumeration. Also contains a flag and the alpha value in the upper bits
|
2020-06-19 02:32:14 +00:00
|
|
|
*/
|
|
|
|
enum EDA_COLOR_T
|
|
|
|
{
|
|
|
|
UNSPECIFIED_COLOR = -1,
|
|
|
|
BLACK = 0,
|
|
|
|
DARKDARKGRAY,
|
|
|
|
DARKGRAY,
|
|
|
|
LIGHTGRAY,
|
|
|
|
WHITE,
|
|
|
|
LIGHTYELLOW,
|
|
|
|
DARKBLUE,
|
|
|
|
DARKGREEN,
|
|
|
|
DARKCYAN,
|
|
|
|
DARKRED,
|
|
|
|
DARKMAGENTA,
|
|
|
|
DARKBROWN,
|
|
|
|
BLUE,
|
|
|
|
GREEN,
|
|
|
|
CYAN,
|
|
|
|
RED,
|
|
|
|
MAGENTA,
|
|
|
|
BROWN,
|
|
|
|
LIGHTBLUE,
|
|
|
|
LIGHTGREEN,
|
|
|
|
LIGHTCYAN,
|
|
|
|
LIGHTRED,
|
|
|
|
LIGHTMAGENTA,
|
|
|
|
YELLOW,
|
|
|
|
PUREBLUE,
|
|
|
|
PUREGREEN,
|
|
|
|
PURECYAN,
|
|
|
|
PURERED,
|
|
|
|
PUREMAGENTA,
|
|
|
|
PUREYELLOW,
|
2021-05-28 18:49:34 +00:00
|
|
|
LIGHTERORANGE,
|
|
|
|
DARKORANGE,
|
|
|
|
ORANGE,
|
|
|
|
LIGHTORANGE,
|
|
|
|
PUREORANGE,
|
2020-06-19 02:32:14 +00:00
|
|
|
NBCOLORS, ///< Number of colors
|
|
|
|
HIGHLIGHT_FLAG = ( 1<<19 ),
|
2020-06-19 19:13:03 +00:00
|
|
|
MASKCOLOR = 31 ///< mask for color index into colorRefs()[]
|
2020-06-19 02:32:14 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct StructColors
|
|
|
|
{
|
|
|
|
unsigned char m_Blue;
|
|
|
|
unsigned char m_Green;
|
|
|
|
unsigned char m_Red;
|
|
|
|
EDA_COLOR_T m_Numcolor;
|
|
|
|
std::string m_ColorName;
|
|
|
|
EDA_COLOR_T m_LightColor;
|
|
|
|
};
|
|
|
|
|
|
|
|
/// Global list of legacy color names, still used all over the place for constructing COLOR4D's
|
2020-06-19 16:05:18 +00:00
|
|
|
const StructColors* colorRefs();
|
2020-06-19 02:32:14 +00:00
|
|
|
|
|
|
|
|
2013-10-14 14:13:35 +00:00
|
|
|
namespace KIGFX
|
2013-03-28 16:42:15 +00:00
|
|
|
{
|
|
|
|
/**
|
2020-12-21 23:42:21 +00:00
|
|
|
* A color representation with 4 components: red, green, blue, alpha.
|
2013-03-28 16:42:15 +00:00
|
|
|
*/
|
|
|
|
class COLOR4D
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
// Constructor (creates the Color 0,0,0,0)
|
|
|
|
COLOR4D() :
|
2021-08-05 19:14:00 +00:00
|
|
|
r( 0 ),
|
|
|
|
g( 0 ),
|
|
|
|
b( 0 ),
|
|
|
|
a( 1.0 )
|
2013-03-28 16:42:15 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param aRed is the red component [0.0 .. 1.0].
|
|
|
|
* @param aGreen is the green component [0.0 .. 1.0].
|
|
|
|
* @param aBlue is the blue component [0.0 .. 1.0].
|
|
|
|
* @param aAlpha is the alpha value [0.0 .. 1.0].
|
|
|
|
*/
|
2021-08-05 19:14:00 +00:00
|
|
|
COLOR4D( double aRed, double aGreen, double aBlue, double aAlpha ) :
|
|
|
|
r( aRed ),
|
|
|
|
g( aGreen ),
|
|
|
|
b( aBlue ),
|
|
|
|
a( aAlpha )
|
2013-03-28 16:42:15 +00:00
|
|
|
{
|
2021-08-05 19:14:00 +00:00
|
|
|
wxASSERT( r >= 0.0 && r <= 1.0 );
|
|
|
|
wxASSERT( g >= 0.0 && g <= 1.0 );
|
|
|
|
wxASSERT( b >= 0.0 && b <= 1.0 );
|
|
|
|
wxASSERT( a >= 0.0 && a <= 1.0 );
|
2013-03-28 16:42:15 +00:00
|
|
|
}
|
|
|
|
|
2013-06-24 08:12:36 +00:00
|
|
|
/**
|
|
|
|
* @param aColor is one of KiCad's palette colors.
|
|
|
|
* @see EDA_COLOR_T
|
|
|
|
*/
|
|
|
|
COLOR4D( EDA_COLOR_T aColor );
|
|
|
|
|
2020-10-15 01:57:36 +00:00
|
|
|
/**
|
2020-12-21 23:42:21 +00:00
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
* @return this color.
|
2020-10-15 01:57:36 +00:00
|
|
|
*/
|
|
|
|
COLOR4D& FromCSSRGBA( int aRed, int aGreen, int aBlue, double aAlpha = 1.0 );
|
|
|
|
|
2021-12-14 00:03:19 +00:00
|
|
|
/**
|
|
|
|
* Defines a color from a CSS or HTML-type string
|
|
|
|
* @param aColorStr input string
|
|
|
|
*/
|
|
|
|
COLOR4D( const wxString& aColorStr );
|
|
|
|
|
2013-06-24 08:32:08 +00:00
|
|
|
/**
|
|
|
|
* @param aColor is the color type used by wxWidgets.
|
|
|
|
*/
|
|
|
|
COLOR4D( const wxColour& aColor );
|
2017-02-20 16:57:41 +00:00
|
|
|
|
|
|
|
/**
|
2020-12-21 23:42:21 +00:00
|
|
|
* Set color values by parsing a string using wxColour::Set().
|
2017-02-20 16:57:41 +00:00
|
|
|
*
|
2020-12-21 23:42:21 +00:00
|
|
|
* @param aColorString is a color string that wxColour can understand.
|
|
|
|
* @return true if color was set successfully.
|
2017-02-20 16:57:41 +00:00
|
|
|
*/
|
|
|
|
bool SetFromWxString( const wxString& aColorString );
|
|
|
|
|
2022-09-30 19:18:37 +00:00
|
|
|
wxString ToCSSString() const;
|
2017-02-20 16:57:41 +00:00
|
|
|
|
2021-08-31 17:55:26 +00:00
|
|
|
bool SetFromHexString( const wxString& aColorString );
|
|
|
|
wxString ToHexString() const;
|
|
|
|
|
2018-11-08 13:28:42 +00:00
|
|
|
wxColour ToColour() const;
|
2017-02-20 16:57:41 +00:00
|
|
|
|
|
|
|
/**
|
2020-12-21 23:42:21 +00:00
|
|
|
* Mix this COLOR4D with an input COLOR4D using the OR-mixing of legacy canvas.
|
2017-02-20 16:57:41 +00:00
|
|
|
*
|
2020-12-21 23:42:21 +00:00
|
|
|
* Can be removed once legacy canvas is removed. Depends on wxColour for simplicity,
|
|
|
|
* but could be re-written to avoid this dependency if desired.
|
2017-02-20 16:57:41 +00:00
|
|
|
*
|
|
|
|
* @param aColor The color to mix with this one
|
|
|
|
*/
|
2021-07-26 17:28:37 +00:00
|
|
|
COLOR4D LegacyMix( const COLOR4D& aColor ) const;
|
2019-02-12 03:55:03 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Converts current color (stored in RGB) to HSL format.
|
|
|
|
*
|
2020-12-21 23:42:21 +00:00
|
|
|
* @param aOutHue is the conversion result for hue component, in degrees 0 ... 360.0.
|
2019-02-12 03:55:03 +00:00
|
|
|
* @param aOutSaturation is the conversion result for saturation component (0 ... 1.0).
|
|
|
|
* @param aOutLightness is conversion result for value component (0 ... 1.0).
|
|
|
|
* @note saturation is set to 0.0 for black color if r = g = b,
|
|
|
|
*/
|
|
|
|
void ToHSL( double& aOutHue, double& aOutSaturation, double& aOutValue ) const;
|
|
|
|
|
|
|
|
/**
|
2020-12-21 23:42:21 +00:00
|
|
|
* Change currently used color to the one given by hue, saturation and lightness parameters.
|
2019-02-12 03:55:03 +00:00
|
|
|
*
|
2020-12-21 23:42:21 +00:00
|
|
|
* @param aInHue is hue component, in degrees (0.0 - 360.0).
|
|
|
|
* @param aInSaturation is saturation component (0.0 - 1.0).
|
|
|
|
* @param aInLightness is lightness component (0.0 - 1.0).
|
2019-02-12 03:55:03 +00:00
|
|
|
*/
|
|
|
|
void FromHSL( double aInHue, double aInSaturation, double aInLightness );
|
|
|
|
|
2013-03-28 16:42:15 +00:00
|
|
|
/**
|
|
|
|
* Makes the color brighter by a given factor.
|
2020-12-21 23:42:21 +00:00
|
|
|
*
|
2013-03-28 16:42:15 +00:00
|
|
|
* @param aFactor Specifies how bright the color should become (valid values: 0.0 .. 1.0).
|
|
|
|
* @return COLOR4D& Brightened color.
|
|
|
|
*/
|
2013-08-06 07:31:08 +00:00
|
|
|
COLOR4D& Brighten( double aFactor )
|
2013-03-28 16:42:15 +00:00
|
|
|
{
|
2021-08-05 19:14:00 +00:00
|
|
|
wxASSERT( aFactor >= 0.0 && aFactor <= 1.0 );
|
2013-09-11 08:30:39 +00:00
|
|
|
|
2013-07-17 12:02:08 +00:00
|
|
|
r = r * ( 1.0 - aFactor ) + aFactor;
|
|
|
|
g = g * ( 1.0 - aFactor ) + aFactor;
|
|
|
|
b = b * ( 1.0 - aFactor ) + aFactor;
|
2013-03-28 16:42:15 +00:00
|
|
|
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Makes the color darker by a given factor.
|
2020-12-21 23:42:21 +00:00
|
|
|
*
|
2013-03-28 16:42:15 +00:00
|
|
|
* @param aFactor Specifies how dark the color should become (valid values: 0.0 .. 1.0).
|
|
|
|
* @return COLOR4D& Darkened color.
|
|
|
|
*/
|
|
|
|
COLOR4D& Darken( double aFactor )
|
|
|
|
{
|
2021-08-05 19:14:00 +00:00
|
|
|
wxASSERT( aFactor >= 0.0 && aFactor <= 1.0 );
|
2013-09-11 08:30:39 +00:00
|
|
|
|
2013-07-17 12:02:08 +00:00
|
|
|
r = r * ( 1.0 - aFactor );
|
|
|
|
g = g * ( 1.0 - aFactor );
|
|
|
|
b = b * ( 1.0 - aFactor );
|
|
|
|
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Makes the color inverted, alpha remains the same.
|
2020-12-21 23:42:21 +00:00
|
|
|
*
|
2013-07-17 12:02:08 +00:00
|
|
|
* @return COLOR4D& Inverted color.
|
|
|
|
*/
|
|
|
|
COLOR4D& Invert()
|
|
|
|
{
|
|
|
|
r = ( 1.0 - r );
|
|
|
|
g = ( 1.0 - g );
|
|
|
|
b = ( 1.0 - b );
|
2013-03-28 16:42:15 +00:00
|
|
|
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
2013-09-12 09:35:42 +00:00
|
|
|
/**
|
|
|
|
* Saturates the color to a given factor (in HSV model)
|
|
|
|
*/
|
|
|
|
COLOR4D& Saturate( double aFactor );
|
2013-10-14 11:43:57 +00:00
|
|
|
|
2023-01-11 20:53:09 +00:00
|
|
|
/**
|
|
|
|
* Removes color (in HSL model)
|
|
|
|
* @return greyscale version of color
|
|
|
|
*/
|
|
|
|
COLOR4D& Desaturate();
|
|
|
|
|
2013-03-28 16:42:15 +00:00
|
|
|
/**
|
2020-12-21 23:42:21 +00:00
|
|
|
* Return a color that is brighter by a given factor, without modifying object.
|
|
|
|
*
|
2013-03-28 16:42:15 +00:00
|
|
|
* @param aFactor Specifies how bright the color should become (valid values: 0.0 .. 1.0).
|
2014-01-31 10:16:01 +00:00
|
|
|
* @return COLOR4D Highlighted color.
|
2013-03-28 16:42:15 +00:00
|
|
|
*/
|
2013-08-06 07:31:08 +00:00
|
|
|
COLOR4D Brightened( double aFactor ) const
|
2013-03-28 16:42:15 +00:00
|
|
|
{
|
2021-08-05 19:14:00 +00:00
|
|
|
wxASSERT( aFactor >= 0.0 && aFactor <= 1.0 );
|
2013-09-11 08:30:39 +00:00
|
|
|
|
2020-12-21 23:42:21 +00:00
|
|
|
return COLOR4D( r * ( 1.0 - aFactor ) + aFactor, g * ( 1.0 - aFactor ) + aFactor,
|
|
|
|
b * ( 1.0 - aFactor ) + aFactor, a );
|
2013-03-28 16:42:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2020-12-21 23:42:21 +00:00
|
|
|
* Return a color that is darker by a given factor, without modifying object.
|
|
|
|
*
|
2013-03-28 16:42:15 +00:00
|
|
|
* @param aFactor Specifies how dark the color should become (valid values: 0.0 .. 1.0).
|
|
|
|
* @return COLOR4D Darkened color.
|
|
|
|
*/
|
|
|
|
COLOR4D Darkened( double aFactor ) const
|
|
|
|
{
|
2021-08-05 19:14:00 +00:00
|
|
|
wxASSERT( aFactor >= 0.0 && aFactor <= 1.0 );
|
2013-09-11 08:30:39 +00:00
|
|
|
|
2020-12-21 23:42:21 +00:00
|
|
|
return COLOR4D( r * ( 1.0 - aFactor ), g * ( 1.0 - aFactor ), b * ( 1.0 - aFactor ), a );
|
2013-03-28 16:42:15 +00:00
|
|
|
}
|
|
|
|
|
2019-06-09 15:13:50 +00:00
|
|
|
/**
|
2020-12-21 23:42:21 +00:00
|
|
|
* Return a color that is mixed with the input by a factor.
|
|
|
|
*
|
2019-06-09 15:13:50 +00:00
|
|
|
* @param aFactor Specifies how much of the original color to keep (valid values: 0.0 .. 1.0).
|
|
|
|
* @return COLOR4D Mixed color.
|
|
|
|
*/
|
|
|
|
COLOR4D Mix( const COLOR4D& aColor, double aFactor ) const
|
|
|
|
{
|
2021-08-05 19:14:00 +00:00
|
|
|
wxASSERT( aFactor >= 0.0 && aFactor <= 1.0 );
|
2019-06-09 15:13:50 +00:00
|
|
|
|
|
|
|
return COLOR4D( aColor.r * ( 1.0 - aFactor ) + r * aFactor,
|
|
|
|
aColor.g * ( 1.0 - aFactor ) + g * aFactor,
|
|
|
|
aColor.b * ( 1.0 - aFactor ) + b * aFactor,
|
|
|
|
a );
|
|
|
|
}
|
|
|
|
|
2017-03-01 01:59:25 +00:00
|
|
|
/**
|
2020-12-21 23:42:21 +00:00
|
|
|
* Return a color with the same color, but the given alpha.
|
|
|
|
*
|
2017-03-01 01:59:25 +00:00
|
|
|
* @param aAlpha specifies the alpha of the new color
|
|
|
|
* @return COLOR4D color with that alpha
|
|
|
|
*/
|
|
|
|
COLOR4D WithAlpha( double aAlpha ) const
|
|
|
|
{
|
2021-08-05 19:14:00 +00:00
|
|
|
wxASSERT( aAlpha >= 0.0 && aAlpha <= 1.0 );
|
2017-03-01 01:59:25 +00:00
|
|
|
|
|
|
|
return COLOR4D( r, g, b, aAlpha );
|
|
|
|
}
|
|
|
|
|
2013-07-17 12:02:08 +00:00
|
|
|
/**
|
|
|
|
* Returns an inverted color, alpha remains the same.
|
2020-12-21 23:42:21 +00:00
|
|
|
*
|
2013-07-17 12:02:08 +00:00
|
|
|
* @return COLOR4D& Inverted color.
|
|
|
|
*/
|
|
|
|
COLOR4D Inverted() const
|
|
|
|
{
|
|
|
|
return COLOR4D( 1.0 - r, 1.0 - g, 1.0 - b, a );
|
|
|
|
}
|
|
|
|
|
2013-07-08 18:42:46 +00:00
|
|
|
/**
|
|
|
|
* Returns the brightness value of the color ranged from 0.0 to 1.0.
|
2020-12-21 23:42:21 +00:00
|
|
|
*
|
2013-07-08 18:42:46 +00:00
|
|
|
* @return The brightness value.
|
|
|
|
*/
|
|
|
|
double GetBrightness() const
|
|
|
|
{
|
|
|
|
// Weighted W3C formula
|
2013-10-14 14:13:35 +00:00
|
|
|
return r * 0.299 + g * 0.587 + b * 0.117;
|
2013-07-08 18:42:46 +00:00
|
|
|
}
|
|
|
|
|
2013-09-12 15:42:28 +00:00
|
|
|
/**
|
2020-12-21 23:42:21 +00:00
|
|
|
* Convert current color (stored in RGB) to HSV format.
|
2013-09-12 15:42:28 +00:00
|
|
|
*
|
2020-12-21 23:42:21 +00:00
|
|
|
* @param aOutHue is the conversion result for hue component, in degrees 0 ... 360.0.
|
2017-07-16 15:10:24 +00:00
|
|
|
* @param aOutSaturation is the conversion result for saturation component (0 ... 1.0).
|
|
|
|
* @param aOutValue is conversion result for value component (0 ... 1.0).
|
2017-07-17 07:59:34 +00:00
|
|
|
* @param aAlwaysDefineHue controls 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.
|
2020-12-21 23:42:21 +00:00
|
|
|
* this option is useful to convert a 4D color to a legacy color, because Red has hue = 0,
|
2017-07-17 07:59:34 +00:00
|
|
|
* therefore aAlwaysDefineHue = false makes difference between Red and Gray colors.
|
2013-09-12 15:42:28 +00:00
|
|
|
*/
|
2020-12-21 23:42:21 +00:00
|
|
|
void ToHSV( double& aOutHue, double& aOutSaturation, double& aOutValue,
|
|
|
|
bool aAlwaysDefineHue = false ) const;
|
2013-09-12 09:35:42 +00:00
|
|
|
|
2013-09-12 15:42:28 +00:00
|
|
|
/**
|
|
|
|
* Changes currently used color to the one given by hue, saturation and value parameters.
|
|
|
|
*
|
2017-07-16 15:10:24 +00:00
|
|
|
* @param aInH is hue component, in degrees.
|
2014-11-02 16:25:04 +00:00
|
|
|
* @param aInS is saturation component.
|
|
|
|
* @param aInV is value component.
|
2013-09-12 15:42:28 +00:00
|
|
|
*/
|
|
|
|
void FromHSV( double aInH, double aInS, double aInV );
|
2013-09-12 09:35:42 +00:00
|
|
|
|
2021-09-16 10:14:43 +00:00
|
|
|
/**
|
|
|
|
* Returns the distance (in RGB space) between two colors.
|
|
|
|
*/
|
2022-02-07 02:05:44 +00:00
|
|
|
double Distance( const COLOR4D& other ) const;
|
2021-09-16 10:14:43 +00:00
|
|
|
|
2020-06-19 02:32:14 +00:00
|
|
|
/**
|
|
|
|
* Returns a legacy color ID that is closest to the given 8-bit RGB values.
|
|
|
|
*/
|
|
|
|
static EDA_COLOR_T FindNearestLegacyColor( int aR, int aG, int aB );
|
|
|
|
|
2013-03-28 16:42:15 +00:00
|
|
|
// Color components: red, green, blue, alpha
|
|
|
|
double r; ///< Red component
|
|
|
|
double g; ///< Green component
|
|
|
|
double b; ///< Blue component
|
|
|
|
double a; ///< Alpha component
|
2017-02-20 17:48:27 +00:00
|
|
|
|
|
|
|
/// For legacy support; used as a value to indicate color hasn't been set yet
|
|
|
|
static const COLOR4D UNSPECIFIED;
|
|
|
|
|
|
|
|
// Declare a few color shortcuts that are used for comparisons frequently
|
|
|
|
static const COLOR4D WHITE;
|
|
|
|
static const COLOR4D BLACK;
|
2020-07-11 17:40:23 +00:00
|
|
|
static const COLOR4D CLEAR;
|
2013-03-28 16:42:15 +00:00
|
|
|
};
|
2017-02-20 16:57:41 +00:00
|
|
|
|
|
|
|
/// @brief Equality operator, are two colors equal
|
|
|
|
const bool operator==( const COLOR4D& lhs, const COLOR4D& rhs );
|
|
|
|
|
|
|
|
/// @brief Not equality operator, are two colors not equal
|
|
|
|
const bool operator!=( const COLOR4D& lhs, const COLOR4D& rhs );
|
|
|
|
|
2020-04-09 23:34:38 +00:00
|
|
|
const bool operator<( const COLOR4D& lhs, const COLOR4D& rhs );
|
|
|
|
|
2017-03-31 02:09:19 +00:00
|
|
|
/// Syntactic sugar for outputting colors to strings
|
|
|
|
std::ostream &operator<<( std::ostream &aStream, COLOR4D const &aColor );
|
|
|
|
|
2020-01-13 01:44:19 +00:00
|
|
|
// to allow json( COLOR4D )
|
|
|
|
void to_json( nlohmann::json& aJson, const COLOR4D& aColor );
|
|
|
|
|
|
|
|
// To allow json::get<COLOR4D>()
|
|
|
|
void from_json( const nlohmann::json& aJson, COLOR4D& aColor );
|
|
|
|
|
2013-10-14 14:13:35 +00:00
|
|
|
} // namespace KIGFX
|
2013-03-28 16:42:15 +00:00
|
|
|
|
|
|
|
#endif /* COLOR4D_H_ */
|