X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=synfig-core%2Ftrunk%2Fsrc%2Fmodules%2Flyr_std%2Fmandelbrot.cpp;h=5cc2fdfad914fafbf255907e76394e9f33a3094f;hb=e0377487e76a85662997cdf4c6c467e47c9d5560;hp=a77d44a39df795b53d187b378e952a632abad8ed;hpb=21bfc670b83d4c45da9ed1b95063b7e6a007168c;p=synfig.git diff --git a/synfig-core/trunk/src/modules/lyr_std/mandelbrot.cpp b/synfig-core/trunk/src/modules/lyr_std/mandelbrot.cpp index a77d44a..5cc2fdf 100644 --- a/synfig-core/trunk/src/modules/lyr_std/mandelbrot.cpp +++ b/synfig-core/trunk/src/modules/lyr_std/mandelbrot.cpp @@ -1,8 +1,10 @@ -/*! ======================================================================== -** Synfig -** Template File -** $Id: mandelbrot.cpp,v 1.1.1.1 2005/01/04 01:23:10 darco Exp $ +/* === S Y N F I G ========================================================= */ +/*! \file mandelbrot.cpp +** \brief Template Header ** +** $Id$ +** +** \legal ** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley ** ** This package is free software; you can redistribute it and/or @@ -14,6 +16,7 @@ ** 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 ** ** === N O T E S =========================================================== ** @@ -52,7 +55,7 @@ SYNFIG_LAYER_SET_NAME(Mandelbrot,"mandelbrot"); SYNFIG_LAYER_SET_LOCAL_NAME(Mandelbrot,_("Mandelbrot Set")); SYNFIG_LAYER_SET_CATEGORY(Mandelbrot,_("Fractals")); SYNFIG_LAYER_SET_VERSION(Mandelbrot,"0.2"); -SYNFIG_LAYER_SET_CVS_ID(Mandelbrot,"$Id: mandelbrot.cpp,v 1.1.1.1 2005/01/04 01:23:10 darco Exp $"); +SYNFIG_LAYER_SET_CVS_ID(Mandelbrot,"$Id$"); /* === P R O C E D U R E S ================================================= */ @@ -112,11 +115,11 @@ Mandelbrot::Mandelbrot(): smooth_outside=true; broken=false; - + bailout=4; lp=log(log(bailout)); } - + bool Mandelbrot::set_param(const String & param, const ValueBase &value) { @@ -127,7 +130,7 @@ Mandelbrot::set_param(const String & param, const ValueBase &value) IMPORT(gradient_offset_outside); IMPORT(gradient_loop_inside); IMPORT(gradient_scale_outside); - + IMPORT(distort_inside); IMPORT(distort_outside); IMPORT(solid_inside); @@ -142,8 +145,8 @@ Mandelbrot::set_param(const String & param, const ValueBase &value) IMPORT(gradient_inside); IMPORT(gradient_outside); - - if(param=="iterations" && value.same_as(iterations)) + + if(param=="iterations" && value.same_type_as(iterations)) { iterations=value.get(iterations); if(iterations<0) @@ -152,7 +155,7 @@ Mandelbrot::set_param(const String & param, const ValueBase &value) iterations=500000; return true; } - if(param=="bailout" && value.same_as(bailout)) + if(param=="bailout" && value.same_type_as(bailout)) { bailout=value.get(bailout); bailout*=bailout; @@ -189,22 +192,22 @@ Mandelbrot::get_param(const String & param)const EXPORT(gradient_inside); EXPORT(gradient_outside); - + if(param=="bailout") return sqrt(bailout); EXPORT_NAME(); EXPORT_VERSION(); - - return ValueBase(); + + return ValueBase(); } Layer::Vocab Mandelbrot::get_param_vocab()const { Layer::Vocab ret; - - + + ret.push_back(ParamDesc("iterations") .set_local_name(_("Iterations")) ); @@ -217,7 +220,7 @@ Mandelbrot::get_param_vocab()const .set_description(_("Modify equation to achieve interesting results")) ); - + ret.push_back(ParamDesc("distort_inside") .set_local_name(_("Distort Inside")) .set_group(_("Inside")) @@ -280,7 +283,7 @@ Mandelbrot::get_param_vocab()const .set_local_name(_("Scale Outside")) .set_group(_("Outside")) ); - + return ret; } @@ -291,18 +294,18 @@ Mandelbrot::get_color(Context context, const Point &pos)const cr, ci, zr, zi, zr_hold; - + ColorReal - depth, mag; - + depth, mag(0); + Color ret; - + zr=zi=0; cr=pos[0]; ci=pos[1]; - + for(int i=0;ibailout) - { + { if(smooth_outside) { // Darco's original mandelbrot smoothing algo @@ -335,7 +338,7 @@ Mandelbrot::get_color(Context context, const Point &pos)const ColorReal amount(depth/static_cast(iterations)); amount=amount*gradient_scale_outside+gradient_offset_outside; amount-=floor(amount); - + if(solid_outside) ret=gradient_outside(amount); else @@ -344,7 +347,7 @@ Mandelbrot::get_color(Context context, const Point &pos)const ret=context.get_color(Point(pos[0]+zr,pos[1]+zi)); else ret=context.get_color(pos); - + if(invert_outside) ret=~ret; @@ -352,7 +355,7 @@ Mandelbrot::get_color(Context context, const Point &pos)const ret=Color::blend(gradient_outside(amount), ret, 1.0); } - + return ret; } } @@ -369,13 +372,13 @@ Mandelbrot::get_color(Context context, const Point &pos)const ret=context.get_color(Point(pos[0]+zr,pos[1]+zi)); else ret=context.get_color(pos); - + if(invert_inside) ret=~ret; if(shade_inside) ret=Color::blend(gradient_inside(amount), ret, 1.0); } - + return ret; }