2 // Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Free Software
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; either version 3 of the License, or
8 // (at your option) any later version.
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21 #include "GnashNumeric.h"
28 rgba::toShortString() const
31 ss
<< +m_r
<< "," << +m_g
<< "," << +m_b
<< "," << +m_a
;
36 rgba::set_lerp(const rgba
& a
, const rgba
& b
, float f
)
38 m_r
= frnd(lerp
<float>(a
.m_r
, b
.m_r
, f
));
39 m_g
= frnd(lerp
<float>(a
.m_g
, b
.m_g
, f
));
40 m_b
= frnd(lerp
<float>(a
.m_b
, b
.m_b
, f
));
41 m_a
= frnd(lerp
<float>(a
.m_a
, b
.m_a
, f
));
45 colorFromHexString(const std::string
& color
)
47 std::stringstream
ss(color
);
48 boost::uint32_t hexnumber
;
50 if (!(ss
>> std::hex
>> hexnumber
)) {
51 log_error("Failed to convert string to RGBA value! This is a "
57 ret
.parseRGB(hexnumber
);
62 operator<<(std::ostream
& os
, const rgba
& r
)
64 return os
<< "rgba: " << +r
.m_r
<< "," << +r
.m_g
<< "," << +r
.m_b
<< ","
75 // indent-tabs-mode: t