X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=synfig-core%2Ftrunk%2Fsrc%2Fsynfig%2Fcolor.cpp;h=1fa133c0742de9954f296b3227e2733177bd5b40;hb=feaa9da99368196af3a5b5a613a839e7768c05fb;hp=6c4dd5b7beca7b9ceae4cacdb7227eb2346051bf;hpb=eee3a4e16955edf27ee546d91fe10c6df7d80b08;p=synfig.git diff --git a/synfig-core/trunk/src/synfig/color.cpp b/synfig-core/trunk/src/synfig/color.cpp index 6c4dd5b..1fa133c 100644 --- a/synfig-core/trunk/src/synfig/color.cpp +++ b/synfig-core/trunk/src/synfig/color.cpp @@ -79,9 +79,16 @@ Color::real2hex(ColorReal c) } void -Color::set_hex(String& hex) +Color::set_hex(String& str) { value_type r, g, b; + String hex; + + // use just the hex characters + for (String::const_iterator iter = str.begin(); iter != str.end(); iter++) + if (isxdigit(*iter)) + hex.push_back(*iter); + try { if (hex.size() == 1) @@ -429,7 +436,7 @@ blendfunc_LUMINANCE(Color &a,Color &b,float amount) static Color blendfunc_BEHIND(Color &a,Color &b,float amount) { - if(a.get_a()==0)a.set_a(COLOR_EPSILON); //!< \hack + if(a.get_a()==0)a.set_a(COLOR_EPSILON); //!< \todo this is a hack a.set_a(a.get_a()*amount); return blendfunc_COMPOSITE(b,a,1.0); }