(09-15-2024, 01:16 PM)bplus Wrote: +1 @Vince fills are great but need a submission for jut rounded boxes without fills.
Code: (Select All)
sub cbox (x, y, w, h, r, c as _unsigned long)
x0 = r
y0 = 0
e = -r
do while y0 < x0
pset (x + r - x0, y + r - y0),c
pset (x + w - r + x0, y + r - y0), c
pset (x + r - x0, y + h - r + y0), c
pset (x + w - r + x0, y + h - r + y0), c
pset (x + r - y0, y + r - x0), c
pset (x + w - r + y0, y + r - x0), c
pset (x + r - y0, y + h - r + x0), c
pset (x + w - r + y0, y + h - r + x0), c
if e <= 0 then
y0 = y0 + 1
e = e + 2*y0
else
x0 = x0 - 1
e = e - 2*x0
end if
loop
line (x, y + r + 1)-step(0, h - 2*r - 2), c, bf
line (x + w, y + r + 1)-step(0, h - 2*r - 2), c, bf
line (x + r + 1, y)-step(w - 2*r - 2, 0), c, bf
line (x + r + 1, y + h)-step(w - 2*r - 2, 0), c, bf
end sub