Gnash 0.8.9
|
00001 // 00002 // Copyright (C) 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. 00003 // 00004 // This program is free software; you can redistribute it and/or modify 00005 // it under the terms of the GNU General Public License as published by 00006 // the Free Software Foundation; either version 3 of the License, or 00007 // (at your option) any later version. 00008 // 00009 // This program is distributed in the hope that it will be useful, 00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 // GNU General Public License for more details. 00013 // 00014 // You should have received a copy of the GNU General Public License 00015 // along with this program; if not, write to the Free Software 00016 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00017 00018 #ifndef GNASHCXFORM_H 00019 #define GNASHCXFORM_H 00020 00021 #include "dsodefs.h" // for DSOEXPORT 00022 00023 #include <string> 00024 #include <iosfwd> 00025 #include <boost/cstdint.hpp> 00026 00027 namespace gnash { 00028 class rgba; 00029 } 00030 00031 namespace gnash { 00032 00034 class DSOEXPORT SWFCxForm 00035 { 00036 public: 00037 00039 SWFCxForm() 00040 : 00041 ra(256), 00042 ga(256), 00043 ba(256), 00044 aa(256), 00045 rb(0), 00046 gb(0), 00047 bb(0), 00048 ab(0) 00049 { 00050 } 00051 00052 boost::int16_t ra; // RedMultTerm, 8.8 fixed point 00053 boost::int16_t ga; // GreenMultTerm 8.8 fixed point 00054 boost::int16_t ba; // BlueMultTerm 8.8 fixed point 00055 boost::int16_t aa; // AlphaMultTerm 8.8 fixed point 00056 boost::int16_t rb; // RedAddTerm, 16 bit integer(no fraction) 00057 boost::int16_t gb; // GreenAddTerm 16 bit integer(no fraction) 00058 boost::int16_t bb; // BlueAddTerm 16 bit integer(no fraction) 00059 boost::int16_t ab; // AlphaAddTerm 16 bit integer(no fraction) 00060 00062 // 00066 void concatenate(const SWFCxForm& c); 00067 00069 rgba transform(const rgba& in) const; 00070 00072 void transform(boost::uint8_t& r, boost::uint8_t& g, boost::uint8_t& b, 00073 boost::uint8_t& a) const; 00074 00075 }; 00076 00077 inline bool 00078 operator==(const SWFCxForm& a, const SWFCxForm& b) 00079 { 00080 return a.ra == b.ra && 00081 a.rb == b.rb && 00082 a.ga == b.ga && 00083 a.gb == b.gb && 00084 a.ba == b.ba && 00085 a.bb == b.bb && 00086 a.aa == b.aa && 00087 a.ab == b.ab; 00088 } 00089 00090 inline bool 00091 operator!=(const SWFCxForm& a, const SWFCxForm& b) 00092 { 00093 return !(a == b); 00094 } 00095 00097 // 00101 inline bool 00102 invisible(const SWFCxForm& cx) 00103 { 00104 return (255 * cx.aa >> 8) + cx.ab == 0; 00105 } 00106 00107 std::ostream& operator<<(std::ostream& os, const SWFCxForm& cx); 00108 00109 } // namespace gnash 00110 00111 #endif 00112 00113 00114 // Local Variables: 00115 // mode: C++ 00116 // indent-tabs-mode: t 00117 // End: