Fill(x,y,col)

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
LCD
Enthusiast
Enthusiast
Posts: 206
Joined: Sun Jun 01, 2003 10:55 pm
Location: Austria, Vienna
Contact:

Fill(x,y,col)

Post 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?
My PC
Ryzen 9 5950, 64 GB RAM, nVidia RTX A4000, Win 10
Ryzen 7 1700, 32 GB RAM, nVidia RTX A2000, Win 10
Dräc
Enthusiast
Enthusiast
Posts: 150
Joined: Sat Oct 09, 2004 12:10 am
Location: Toulouse (France)
Contact:

Post by Dräc »

It will be a great add to the library…
va!n
Addict
Addict
Posts: 1104
Joined: Wed Apr 20, 2005 12:48 pm

Post by va!n »

va!n aka Thorsten

Intel i7-980X Extreme Edition, 12 GB DDR3, Radeon 5870 2GB, Windows7 x64,
Dräc
Enthusiast
Enthusiast
Posts: 150
Joined: Sat Oct 09, 2004 12:10 am
Location: Toulouse (France)
Contact:

Post by Dräc »

The problem is’nt really to program such a function, but to have a native optimised one ;)
ebs
Enthusiast
Enthusiast
Posts: 557
Joined: Fri Apr 25, 2003 11:08 pm

Post 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
Dräc
Enthusiast
Enthusiast
Posts: 150
Joined: Sat Oct 09, 2004 12:10 am
Location: Toulouse (France)
Contact:

Post 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 ?
Post Reply