00001 // ColorTransform_as.h: ActionScript "ColorTransform" class, for Gnash. 00002 // 00003 // Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Free Software 00004 // 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 00021 #ifndef GNASH_ASOBJ_COLORTRANSFORM_H 00022 #define GNASH_ASOBJ_COLORTRANSFORM_H 00023 00024 00025 #include "Relay.h" 00026 00027 namespace gnash { 00028 class as_object; 00029 struct ObjectURI; 00030 } 00031 00032 namespace gnash { 00033 00034 // This is used directly by flash.geom.Transform, as it is 00035 // much more efficient than a pseudo-ActionScript implementation. 00036 class ColorTransform_as : public Relay 00037 { 00038 00039 public: 00040 00041 ColorTransform_as(double rm, double gm, double bm, double am, 00042 double ro, double go, double bo, double ao); 00043 00044 // Tests show that the ColorTransform 00045 // object has its own properties on initialization, so they have 00046 // getter-setters and are *not* simple properties. Storing and 00047 // manipulating as doubles (they cannot be anything else - see ctor) is 00048 // better for speed and memory than using as_value. 00049 void setAlphaMultiplier(double am) { _alphaMultiplier = am; } 00050 void setRedMultiplier(double rm) { _redMultiplier = rm; } 00051 void setBlueMultiplier(double bm) { _blueMultiplier = bm; } 00052 void setGreenMultiplier(double gm) { _greenMultiplier = gm; } 00053 00054 void setAlphaOffset(double ao) { _alphaOffset = ao; } 00055 void setRedOffset(double ro) { _redOffset = ro; } 00056 void setBlueOffset(double bo) { _blueOffset = bo; } 00057 void setGreenOffset(double go) { _greenOffset = go; } 00058 00059 double getAlphaMultiplier() const { return _alphaMultiplier; } 00060 double getRedMultiplier() const { return _redMultiplier; } 00061 double getBlueMultiplier() const { return _blueMultiplier; } 00062 double getGreenMultiplier() const { return _greenMultiplier; } 00063 00064 double getAlphaOffset() const { return _alphaOffset; } 00065 double getRedOffset() const { return _redOffset; } 00066 double getBlueOffset() const { return _blueOffset; } 00067 double getGreenOffset() const { return _greenOffset; } 00068 00069 void concat(const ColorTransform_as& other); 00070 00071 private: 00072 00073 double _alphaMultiplier; 00074 double _alphaOffset; 00075 double _blueMultiplier; 00076 double _blueOffset; 00077 double _greenMultiplier; 00078 double _greenOffset; 00079 double _redMultiplier; 00080 double _redOffset; 00081 00082 }; 00083 00085 void colortransform_class_init(as_object& where, const ObjectURI& uri); 00086 00087 void registerColorTransformNative(as_object& global); 00088 00089 } // end of gnash namespace 00090 00091 #endif