09-23-2023, 01:38 PM
Woah these are really fast! Here's a simple usage.
- Dav
- 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