예제 #1
0
        private static RectangleF EstimateBoundingBox()
        {
            var boundingBox = new RectangleF(new PointF(1, 0), new SizeF(0, 0));

            DragonFractalTask.DrawDragonFractal((x, y) =>
            {
                boundingBox = boundingBox.ExpandToPoint(new PointF((float)x, (float)y));
            }, 1000, 10);
            boundingBox.Inflate(0.1f, 0.1f);
            return(boundingBox);
        }
예제 #2
0
        private static void Main()
        {
            var pixels = new Pixels();
            var image  = new Bitmap(800, 800, PixelFormat.Format24bppRgb);

            using (var g = Graphics.FromImage(image))
                g.Clear(Color.Black);
            DragonFractalTask.DrawDragonFractal(pixels, 100000, 123456);
            pixels.DrawToBitmap(image);

            // При желании можно сохранить созданное изображение в файл вот так:
            // image.Save("dragon.png", ImageFormat.Png);

            ShowImageInWindow(image);
        }
예제 #3
0
        private static void Main()
        {
            Stopwatch.Start();
            int iterations = 10000000;
            var image      = new Bitmap(800, 800, PixelFormat.Format24bppRgb);

            image.ClearImage(Color.White);

            using (var pixels = new Pixels(image, EstimateBoundingBox()))
            {
                // ReSharper disable once AccessToDisposedClosure
                DragonFractalTask.DrawDragonFractal((x, y) => pixels.SetPixel(x, y), iterations, 0);
            }
            ShowImageInWindow(image);
        }