X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=synfig-core%2Ftrunk%2Fsrc%2Fsynfig%2Fcolor.h;h=d3ae54d43b6f56302bb387980b011a78fac9cdf0;hb=4f9e4d835da8089a953dfa5f508643c538924921;hp=01fc720ab5a5c68eb76566ced5a86d500ec99c5f;hpb=e1225f281625a058a1fc032dde0c8908553e3192;p=synfig.git diff --git a/synfig-core/trunk/src/synfig/color.h b/synfig-core/trunk/src/synfig/color.h index 01fc720..d3ae54d 100644 --- a/synfig-core/trunk/src/synfig/color.h +++ b/synfig-core/trunk/src/synfig/color.h @@ -2,7 +2,7 @@ /*! \file color.h ** \brief Color Class Implementation ** -** $Id: color.h,v 1.1.1.1 2005/01/04 01:23:14 darco Exp $ +** $Id$ ** ** \legal ** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley @@ -32,7 +32,7 @@ #include #include #include "gamma.h" -#include +#include #ifdef USE_HALF_TYPE #include @@ -107,6 +107,7 @@ public: private: value_type a_, r_, g_, b_; + static String hex_; public: @@ -263,6 +264,18 @@ public: //! Synonym for get_a(). \see get_a() const value_type& get_alpha()const { return get_a(); } + //! Converts a 2 character hex string \a s (00-ff) into a ColorReal (0.0-1.0) + static ColorReal hex2real(String s); + + //! Converts a ColorReal \a c (0.0-1.0) into a 2 character hex string (00-ff) + static const String real2hex(ColorReal c); + + //! Returns the color as a 6 character hex sting + const String& get_hex()const { return hex_ = real2hex(r_)+real2hex(g_)+real2hex(b_); } + + //! Sets the color's R, G, and B from a 3 or 6 character hex string + void set_hex(String& hex); + //! Sets the RED component to \a x Color& set_r(const value_type& x) { r_ = x; return *this; }