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