示例#1
0
        static void CreateDensityBrot()
        {
            var           conf   = GetNormalFractalConfig();
            DensityMatrix matrix = null;

            try
            {
                if (Options.CreateMatrix)
                {
                    matrix = DoCreateMatrix(conf);
                }
                else
                {
                    matrix = LoadMatrix();
                }

                if (Options.CreateImage)
                {
                    DoCreateImage(matrix);
                }
            }
            finally
            {
                if (matrix != null)
                {
                    matrix.Dispose();
                }
            }
        }
示例#2
0
        private static DensityMatrix LoadMatrix(string name = null)
        {
            DensityMatrix matrix;
            string        a = EnsureEndsWith(name ?? Options.FileName, ".dm");

            Logger.PrintInfo("loading matrix file [" + a + "]");
            matrix         = new DensityMatrix(a);
            Options.Width  = matrix.Width;
            Options.Height = matrix.Height;
            return(matrix);
        }
示例#3
0
        static DensityMatrix DoCreateMatrix(FractalConfig conf, string name = null)
        {
            DensityMatrix matrix  = new DensityMatrix(Options.Width, Options.Height);
            var           builder = new FractalBuilder(matrix, conf);
            string        n       = EnsureEndsWith(name ?? Options.FileName, ".dm");

            Logger.PrintInfo("building matrix [" + n + "]");
            builder.Build();
            Logger.PrintInfo("saving matrix file [" + n + "]");
            matrix.SaveToFile(n);
            return(matrix);
        }
示例#4
0
        static IDensityMatrix CreateNebulaBrotMatrix(string suffix, int iters, ColorComponent comp)
        {
            var conf = GetNormalFractalConfig();

            conf.IterMax = iters;

            DensityMatrix matrix = null;
            string        mname  = Path.Combine(
                Path.GetDirectoryName(Options.FileName),
                Path.GetFileNameWithoutExtension(Options.FileName) + suffix + ".dm"
                );

            if (Options.CreateMatrix)
            {
                matrix = DoCreateMatrix(conf, mname);
            }
            else
            {
                matrix = LoadMatrix(mname);
            }
            return(matrix);
        }