Remove .gitignore do nothing is ignored.
[synfig.git] / synfig-core / trunk / src / modules / lyr_std / julia.cpp
index a090ce4..ad2478e 100644 (file)
@@ -1,18 +1,23 @@
-/*! ========================================================================
-** Sinfg
-** Template File
-** $Id: julia.cpp,v 1.1.1.1 2005/01/04 01:23:10 darco Exp $
+/* === S Y N F I G ========================================================= */
+/*!    \file julia.cpp
+**     \brief Implementation of the "Julia Set" layer
 **
-** Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**     $Id$
 **
-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
+**     \legal
+**     Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
+**     Copyright (c) 2007 Chris Moore
 **
-** 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 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
 **
 ** === N O T E S ===========================================================
 **
 
 #include "julia.h"
 
-#include <sinfg/string.h>
-#include <sinfg/time.h>
-#include <sinfg/context.h>
-#include <sinfg/paramdesc.h>
-#include <sinfg/renddesc.h>
-#include <sinfg/surface.h>
-#include <sinfg/value.h>
-#include <sinfg/valuenode.h>
+#include <synfig/string.h>
+#include <synfig/time.h>
+#include <synfig/context.h>
+#include <synfig/paramdesc.h>
+#include <synfig/renddesc.h>
+#include <synfig/surface.h>
+#include <synfig/value.h>
+#include <synfig/valuenode.h>
 
 #endif
 
 
 /* === G L O B A L S ======================================================= */
 
-SINFG_LAYER_INIT(Julia);
-SINFG_LAYER_SET_NAME(Julia,"julia");
-SINFG_LAYER_SET_LOCAL_NAME(Julia,_("Julia Set"));
-SINFG_LAYER_SET_CATEGORY(Julia,_("Fractals"));
-SINFG_LAYER_SET_VERSION(Julia,"0.1");
-SINFG_LAYER_SET_CVS_ID(Julia,"$Id: julia.cpp,v 1.1.1.1 2005/01/04 01:23:10 darco Exp $");
+SYNFIG_LAYER_INIT(Julia);
+SYNFIG_LAYER_SET_NAME(Julia,"julia");
+SYNFIG_LAYER_SET_LOCAL_NAME(Julia,N_("Julia Set"));
+SYNFIG_LAYER_SET_CATEGORY(Julia,N_("Fractals"));
+SYNFIG_LAYER_SET_VERSION(Julia,"0.1");
+SYNFIG_LAYER_SET_CVS_ID(Julia,"$Id$");
 
 /* === P R O C E D U R E S ================================================= */
 
@@ -114,7 +119,7 @@ Julia::Julia():color_shift(angle::degrees(0))
        bailout=4;
        lp=log(log(bailout));
 }
-       
+
 bool
 Julia::set_param(const String & param, const ValueBase &value)
 {
@@ -139,7 +144,7 @@ Julia::set_param(const String & param, const ValueBase &value)
        IMPORT(smooth_outside);
        IMPORT(broken);
 
-       if(param=="iterations" && value.same_as(iterations))
+       if(param=="iterations" && value.same_type_as(iterations))
        {
                iterations=value.get(iterations);
                if(iterations<0)
@@ -148,7 +153,7 @@ Julia::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;
@@ -187,8 +192,8 @@ Julia::get_param(const String & param)const
 
        EXPORT_NAME();
        EXPORT_VERSION();
-               
-       return ValueBase();     
+
+       return ValueBase();
 }
 
 Color
@@ -198,18 +203,18 @@ Julia::get_color(Context context, const Point &pos)const
                cr, ci,
                zr, zi,
                zr_hold;
-       
+
        ColorReal
-               depth, mag;
-       
+               depth, mag(0);
+
        Color
                ret;
-       
+
        cr=seed[0];
        ci=seed[1];
        zr=pos[0];
        zi=pos[1];
-       
+
        for(int i=0;i<iterations;i++)
        {
                // Perform complex multiplication
@@ -219,12 +224,12 @@ Julia::get_color(Context context, const Point &pos)const
 
                // Use "broken" algorithm, if requested (looks weird)
                if(broken)zr+=zi;
-               
+
                // Calculate Magnitude
                mag=zr*zr+zi*zi;
 
                if(mag>4)
-               {       
+               {
                        if(smooth_outside)
                        {
                                // Darco's original mandelbrot smoothing algo
@@ -256,7 +261,7 @@ Julia::get_color(Context context, const Point &pos)const
 
                        if(color_cycle)
                                ret=ret.rotate_uv(color_shift.operator*(depth)).clamped_negative();
-                       
+
                        if(shade_outside)
                        {
                                ColorReal alpha=depth/static_cast<ColorReal>(iterations);
@@ -285,12 +290,12 @@ Julia::get_color(Context context, const Point &pos)const
 
        return ret;
 }
-       
+
 Layer::Vocab
 Julia::get_param_vocab()const
 {
        Layer::Vocab ret;
-       
+
        ret.push_back(ParamDesc("icolor")
                .set_local_name(_("Inside Color"))
                .set_description(_("Color of the Set"))
@@ -311,7 +316,7 @@ Julia::get_param_vocab()const
        ret.push_back(ParamDesc("bailout")
                .set_local_name(_("Bailout ValueBase"))
        );
-       
+
        ret.push_back(ParamDesc("distort_inside")
                .set_local_name(_("Distort Inside"))
        );
@@ -342,7 +347,7 @@ Julia::get_param_vocab()const
        ret.push_back(ParamDesc("color_outside")
                .set_local_name(_("Color Outside"))
        );
-       
+
        ret.push_back(ParamDesc("color_cycle")
                .set_local_name(_("Color Cycle"))
        );
@@ -354,7 +359,7 @@ Julia::get_param_vocab()const
                .set_local_name(_("Break Set"))
                .set_description(_("Modify equation to achieve interesting results"))
        );
-       
-       
+
+
        return ret;
 }