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

ConvolutionFilter.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 
00019 #ifndef GNASH_CONVOLUTIONFILTER_H
00020 #define GNASH_CONVOLUTIONFILTER_H
00021 
00022 #include "BitmapFilter.h"
00023 
00024 #include <vector>
00025 #include <boost/cstdint.hpp> // for XintXX_t
00026 
00027 namespace gnash {
00028 
00029 // A convolution effect filter.
00030 class ConvolutionFilter : public BitmapFilter
00031 {
00032 public:
00033     // Fill from a SWFStream. See parser/filter_factory.cpp for
00034     // the implementations.
00035     virtual bool read(SWFStream& in);
00036 
00037     virtual ~ConvolutionFilter() {}
00038 
00039     ConvolutionFilter()
00040         :
00041         _matrixX(),
00042         _matrixY(),
00043         _matrix(),
00044         _divisor(),
00045         _bias(),
00046         _preserveAlpha(false),
00047         _clamp(false),
00048         _color(),
00049         _alpha()
00050     {}
00051 
00052     ConvolutionFilter(boost::uint8_t matrixX, boost::uint8_t matrixY, 
00053         const std::vector<float>& _matrix, float divisor, float bias,
00054         bool preserveAlpha, bool clamp, boost::uint32_t color,
00055         boost::uint8_t alpha)
00056         :
00057         _matrixX(matrixX),
00058         _matrixY(matrixY),
00059         _matrix(_matrix),
00060         _divisor(divisor),
00061         _bias(bias),
00062         _preserveAlpha(preserveAlpha),
00063         _clamp(clamp),
00064         _color(color),
00065         _alpha(alpha)
00066     {}
00067 
00068 protected:
00069     boost::uint8_t _matrixX; // Number of columns
00070     boost::uint8_t _matrixY; // Number of rows
00071     std::vector<float> _matrix; // The convolution matrix
00072     float _divisor;
00073     float _bias;
00074     bool _preserveAlpha; // If true, don't convolute the alpha channel
00075     bool _clamp; // Whether or not to clamp
00076     boost::uint32_t _color; // For off-image pixels
00077     boost::uint8_t _alpha; // For off-image pixels
00078 };
00079 
00080 } // Namespace gnash
00081 
00082 #endif // GNASH_CONVOLUTIONFILTER_H

Generated on Thu Sep 30 2010 14:34:57 for Gnash by  doxygen 1.7.1