Gnash  0.8.10
Transform.h
Go to the documentation of this file.
00001 // Transform.h:  Transform information for rendering.
00002 // 
00003 //   Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
00004 //   Free Software Foundation, Inc
00005 // 
00006 // This program is free software; you can redistribute it and/or modify
00007 // it under the terms of the GNU General Public License as published by
00008 // the Free Software Foundation; either version 3 of the License, or
00009 // (at your option) any later version.
00010 // 
00011 // This program is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014 // GNU General Public License for more details.
00015 // 
00016 // You should have received a copy of the GNU General Public License
00017 // along with this program; if not, write to the Free Software
00018 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00019 
00020 #ifndef GNASH_TRANSFORM_H
00021 #define GNASH_TRANSFORM_H
00022 
00023 #include "SWFMatrix.h"
00024 #include "SWFCxForm.h"
00025 
00026 namespace gnash {
00027 
00029 //
00032 class Transform
00033 {
00034 public:
00035 
00037     //
00039     explicit Transform(const SWFMatrix& m = SWFMatrix(),
00040             const SWFCxForm& cx = SWFCxForm())
00041         :
00042         matrix(m),
00043         colorTransform(cx)
00044     {}
00045 
00046     Transform(const Transform& other)
00047         :
00048         matrix(other.matrix),
00049         colorTransform(other.colorTransform)
00050     {}
00051 
00052     Transform& operator*=(const Transform& other) {
00053         matrix.concatenate(other.matrix);
00054         colorTransform.concatenate(other.colorTransform);
00055         return *this;
00056     }
00057 
00058     SWFMatrix matrix;
00059     SWFCxForm colorTransform;
00060 };
00061 
00063 inline Transform
00064 operator*(const Transform& a, const Transform& b)
00065 {
00066     Transform ret(a);
00067     ret *= b;
00068     return ret;
00069 }
00070 
00071 } // namespace gnash
00072 
00073 #endif