Bitmap/Bresenham's line algorithm: Difference between revisions
Content added Content deleted
imported>Chinhouse No edit summary |
imported>Chinhouse |
||
Line 2,788: | Line 2,788: | ||
This GUI implementation is for use with [http://miniscript.org/MiniMicro Mini Micro]. |
This GUI implementation is for use with [http://miniscript.org/MiniMicro Mini Micro]. |
||
<syntaxhighlight lang="miniscript"> |
<syntaxhighlight lang="miniscript"> |
||
⚫ | |||
// Name the method "bline" to differentiate it from the built-in "line" method. |
|||
⚫ | |||
dx = abs(x2 - x1) |
dx = abs(x2 - x1) |
||
sx = -1 * -(x1 < x2) |
sx = -1 * -(x1 < x2) |
||
Line 2,798: | Line 2,797: | ||
er = floor(er / 2) |
er = floor(er / 2) |
||
while true |
while true |
||
self.setPixel x1, y1 |
self.setPixel x1, y1, colr |
||
if x1 == x2 and y1 == y2 then break |
if x1 == x2 and y1 == y2 then break |
||
e2 = er |
e2 = er |