Gnash  0.8.11dev
ColorTransform_as.h
Go to the documentation of this file.
1 // ColorTransform_as.h: ActionScript "ColorTransform" class, for Gnash.
2 //
3 // Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
4 // Free Software Foundation, Inc
5 //
6 // This program is free software; you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation; either version 3 of the License, or
9 // (at your option) any later version.
10 //
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
15 //
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the Free Software
18 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 //
20 
21 #ifndef GNASH_ASOBJ_COLORTRANSFORM_H
22 #define GNASH_ASOBJ_COLORTRANSFORM_H
23 
24 #include "Relay.h"
25 
26 namespace gnash {
27  class as_object;
28  struct ObjectURI;
29 }
30 
31 namespace gnash {
32 
33 // This is used directly by flash.geom.Transform, as it is
34 // much more efficient than a pseudo-ActionScript implementation.
35 class ColorTransform_as : public Relay
36 {
37 
38 public:
39 
40  ColorTransform_as(double rm, double gm, double bm, double am,
41  double ro, double go, double bo, double ao);
42 
43  // Tests show that the ColorTransform
44  // object has its own properties on initialization, so they have
45  // getter-setters and are *not* simple properties. Storing and
46  // manipulating as doubles (they cannot be anything else - see ctor) is
47  // better for speed and memory than using as_value.
48  void setAlphaMultiplier(double am) { _alphaMultiplier = am; }
49  void setRedMultiplier(double rm) { _redMultiplier = rm; }
50  void setBlueMultiplier(double bm) { _blueMultiplier = bm; }
51  void setGreenMultiplier(double gm) { _greenMultiplier = gm; }
52 
53  void setAlphaOffset(double ao) { _alphaOffset = ao; }
54  void setRedOffset(double ro) { _redOffset = ro; }
55  void setBlueOffset(double bo) { _blueOffset = bo; }
56  void setGreenOffset(double go) { _greenOffset = go; }
57 
58  double getAlphaMultiplier() const { return _alphaMultiplier; }
59  double getRedMultiplier() const { return _redMultiplier; }
60  double getBlueMultiplier() const { return _blueMultiplier; }
61  double getGreenMultiplier() const { return _greenMultiplier; }
62 
63  double getAlphaOffset() const { return _alphaOffset; }
64  double getRedOffset() const { return _redOffset; }
65  double getBlueOffset() const { return _blueOffset; }
66  double getGreenOffset() const { return _greenOffset; }
67 
68  void concat(const ColorTransform_as& other);
69 
70 private:
71 
72  double _alphaMultiplier;
73  double _alphaOffset;
74  double _blueMultiplier;
75  double _blueOffset;
76  double _greenMultiplier;
77  double _greenOffset;
78  double _redMultiplier;
79  double _redOffset;
80 
81 };
82 
84 void colortransform_class_init(as_object& where, const ObjectURI& uri);
85 
86 void registerColorTransformNative(as_object& global);
87 
88 } // end of gnash namespace
89 
90 #endif
gnash::isNativeType
bool isNativeType(const as_object *obj, T *&relay)
Check whether the object is an instance of a known type.
Definition: as_object.h:875
gnash::ColorTransform_as::getBlueMultiplier
double getBlueMultiplier() const
Definition: ColorTransform_as.h:60
gnash::toNumber
double toNumber(const as_value &v, const VM &vm)
Convert an as_value to a double.
Definition: VM.cpp:451
gnash::ColorTransform_as::getRedMultiplier
double getRedMultiplier() const
Definition: ColorTransform_as.h:59
gnash::ColorTransform_as::setBlueOffset
void setBlueOffset(double bo)
Definition: ColorTransform_as.h:55
gnash::toInt
std::int32_t toInt(const as_value &v, const VM &vm)
AS2-compatible conversion to 32bit integer.
Definition: VM.cpp:463
gnash::as_object
The base class for all ActionScript objects.
Definition: as_object.h:162
as_object.h
gnash::toObject
as_object * toObject(const as_value &v, VM &vm)
Convert an as_value to an object.
Definition: VM.cpp:457
gnash::ColorTransform_as::getAlphaOffset
double getAlphaOffset() const
Definition: ColorTransform_as.h:63
gnash::log_debug
void log_debug(StringType msg, Args... args)
Definition: log.h:301
gnash::colortransform_class_init
void colortransform_class_init(as_object &where, const ObjectURI &uri)
Initialize the global ColorTransform class.
Definition: ColorTransform_as.cpp:87
gnash::ColorTransform_as::setGreenMultiplier
void setGreenMultiplier(double gm)
Definition: ColorTransform_as.h:51
_
#define _(String)
Definition: log.h:44
gnash::VM
The AVM1 virtual machine.
Definition: VM.h:72
gnash
Anonymous namespace for callbacks, local functions, event handlers etc.
Definition: dbus_ext.cpp:41
ColorTransform_as.h
gnash::key::g
@ g
Definition: GnashKey.h:153
gnash::ColorTransform_as::setGreenOffset
void setGreenOffset(double go)
Definition: ColorTransform_as.h:56
gnash::ColorTransform_as::setBlueMultiplier
void setBlueMultiplier(double bm)
Definition: ColorTransform_as.h:50
NativeFunction.h
Global_as.h
gnash::getGlobal
Global_as & getGlobal(const as_environment &env)
Definition: as_environment.cpp:651
gnash::getVM
VM & getVM(const as_environment &env)
Definition: as_environment.h:222
gnash::ColorTransform_as
Definition: ColorTransform_as.h:36
gnash::getMember
as_value getMember(as_object &o, const ObjectURI &uri)
Get a member of an object using AS lookup rules.
Definition: as_object.h:756
gnash::as_object::init_destructive_property
bool init_destructive_property(const ObjectURI &uri, as_function &getter, int flags=PropFlags::dontEnum)
Initialize a destructive getter property.
Definition: as_object.cpp:720
gnash::createObject
as_object * createObject(const Global_as &gl)
Definition: Global_as.cpp:303
gnash::ColorTransform_as::getBlueOffset
double getBlueOffset() const
Definition: ColorTransform_as.h:65
gnash::key::r
@ r
Definition: GnashKey.h:164
gnash::registerColorTransformNative
void registerColorTransformNative(as_object &global)
Definition: ColorTransform_as.cpp:96
gnash::ColorTransform_as::getAlphaMultiplier
double getAlphaMultiplier() const
Definition: ColorTransform_as.h:58
gnash::Relay
This is the base class for type-specific object data.
Definition: Relay.h:50
gnash::ColorTransform_as::setRedOffset
void setRedOffset(double ro)
Definition: ColorTransform_as.h:54
gnash::ColorTransform_as::getGreenMultiplier
double getGreenMultiplier() const
Definition: ColorTransform_as.h:61
IF_VERBOSE_ASCODING_ERRORS
#define IF_VERBOSE_ASCODING_ERRORS(x)
Definition: log.h:397
gnash::ColorTransform_as::ColorTransform_as
ColorTransform_as(double rm, double gm, double bm, double am, double ro, double go, double bo, double ao)
Definition: ColorTransform_as.cpp:55
gnash::VM::registerNative
void registerNative(as_c_function_ptr fun, unsigned int x, unsigned int y)
Definition: VM.cpp:268
gnash::PropFlags::onlySWF8Up
@ onlySWF8Up
Only visible by VM initialized for version 8 or higher.
Definition: PropFlags.h:54
VM.h
gnash::ColorTransform_as::getRedOffset
double getRedOffset() const
Definition: ColorTransform_as.h:64
gnash::log_aserror
void log_aserror(StringType msg, Args... args)
Definition: log.h:331
gnash::ColorTransform_as::getGreenOffset
double getGreenOffset() const
Definition: ColorTransform_as.h:66
Relay.h
log.h
fn_call.h
gnash::ColorTransform_as::setRedMultiplier
void setRedMultiplier(double rm)
Definition: ColorTransform_as.h:49
test.uri
uri
Definition: test.py:12
gnash::getURI
ObjectURI getURI(const VM &vm, const std::string &str, bool lowerCaseHint=false)
Definition: VM.h:290
gnash::ColorTransform_as::concat
void concat(const ColorTransform_as &other)
Definition: ColorTransform_as.cpp:72
gnash::ColorTransform_as::setAlphaMultiplier
void setAlphaMultiplier(double am)
Definition: ColorTransform_as.h:48
gnash::key::o
@ o
Definition: GnashKey.h:161
gnash::ObjectURI
A URI for describing as_objects.
Definition: ObjectURI.h:45
gnash::key::b
@ b
Definition: GnashKey.h:148
gnash::ColorTransform_as::setAlphaOffset
void setAlphaOffset(double ao)
Definition: ColorTransform_as.h:53
gnash::newAdd
void newAdd(as_value &op1, const as_value &op2, const VM &vm)
Carry out ActionNewAdd.
Definition: VM.cpp:356