X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=synfig-core%2Ftrunk%2Fsrc%2Fsynfig%2Fcolor.h;h=447bd5632e4584decf506dd605f3b10e8f525c38;hb=215f2742c34cedf77a8cd0ffdef8f8b6e95efdfe;hp=4624341159bcb42cb39ee61edc5bfa8d0d910300;hpb=c0293e1a2e3d68c53e2ad07bd5be9066b202771d;p=synfig.git diff --git a/synfig-core/trunk/src/synfig/color.h b/synfig-core/trunk/src/synfig/color.h index 4624341..447bd56 100644 --- a/synfig-core/trunk/src/synfig/color.h +++ b/synfig-core/trunk/src/synfig/color.h @@ -28,6 +28,11 @@ /* === H E A D E R S ======================================================= */ +#include +#include +#include +#include + //#include #include #include @@ -107,10 +112,16 @@ public: private: value_type a_, r_, g_, b_; - static String hex_; public: + inline const String get_string(void)const + { + std::ostringstream o; + o << std::fixed << std::setprecision(3) << "#" << get_hex() << " : " << std::setw(6) << a_; + return String(o.str().c_str()); + } + Color & operator+=(const Color &rhs) { @@ -271,7 +282,7 @@ public: 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_); } + const String get_hex()const { return String(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);