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);
        }
Example #2
0
        void DrawSection(Turtle t, int p)
        {
            for (int i = 0; i < 10; i++)
            {
                t.Forward(2);

                t.SetColor(90 + i * 15, 170, 200);
            }
            t.StoreTurtlePosition();
            t.Rotate(-45);
            for (int i = 0; i < p; i++)
            {
                t.Forward(1);
                t.SetColor(i + 100, 0, 0);
            }
            t.SetColor(90, 170, 200);
            t.RestoreTurtlePosition();
            t.Rotate(45);
            t.Forward(p);
            t.RestoreTurtlePosition(true);
        }
Example #3
0
        public Turtle ToExecute()
        {
            Turtle     t   = new Turtle(true);
            Text       txt = new Text();
            ImagePrint prn = new ImagePrint();

            t.SetBrushSize(1);
            t.AnimatePath = false;
            t.TurtleSpeed = 50;
            t             = prn.Print(t, "image.bmp");
            t.SetColor("brown");
            t = txt.Write(t, "Želva", true, 1);
            t.Rotate(22.5);
            t.SetColor("Black");
            t = txt.Write(t, "píše!", false, 1);
            for (int i = 0; i < 14; i++)
            {
                t.Rotate(22.5);
                t = txt.Write(t, i + string.Empty, (i % 2) == 1, 1, new Font(SystemFonts.DefaultFont.FontFamily, 36, FontStyle.Underline));
            }

            return(t);
        }
Example #4
0
 void grn()
 {
     t.SetColor("green");
 }