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