1 /* === S I N F G =========================================================== */
2 /*! \file valuenode_subtract.cpp
3 ** \brief Template File
5 ** $Id: valuenode_twotone.cpp,v 1.1.1.1 2005/01/04 01:23:15 darco Exp $
8 ** Copyright (c) 2002 Robert B. Quattlebaum Jr.
10 ** This software and associated documentation
11 ** are CONFIDENTIAL and PROPRIETARY property of
12 ** the above-mentioned copyright holder.
14 ** You may not copy, print, publish, or in any
15 ** other way distribute this software without
16 ** a prior written agreement with
17 ** the copyright holder.
20 /* ========================================================================= */
22 /* === H E A D E R S ======================================================= */
32 #include "valuenode_twotone.h"
33 #include "valuenode_const.h"
40 /* === U S I N G =========================================================== */
44 using namespace sinfg;
46 /* === M A C R O S ========================================================= */
48 /* === G L O B A L S ======================================================= */
50 /* === P R O C E D U R E S ================================================= */
52 /* === M E T H O D S ======================================================= */
54 sinfg::ValueNode_TwoTone::ValueNode_TwoTone():LinkableValueNode(sinfg::ValueBase::TYPE_GRADIENT)
56 set_link("color1",ValueNode_Const::create(Color::black()));
57 set_link("color2",ValueNode_Const::create(Color::white()));
62 ValueNode_TwoTone::create_new()const
64 return new ValueNode_TwoTone();
68 ValueNode_TwoTone::create(const ValueBase& x)
70 ValueBase::Type id(x.get_type());
71 if(id!=ValueBase::TYPE_GRADIENT)
74 throw runtime_error("sinfg::ValueNode_TwoTone:Bad type "+ValueBase::type_name(id));
77 ValueNode_TwoTone* value_node=new ValueNode_TwoTone();
79 assert(value_node->get_type()==id);
84 sinfg::ValueNode_TwoTone::~ValueNode_TwoTone()
90 sinfg::ValueNode_TwoTone::set_lhs(ValueNode::Handle a)
92 if(a->get_type()!=ValueBase::TYPE_COLOR)
101 sinfg::ValueNode_TwoTone::set_rhs(ValueNode::Handle b)
103 if(b->get_type()!=ValueBase::TYPE_COLOR)
110 sinfg::ValueNode_TwoTone::operator()(Time t)const
112 return Gradient((*ref_a)(t).get(Color()),(*ref_b)(t).get(Color()));
116 ValueNode_TwoTone::set_link_vfunc(int i,ValueNode::Handle x)
122 if(set_lhs(x)) { signal_child_changed()(i);signal_value_changed()(); return true; }
123 else { return false; }
125 if(set_rhs(x)) { signal_child_changed()(i);signal_value_changed()(); return true; }
126 else { return false; }
132 ValueNode::LooseHandle
133 ValueNode_TwoTone::get_link_vfunc(int i)const
147 ValueNode_TwoTone::link_count()const
153 ValueNode_TwoTone::link_local_name(int i)const
167 ValueNode_TwoTone::link_name(int i)const
181 ValueNode_TwoTone::get_link_index_from_name(const String &name)const
187 throw Exception::BadLinkName(name);
191 ValueNode_TwoTone::get_name()const
197 ValueNode_TwoTone::get_local_name()const
199 return _("Two-Tone");
203 ValueNode_TwoTone::check_type(ValueBase::Type type)
205 return type==ValueBase::TYPE_GRADIENT;