Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
FillTriangle and FillQuad
#4
Woah these are really fast!  Here's a simple usage.

- Dav

Code: (Select All)

Screen _NewImage(800, 600, 32)

Do
    x1 = Rnd * _Width: y1 = Rnd * _Height 'point 1
    x2 = x1 + Rnd * 400: y2 = y1 + Rnd * 300 'point 2
    x3 = x2 / 1.5: y3 = y2 * 1.5 'point 3
    FillTriangle x1, y1, x2, y2, x3, y3, _RGB(Rnd * 255, Rnd * 255, Rnd * 255)
    _Limit 1000
Loop Until _KeyHit


Sub FillTriangle (x1, y1, x2, y2, x3, y3, K As _Unsigned Long)
    $Checking:Off
    Static a&, m As _MEM
    If a& = 0 Then a& = _NewImage(1, 1, 32): m = _MemImage(a&)
    _MemPut m, m.OFFSET, K
    _MapTriangle _Seamless(0, 0)-(0, 0)-(0, 0), a& To(x1, y1)-(x2, y2)-(x3, y3)
    $Checking:On
End Sub

Sub FillQuad (x1, y1, x2, y2, x3, y3, x4, y4, K As _Unsigned Long)
    FillTriangle x1, y1, x2, y2, x3, y3, K
    FillTriangle x3, y3, x4, y4, x1, y1, K
End Sub

Find my programs here in Dav's QB64 Corner
Reply


Messages In This Thread
FillTriangle and FillQuad - by SMcNeill - 09-23-2023, 06:03 AM
RE: FillTriangle and FillQuad - by SMcNeill - 09-23-2023, 11:59 AM
RE: FillTriangle and FillQuad - by bplus - 09-23-2023, 01:37 PM
RE: FillTriangle and FillQuad - by SMcNeill - 09-23-2023, 02:46 PM
RE: FillTriangle and FillQuad - by Dav - 09-23-2023, 01:38 PM



Users browsing this thread: 1 Guest(s)