turtle graph lazarus / 39-Graphics ---------------------------------------------------------------------- tr_escape · 2013-09-08 18:32 hello everyone is there anyone remember turtle graph? i am looking for graph functions like as turtle graph in lazarus ---------------------------------------------------------------------- Bart · 2013-09-08 22:47 Wasn't that part of TP 3? I should still have a copy of that somewhere. Bart ---------------------------------------------------------------------- tr_escape · 2013-09-09 05:03 Yes it was in turbo pascal , actually i was cleaning my bookself and i saw my old books about pascal. When i saw turtle graph , i sopposed maybe in pascal already there is. Is there any library or component about it? Thanks a lot ---------------------------------------------------------------------- Bart · 2013-09-09 10:16 I haven't seen it around. Would be nice (nostalgia...) to have something like it, both for FreePascal (using Graph unit) and for Lazarus... Bart ---------------------------------------------------------------------- eny · 2013-09-09 17:07 The turtle graphic procedures (actually, 5 functions) where implemented as assembler routines and included in the com-file during the 1-pass compilation. You'd either have to disassemble them or do a bit of trial and error in a DosBox with the original TP3 compiler. And indeed would be nice from a nostalgic/retro point of view to got it working in Lazarus ---------------------------------------------------------------------- circular · 2013-09-09 19:45 I suppose you can do this with Canvas2D of BGRABitmap: Code: [Select]    procedure rotate(angleRad: single);     procedure translate(x,y: single);     procedure strokeStyle(color: TColor); overload;     procedure beginPath;     procedure moveTo(x,y: single); overload;     procedure lineTo(x,y: single); overload;     procedure stroke; To advance you can do: beginPath; moveTo(0,0); translate(1,0); lineTo(0,0); stroke; To turn: rotate(10*Pi/180) To change color: strokeStyle(...) ---------------------------------------------------------------------- ToBr · 2013-09-16 20:13 Maybe David Dirkse can help you See www.davdata.nl ---------------------------------------------------------------------- lainz · 2017-11-28 03:05 Hi, I know this is really old but it shows first in a google search, so I think it worth to comment here. In no time thanks to @Circular details on how to implement it I made this turtle graphics demo: https://github.com/lainz/turtlegraphics Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i   Bitmap.Fill(BGRAWhite);   reset(Bitmap);  set_color(Bitmap, 0, 0, 255, 255);   // 5 points star  translate(Bitmap, (Bitmap.Width div 2) - 100, (Bitmap.Height div 2) - 50);  for i := 1 to 5 do  begin    move(Bitmap, 200);    rotate(Bitmap, 144);  end;   reset(Bitmap);  set_color(Bitmap, 0, 255, 0, 255);   // 9 triangles  translate(Bitmap, (Bitmap.Width div 2) - 50, (Bitmap.Height div 2) - 120);  for i := 1 to 3 do  begin    move(Bitmap, 200);    for j := 1 to 2 do    begin    rotate(Bitmap, 120);      move(Bitmap, 100);    end;    for j := 1 to 2 do    begin      rotate(Bitmap, -120);      move(Bitmap, 100);  end;    rotate(Bitmap, 120);  end; Hope I will play more with this and include a proper class, standard naming of functions and demo with pascal scripting. I get into this thanks to python "turtle demo" in the python IDLE shell help menu.