コード例 #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
 static Turtle penSet(char state, Turtle t)
 {
     if (state == '0')
     {
         t.PenUp();
     }
     else
     {
         t.PenDown();
     }
     return(t);
 }