コード例 #1
0
        public ComputationPackage(Complex min, Complex max, int width, int height)
        {
            Width  = width;
            Height = height;
            Min    = min;
            Max    = max;

            Frame = FrameHelper.Initialize(width, Height);
        }
コード例 #2
0
ファイル: Project.cs プロジェクト: sellep/mandelbrot
        public static Project New(string name, bool auto, int width, int height, int threads, Complex min, Complex max)
        {
            string path = GetProjectBasePath(name);

            if (Directory.Exists(path))
            {
                throw new Exception("Project already exists");
            }

            Directory.CreateDirectory(path);
            Directory.CreateDirectory(Path.Combine(path, "_frames"));

            FrameHelper.MakeGrid(width, height, threads, out int cols, out int rows);

            Project proj = new Project()
            {
                Name          = name,
                Auto          = auto,
                Width         = width,
                Height        = height,
                Threads       = threads,
                PartialWidth  = width / cols,
                PartialHeight = height / rows,
                Cols          = cols,
                Rows          = rows
            };

            string json = JsonConvert.SerializeObject(proj);

            File.WriteAllText(GetProjectFile(name), json);

            proj.Palette = InitializePalette();

            proj.CreateFrame(min, max);

            return(proj);
        }
コード例 #3
0
 public void MapPartialFrame(int[] partialFrame, int partialWidth, int partialHeight, int col, int row)
 {
     int[,] partial = FrameHelper.ToMulti(partialFrame, partialWidth, partialHeight);
     FrameHelper.MapTo(partialWidth, partialHeight, col, row, Frame, partial);
 }