FloodFill, FPC and lack of understanding lazarus / 61-Beginners ---------------------------------------------------------------------- yugorin · 2021-12-31 18:59 Hi I'm asking for help again because I don't understand what I'm doing wrong. I have read in the manual FloodFill(x: SmallInt; y: SmallInt; Border: ColorType) Example - if I draw a circle with a red border and point to the center of that circle (which is black) with a boundary of Red FloodFill( 21, 21, red) This circle should fill with the color set by SetColor However, when I type FloodFill ( then the compiler requests 4 parameters from me (para_1 (HDC??), para_2 (longInt), para_3(LongInt) and para_4 (LongInt)). To put it simply - I've gone crazy Can someone help me change the code to make this little circle fill with any color (other than black). 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 program q; {$mode objfpc}{$H+} uses  {$IFDEF UNIX}{$IFDEF UseCThreads}  cthreads,  {$ENDIF}{$ENDIF}  Classes,  sysutils, video, crt,dos,graph, WinCrt, Windows; var error, tryb, sterownik : smallint;var i, pozycjax1, pozycjay1, pozycjax2, pozycjay2 : integer;var maksX, maksY : string;ustawienia_tekstu : TextSettingsType; //===================== ======================================// Graph init                                            ////===========================================================begin  sterownik := D4bit;  tryb := m640x480;  initgraph(sterownik,tryb,'');  { Make sure you always check graphresult! }  error := graphResult;  if (error <> grOk) Then    begin    writeln('640x200x15 is not supported!');    halt(1)    end;  { We are now in 640x200x15 }  //setColor(cyan);  { maksX := IntToStr(getmaxx);  maksY := IntToStr(getmaxy);  SetTextStyle(TSCRFont,0,3);  MoveTo(0,0);   OutText(maksX);  MoveTo(0,30);  OutText(maksY);  MoveTo(0,60);  OutText('To jest tekst'); }   setColor(red);  setfillstyle(solidfill,12);  Circle(20,20,5);   // setfillstyle(solidfill,random(14)+1);// floodfill(21,20,15);  FloodFill ( 26, 21, red, green ); // FloodFill(22,28,2,red);   SetLineStyle(0,1,2);  setColor(green);   Line(0,0,getmaxx,0);  Line(getmaxx,0,getmaxx,getmaxy);  Line(getmaxx,getmaxy,0,getmaxy);  Line(0,0,0,getmaxy); {  for i:=0 to 1 do   begin  setColor(red);  Line(0,i,getmaxx,i);   setColor(red);  Line(0,i+1,639,i+1);    setColor(blue);  Line(0,i+2,639,i+2);  setColor(blue);  Line(0,i+3,639,i+3);   setColor(yellow);  Line(0,i+4,639,i+1);  setColor(yellow);  Line(0,i,639,i);   setColor(red);  Line(0,i,639,i);  setColor(red);  Line(0,i,639,i);   setColor(white);  Line(0,i,639,i);  setColor(white);  Line(0,i,639,i); } // end;   { GetTextSettings(ustawienia_tekstu);  writeln ('Font : ', ustawienia_tekstu.Font);  writeln ('Kierunek : ', ustawienia_tekstu.direction);  writeln ('Wielkosc font : ', ustawienia_tekstu.charsize);  writeln ('Pozioma pozycja : ', ustawienia_tekstu.horiz);  writeln ('Pionowa pozycja : ', ustawienia_tekstu.vert);  }  readln();  end.  Thank You all the best Yugorin ---------------------------------------------------------------------- winni · 2021-12-31 19:18 Hi! Place your  cursor on FloodFill and press Alt-CursorUp - and you see the definition of FloodFill: 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  procedure FloodFill(X, Y: Integer; FillColor: TColor;                        FillStyle: TFillStyle); where FillStyle is defined: 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 TGraphicsFillStyle =  (    fsSurface, // fill till the color (it fills all except this color)    fsBorder   // fill this color (it fills only connected pixels of this color)  );   If you want to fill a black circle with color and the center of the circle is 100/100 you have to do: 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 Canvas.Floodfill(100,100,clBlack fsSurface); Winni ---------------------------------------------------------------------- howardpc · 2021-12-31 19:26 You are programming a console application for Windows only ("uses ... Windows;"), consequently the FloodFill() you call is simply a Pascal wrapper round the Windows gdi32.dll routine of that name which has 4 parameters. You found information about the LCL Floodfill routine in the Graphics unit which you are not using, since yours is a console, not a GUI app. ---------------------------------------------------------------------- yugorin · 2021-12-31 19:37 Quote from: winni on December 31, 2021, 08:18:57 pmHi! Place your  cursor on FloodFill and press Alt-CursorUp - and you see the definition of FloodFill: 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  procedure FloodFill(X, Y: Integer; FillColor: TColor;                        FillStyle: TFillStyle);WOW great shortcut where FillStyle is defined: 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 TGraphicsFillStyle =  (    fsSurface, // fill till the color (it fills all except this color)    fsBorder   // fill this color (it fills only connected pixels of this color)  );   If you want to fill a black circle with color and the center of the circle is 100/100 you have to do: 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 Canvas.Floodfill(100,100,clBlack fsSurface); Winni Huh.. 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 Kompilowany projekt, Obiekt docelowy: q.exe: Kod wyjścia 1,Błędy: 3,q.pas(53,1) Error: Identifier not found "Canvas"q.pas(53,26) Error: Identifier not found "clBlack"q.pas(53,34) Fatal: Syntax error, ")" expected but "identifier FSSURFACE" found  Because I want to (very deliberately) use "DOS" mode for this application. Typically a console graphical version. I think that may be where the problem lies. Is it possible to fill in a drawn circle in this DOS mode? ---------------------------------------------------------------------- yugorin · 2021-12-31 19:40 Quote from: howardpc on December 31, 2021, 08:26:20 pmYou are programming a console application for Windows only ("uses ... Windows;"), consequently the FloodFill() you call is simply a Pascal wrapper round the Windows gdi32.dll routine of that name which has 4 parameters. You found information about the LCL Floodfill routine in the Graphics unit which you are not using, since yours is a console, not a GUI app. Yes, console app. Is it possible to fill in a drawn circle in this DOS/console mode? I am anxious to get as close as possible to programming in old pascal. E.g. Turbo pascal 7. without modern libraries and add-ons. This is a website with info about floodfill https://lazarus-ccr.sourceforge.io/docs/rtl/graph/floodfill.html Question is - anybody can modify my code to fill this small circle under console graph mode? All the best Yugorin ---------------------------------------------------------------------- yugorin · 2021-12-31 22:00 Hi My mistake and fatigue. I did not understand well what you wrote. I removed unnecessary unit from uses and now it looks like this: 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 uses sysutils, crt, dos, graph;  And the circle is red!!! Thank you for your time and help. Happy New Year!