Page 1 of 1

Fill(x,y,col)

Posted: Wed Jul 30, 2003 1:41 pm
by LCD
FillArea(x,y,border,colour) needs a border colour, so if I want to fill a screen area surrounded by different colours, it is useless. How about a Fill(x,y,colour) fill function that fills only pixels that are not different from the on coordinates x,y. Or has anyone made such flood fill function/plugin?

Posted: Sat Oct 01, 2005 1:48 pm
by Dräc
It will be a great add to the library…

Posted: Sat Oct 01, 2005 5:22 pm
by va!n

Posted: Sun Oct 02, 2005 1:14 pm
by Dräc
The problem is’nt really to program such a function, but to have a native optimised one ;)

Posted: Mon Oct 03, 2005 2:34 am
by ebs
If you can use a Windows-only solution, look at the second ExtFloodFill() call - the one with the #FLOODFILLSURFACE parameter:

Code: Select all

#FLOODFILLBORDER = 0 
#FLOODFILLSURFACE = 1

OpenWindow(0, 0, 0, 320, 240, #PB_Window_MinimizeGadget|#PB_Window_ScreenCentered, "FloodFill")
hdc.l = StartDrawing( WindowOutput() )
If hdc
  ; draw red box outline
  DrawingMode(4)
  FrontColor(255, 0, 0)
  Box(20, 20, 280, 100)
  Delay(1000)

  ; fill box with blue
  DrawingMode(1)
  FrontColor(0, 0, 255)
  ExtFloodFill_(hdc, 25, 25, #red, #FLOODFILLBORDER)
  Delay(1000)

  ; draw green box
  FrontColor(0, 255, 0)
  Box(20, 130, 280, 100)
  Delay(1000)
  
  ; fill box with blue
  FrontColor(0, 0, 255)
  ExtFloodFill_(hdc, 25, 135, #green, #FLOODFILLSURFACE)
  Delay(1000)
  
  StopDrawing()
EndIf

Repeat
Until WindowEvent() = #PB_Event_CloseWindow
Regards,
Eric

Posted: Mon Oct 03, 2005 3:06 pm
by Dräc
Yes, it could be the Windows solution for the PB command !

What about an extend FillArea function allowing the same optional parameters as ExtFloodFill API function does:
FLOODFILLBORDER and FLOODFILLSURFACE ?