Anonymous user
Bitmap/Bresenham's line algorithm: Difference between revisions
Bitmap/Bresenham's line algorithm (view source)
Revision as of 17:41, 9 November 2023
, 6 months ago→{{header|MiniScript}}
imported>Chinhouse |
imported>Chinhouse |
||
(2 intermediate revisions by the same user not shown) | |||
Line 2,836:
This GUI implementation is for use with [http://miniscript.org/MiniMicro Mini Micro].
<syntaxhighlight lang="miniscript">
end function▼
sx = sign(x0, x1)
▲ return j
▲end function
sy = sign(y0, y1)
▲Img.line = function(x1, y1, x2, y2)
err = dx
else
▲ dy = abs(y2 - y1)
▲ sy = -1 * -(y1 < y2)
end if
▲ er = -dy
▲ er = floor(er / 2)
while true
if
e2 =
if e2 > -dx then
end if
if e2 < dy then
end if
end while
end function
img=
drawLine img
gfx.clear
gfx.drawImage img, 0, 0
</syntaxhighlight>
|