X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=synfig-core%2Ftags%2Fstable%2Fsrc%2Fsynfig%2Fvaluenode_stripes.cpp;fp=synfig-core%2Ftags%2Fstable%2Fsrc%2Fsynfig%2Fvaluenode_stripes.cpp;h=0000000000000000000000000000000000000000;hb=6fa8f2f38d4b0b35f8539bf94e27ae27015c7689;hp=424a73d7ab19dbdec45cd5a95bbb5eee387ff1bb;hpb=47fce282611fbba1044921d22ca887f9b53ad91a;p=synfig.git diff --git a/synfig-core/tags/stable/src/synfig/valuenode_stripes.cpp b/synfig-core/tags/stable/src/synfig/valuenode_stripes.cpp deleted file mode 100644 index 424a73d..0000000 --- a/synfig-core/tags/stable/src/synfig/valuenode_stripes.cpp +++ /dev/null @@ -1,232 +0,0 @@ -/* === S Y N F I G ========================================================= */ -/*! \file valuenode_stripes.cpp -** \brief Implementation of the "Stripes" valuenode conversion. -** -** $Id$ -** -** \legal -** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley -** Copyright (c) 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 -** published by the Free Software Foundation; either version 2 of -** the License, or (at your option) any later version. -** -** 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 -*/ -/* ========================================================================= */ - -/* === H E A D E R S ======================================================= */ - -#ifdef USING_PCH -# include "pch.h" -#else -#ifdef HAVE_CONFIG_H -# include -#endif - -#include "general.h" -#include "valuenode_stripes.h" -#include "valuenode_const.h" -#include -#include "color.h" -#include "gradient.h" - -#endif - -/* === U S I N G =========================================================== */ - -using namespace std; -using namespace etl; -using namespace synfig; - -/* === M A C R O S ========================================================= */ - -/* === G L O B A L S ======================================================= */ - -/* === P R O C E D U R E S ================================================= */ - -/* === M E T H O D S ======================================================= */ - -synfig::ValueNode_Stripes::ValueNode_Stripes():LinkableValueNode(synfig::ValueBase::TYPE_GRADIENT) -{ - set_link("color1",ValueNode_Const::create(Color::alpha())); - set_link("color2",ValueNode_Const::create(Color::black())); - set_link("stripes",stripes_=ValueNode_Const::create(int(5))); - set_link("width",ValueNode_Const::create(0.5)); -} - -LinkableValueNode* -ValueNode_Stripes::create_new()const -{ - return new ValueNode_Stripes(); -} - -ValueNode_Stripes* -ValueNode_Stripes::create(const ValueBase& x) -{ - ValueBase::Type id(x.get_type()); - - if(id!=ValueBase::TYPE_GRADIENT) - { - assert(0); - 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; -} - -synfig::ValueNode_Stripes::~ValueNode_Stripes() -{ - unlink_all(); -} - -synfig::ValueBase -synfig::ValueNode_Stripes::operator()(Time t)const -{ - const int total((*stripes_)(t).get(int())); - int i; - Gradient ret; - - if(total<=0) - return ret; - - 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