• Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files
  • Examples
  • File List
  • File Members

SWFCxForm.h

Go to the documentation of this file.
00001 // 
00002 //   Copyright (C) 2007, 2008, 2009, 2010 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         class SWFStream;
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     
00077     void read_rgb(SWFStream& in);
00078 
00080     void read_rgba(SWFStream& in);
00081 
00082 };
00083 
00084 inline bool
00085 operator==(const SWFCxForm& a, const SWFCxForm& b)
00086 {
00087         return a.ra == b.ra &&
00088            a.rb == b.rb &&
00089            a.ga == b.ga &&
00090            a.gb == b.gb &&
00091            a.ba == b.ba &&
00092            a.bb == b.bb &&
00093            a.aa == b.aa &&
00094            a.ab == b.ab;
00095 }
00096 
00097 inline bool
00098 operator!=(const SWFCxForm& a, const SWFCxForm& b)
00099 {
00100     return !(a == b);
00101 }
00102 
00104 //
00108 inline bool
00109 invisible(const SWFCxForm& cx)
00110 {
00111     return (255 * cx.aa >> 8) + cx.ab == 0;    
00112 }
00113 
00114 std::ostream& operator<<(std::ostream& os, const SWFCxForm& cx);
00115 
00116 } // namespace gnash
00117 
00118 #endif 
00119 
00120 
00121 // Local Variables:
00122 // mode: C++
00123 // indent-tabs-mode: t
00124 // End:

Generated on Thu Sep 2 2010 for Gnash by  doxygen 1.7.1