Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Rounded Rectangles and Thick Circles
#6
here are the vince specials:

Code: (Select All)

defint a-z
screen _newimage(800,600,32)



'line (300,300)-step(320,240), _rgba(200,200,0,100), bf


do
    do
        mx = _mousex
        my = _mousey
    loop while _mouseinput

    cls

    circlef 200,200,100,_rgba(0,255,0,100)
    cboxf 300, 300, 320, 240, 10, _rgba(200,200,0,100)
    cboxf 300, 300, mx-300, my-300, 50, _rgba(200,100,50,100)
    cbox  250, 250, 300, 300, 80, _rgba(200,255,0,100)

    _display
    _limit 30
loop until _keyhit = 27
sleep
system

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

sub cboxf (x, y, w, h, r, c as _unsigned long)
    x0 = r
    y0 = 0
    e = -r

    do while y0 < x0
        if e <= 0 then
            y0 = y0 + 1
            line (x + r - x0, y + r - y0) - (x + w - r + x0, y + r - y0), c, bf
            line (x + r - x0, y + h - r + y0) - (x + w - r + x0, y + h - r + y0), c, bf
            e = e + 2*y0
        else
            line (x + r - y0, y + r - x0) - (x + w - r + y0, y + r - x0), c, bf
            line (x + r - y0, y + h - r + x0) - (x + w - r + y0, y + h - r + x0), c, bf
            x0 = x0 - 1
            e = e - 2*x0

        end if
    loop
    line (x, y + r)-step(w, h - 2*r), c, bf
end sub

sub circlef (x, y, r, c as _unsigned long)
    x0 = r
    y0 = 0
    e = -r
    do while y0 < x0
        if e <= 0 then
            y0 = y0 + 1
            line (x-x0, y+y0)-(x+x0, y+y0), c, bf
            line (x-x0, y-y0)-(x+x0, y-y0), c, bf
            e = e + 2*y0
        else
            line (x-y0, y-x0)-(x+y0, y-x0), c, bf
            line (x-y0, y+x0)-(x+y0, y+x0), c, bf
            x0 = x0 - 1
            e = e - 2*x0
        end if
    loop
    line (x-r,y)-(x+r,y),c,bf
end sub
Reply


Messages In This Thread
RE: Rounded Rectangles and Thick Circles - by vince - 02-03-2026, 10:40 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Circles and Ellipses(Tilt and Fill) SMcNeill 1 959 07-06-2023, 07:07 PM
Last Post: Space_Ghost

Forum Jump:


Users browsing this thread: 1 Guest(s)