X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=synfig-core%2Ftrunk%2Fsrc%2Fsynfig%2Fvaluenode_stripes.cpp;h=ce4b694bf3483c73f03289bcd56f2fe7625103de;hb=9459638ad6797b8139f1e9f0715c96076dbf0890;hp=048025f3888fc741791446b5f922fcdba5e07900;hpb=28f28705612902c15cd0702cc891fba35bf2d2df;p=synfig.git diff --git a/synfig-core/trunk/src/synfig/valuenode_stripes.cpp b/synfig-core/trunk/src/synfig/valuenode_stripes.cpp index 048025f..ce4b694 100644 --- a/synfig-core/trunk/src/synfig/valuenode_stripes.cpp +++ b/synfig-core/trunk/src/synfig/valuenode_stripes.cpp @@ -1,20 +1,22 @@ /* === S Y N F I G ========================================================= */ -/*! \file valuenode_subtract.cpp -** \brief Template File +/*! \file valuenode_stripes.cpp +** \brief Implementation of the "Stripes" valuenode conversion. ** -** $Id: valuenode_stripes.cpp,v 1.1.1.1 2005/01/04 01:23:15 darco Exp $ +** $Id$ ** ** \legal -** Copyright (c) 2002 Robert B. Quattlebaum Jr. +** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley +** Copyright (c) 2008 Chris Moore ** -** This software and associated documentation -** are CONFIDENTIAL and PROPRIETARY property of -** the above-mentioned copyright holder. +** This package is free software; you can redistribute it and/or +** modify it under the terms of the GNU General Public License as +** published by the Free Software Foundation; either version 2 of +** the License, or (at your option) any later version. ** -** You may not copy, print, publish, or in any -** other way distribute this software without -** a prior written agreement with -** the copyright holder. +** This package is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +** General Public License for more details. ** \endlegal */ /* ========================================================================= */ @@ -69,17 +71,17 @@ ValueNode_Stripes* ValueNode_Stripes::create(const ValueBase& x) { ValueBase::Type id(x.get_type()); - + if(id!=ValueBase::TYPE_GRADIENT) { assert(0); - throw runtime_error("synfig::ValueNode_Stripes:Bad type "+ValueBase::type_name(id)); - } + throw runtime_error(String(_("Stripes"))+_(":Bad type ")+ValueBase::type_local_name(id)); + } ValueNode_Stripes* value_node=new ValueNode_Stripes(); assert(value_node->get_type()==id); - + return value_node; } @@ -88,52 +90,13 @@ synfig::ValueNode_Stripes::~ValueNode_Stripes() unlink_all(); } -bool -synfig::ValueNode_Stripes::set_color1(ValueNode::Handle a) -{ - if(a->get_type()!=ValueBase::TYPE_COLOR) - return false; - - color1_=a; - - return true; -} - -bool -synfig::ValueNode_Stripes::set_color2(ValueNode::Handle a) -{ - if(a->get_type()!=ValueBase::TYPE_COLOR) - return false; - - color2_=a; - - return true; -} - -bool -synfig::ValueNode_Stripes::set_width(ValueNode::Handle x) -{ - if(x->get_type()!=ValueBase::TYPE_REAL) - return false; - - width_=x; - - return true; -} - -bool -synfig::ValueNode_Stripes::set_stripes(ValueNode::Handle b) -{ - if(b->get_type()!=ValueBase::TYPE_INTEGER) - return false; - stripes_=b; - return true; -} - synfig::ValueBase synfig::ValueNode_Stripes::operator()(Time t)const { - const int total((*stripes_)(t).get(int())); + if (getenv("SYNFIG_DEBUG_VALUENODE_OPERATORS")) + printf("%s:%d operator()\n", __FILE__, __LINE__); + + const int total((*stripes_)(t).get(int())); int i; Gradient ret; @@ -143,10 +106,10 @@ synfig::ValueNode_Stripes::operator()(Time t)const const Color color1((*color1_)(t).get(Color())); const Color color2((*color2_)(t).get(Color())); const float width(max(0.0,min(1.0,(*width_)(t).get(Real())))); - + const float stripe_width_a(width/total); const float stripe_width_b((1.0-width)/total); - + for(i=0;i=0 && i=0 && i=0 && i=0 && i