Added conversion from EDA_COLOR_T to COLOR4D.

This commit is contained in:
Maciej Suminski 2013-06-24 10:12:36 +02:00
parent 26f6e259e6
commit f7d85691c2
2 changed files with 19 additions and 0 deletions

View File

@ -28,6 +28,15 @@
using namespace KiGfx; using namespace KiGfx;
COLOR4D::COLOR4D( EDA_COLOR_T aColor )
{
r = g_ColorRefs[aColor].m_Red;
g = g_ColorRefs[aColor].m_Green;
b = g_ColorRefs[aColor].m_Blue;
a = 1.0;
}
const bool COLOR4D::operator==( const COLOR4D& aColor ) const bool COLOR4D::operator==( const COLOR4D& aColor )
{ {
return a == aColor.a && r == aColor.r && g == aColor.g && b == aColor.b; return a == aColor.a && r == aColor.r && g == aColor.g && b == aColor.b;

View File

@ -27,6 +27,8 @@
#ifndef COLOR4D_H_ #ifndef COLOR4D_H_
#define COLOR4D_H_ #define COLOR4D_H_
#include <colors.h>
namespace KiGfx namespace KiGfx
{ {
/** /**
@ -55,6 +57,14 @@ public:
{ {
} }
/**
* @brief Constructor
*
* @param aColor is one of KiCad's palette colors.
* @see EDA_COLOR_T
*/
COLOR4D( EDA_COLOR_T aColor );
/** /**
* Function Highlight * Function Highlight
* Makes the color brighter by a given factor. * Makes the color brighter by a given factor.