Remove .gitignore do nothing is ignored.
[synfig.git] / synfig-core / trunk / src / synfig / valuenode_subtract.cpp
index 50230e9..3ba475e 100644 (file)
@@ -6,7 +6,7 @@
 **
 **     \legal
 **     Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
-**     Copyright (c) 2007 Chris Moore
+**     Copyright (c) 2007, 2008 Chris Moore
 **
 **     This package is free software; you can redistribute it and/or
 **     modify it under the terms of the GNU General Public License as
@@ -35,6 +35,7 @@
 #include "valuenode_const.h"
 #include <stdexcept>
 #include "color.h"
+#include "gradient.h"
 #include "vector.h"
 #include "angle.h"
 #include "real.h"
@@ -72,6 +73,10 @@ synfig::ValueNode_Subtract::ValueNode_Subtract(const ValueBase &value):
                set_link("lhs",ValueNode_Const::create(value.get(Color())));
                set_link("rhs",ValueNode_Const::create(Color(0,0,0,0)));
                break;
+       case ValueBase::TYPE_GRADIENT:
+               set_link("lhs",ValueNode_Const::create(value.get(Gradient())));
+               set_link("rhs",ValueNode_Const::create(Gradient()));
+               break;
        case ValueBase::TYPE_INTEGER:
                set_link("lhs",ValueNode_Const::create(value.get(int())));
                set_link("rhs",ValueNode_Const::create(int(0)));
@@ -120,6 +125,9 @@ synfig::ValueNode_Subtract::~ValueNode_Subtract()
 synfig::ValueBase
 synfig::ValueNode_Subtract::operator()(Time t)const
 {
+       if (getenv("SYNFIG_DEBUG_VALUENODE_OPERATORS"))
+               printf("%s:%d operator()\n", __FILE__, __LINE__);
+
        if(!ref_a || !ref_b)
                throw runtime_error(strprintf("ValueNode_Subtract: %s",_("One or both of my parameters aren't set!")));
        switch(get_type())
@@ -128,6 +136,8 @@ synfig::ValueNode_Subtract::operator()(Time t)const
                return ((*ref_a)(t).get(Angle())-(*ref_b)(t).get(Angle()))*(*scalar)(t).get(Real());
        case ValueBase::TYPE_COLOR:
                return ((*ref_a)(t).get(Color())-(*ref_b)(t).get(Color()))*(*scalar)(t).get(Real());
+       case ValueBase::TYPE_GRADIENT:
+               return ((*ref_a)(t).get(Gradient())-(*ref_b)(t).get(Gradient()))*(*scalar)(t).get(Real());
        case ValueBase::TYPE_INTEGER:
                return round_to_int(((*ref_a)(t).get(int())-(*ref_b)(t).get(int()))*(*scalar)(t).get(Real()));
        case ValueBase::TYPE_REAL:
@@ -231,6 +241,7 @@ ValueNode_Subtract::check_type(ValueBase::Type type)
 {
        return type==ValueBase::TYPE_ANGLE
                || type==ValueBase::TYPE_COLOR
+               || type==ValueBase::TYPE_GRADIENT
                || type==ValueBase::TYPE_INTEGER
                || type==ValueBase::TYPE_REAL
                || type==ValueBase::TYPE_TIME