BBC BASIC for Windows
Programming >> BBC BASIC language >> FILL (replacing a colour at specific location)
http://bb4w.conforums.com/index.cgi?board=language&action=display&num=1478478771

FILL (replacing a colour at specific location)
Post by michael on Nov 6th, 2016, 11:32pm

I could be wrong, but I find that if I FILL a location that has a color other than black, it wont fill the area with the new color.

Is there a way to force it to fill until it reaches a different color, or is there another way?

If FILL doesn't work that way, then I will work on a PAINT tool that does that.
Re: FILL (replacing a colour at specific location)
Post by DDRM on Nov 7th, 2016, 08:40am

Hi Michael,

The manual says "performs a 'flood fill' in the current graphics foreground colour, starting at the specified point and continuing until non-background-colour pixels are found"

In other words, if your background colour is black, it will only fill black pixels.

If you change the background colour to the colour you are trying to fill over, it should work: here's an example
Code:
      MODE 21
      GCOL 1
      RECTANGLE FILL 100,100,500,200
      GCOL 4
      RECTANGLE 100,500,500,200
      GCOL 2
      FILL 200,600
      WAIT 100
      GCOL 3
      REM This should fail
      FILL 200,200
      REM But this should work....
      GCOL 128+1   :REM Set background to the red of the bottom rectangle
      GCOL 7
      FILL 200,200
 

If you don't know in advance what colour it will have, you could check with POINT.

Best wishes,

D
Re: FILL (replacing a colour at specific location)
Post by michael on Nov 7th, 2016, 09:21am

I see what I was doing wrong. Thanks..

I will work on this.
It will require using TINT since I am using palettes.

Re: FILL (replacing a colour at specific location)
Post by DDRM on Nov 7th, 2016, 11:06am

Yes, you may need to use TINT to get the physical colour, then map that to a logical colour, and set it as the background.

D