From f7d85691c2ed2701c7c5602f07b881eb083b34a8 Mon Sep 17 00:00:00 2001 From: Maciej Suminski Date: Mon, 24 Jun 2013 10:12:36 +0200 Subject: [PATCH] Added conversion from EDA_COLOR_T to COLOR4D. --- common/gal/color4d.cpp | 9 +++++++++ include/gal/color4d.h | 10 ++++++++++ 2 files changed, 19 insertions(+) diff --git a/common/gal/color4d.cpp b/common/gal/color4d.cpp index d5c50cc843..ebaf66b325 100644 --- a/common/gal/color4d.cpp +++ b/common/gal/color4d.cpp @@ -28,6 +28,15 @@ 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 ) { return a == aColor.a && r == aColor.r && g == aColor.g && b == aColor.b; diff --git a/include/gal/color4d.h b/include/gal/color4d.h index 4914829c33..f53e613683 100644 --- a/include/gal/color4d.h +++ b/include/gal/color4d.h @@ -27,6 +27,8 @@ #ifndef COLOR4D_H_ #define COLOR4D_H_ +#include + 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 * Makes the color brighter by a given factor.