コード例 #1
0
        public Turtle Print(Turtle printer, string input, int spacing = 1)
        {
            printer.ShowTurtle = false;
            int    width  = 64;
            int    height = 64;
            Bitmap image  = (Bitmap)Image.FromFile(input, true);

            for (int i = 0; i < image.Height; i++)
            {
                for (int j = 0; j < image.Width; j++)
                {
                    Color clr = image.GetPixel(j, i);
                    printer.SetColor(clr.R, clr.G, clr.B);
                    printer.Forward(1);
                }
                printer.CaptureScreenshot();
                printer.PenUp();
                printer.Rotate(90, false);
                printer.Forward(spacing);
                printer.Rotate(90, false);
                printer.Forward(image.Width);
                printer.Rotate(-180, false);
                printer.PenDown();
            }
            printer.ShowTurtle = true;
            return(printer);
        }
コード例 #2
0
ファイル: Code.cs プロジェクト: PavlatorCZ/TurtleGraphics
        /// <summary>
        /// This is the place to put your turtle code
        /// </summary>
        public Turtle ToExecute()
        {
            Turtle t = new Turtle(true);

            t.BackgroundColor = "Black";
            t.Rotate(-90);
            t.TurtleSpeed = 15;
            for (int i = 0; i < 6; i++)
            {
                t.StoreTurtlePosition();

                for (int j = 0; j < 20; j++)
                {
                    DrawSection(t, 100 - 5 * j);
                }

                t.RestoreTurtlePosition();
                t.Rotate(60);
                t.CaptureScreenshot();
            }
            return(t);
        }