Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Filling drawings
#1
There's no function or command "fill", allowing to pass two coordinates and making the computer to fill all delimited pixels with the current color.


Code:
circle 50, 50, 30
fill 50, 50

In the eighties, I used to fill a circle with a for loop:


Code:
circle 50, 50, 30
for i = 1 to 30
    circle 50, 50, i
next i
I suppose I could do something like this for rectangles, as well. This is, however, slow, ugly (certain pixels remain unplotted), and clumsy. Is there an alternate way?
Thanks,
-- Baltasar
Reply
#2
There is a Fill library. Which actually fills a Drawing using a UDG pattern (not only solid).

See an example here:

https://github.com/boriel-basic/zxbasic/...spfill.bas 

To use UDG you have either to compile with --sinclair or do POKE UInteger 23672, <address of UDG>

There is a thread about this routine here:
https://www.boriel.com/forum/showthread.php?tid=439
---
Boriel
Reply
#3
> boriel' Wrote:> There is a Fill library. Which actually fills a Drawing using a UDG pattern (not only solid).

Great!
I looked up the wiki but didn't find anything. I guess I could've looked it up in the forum...

My next question is.., what if you just want solid filling? Do you still have to provide an address to an UDG?

Thanks,
-- Baltasar
Reply
#4
Yes, define it with 255 (all eight bytes). Since this CHAR already exist in the ROM, you can use a simple
POKE to use that char.
---
Boriel
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)