Log In  


Thick line drawing routine (as a reply to @JadeLombax Twitter).

Cart #rabogemeri-0 | 2020-07-29 | Code ▽ | Embed ▽ | No License
7

Manual:

linefill x0 y0 x1 y1 r [col]
draw a 2*r pixel wide line
note: r must be >= 0.5 to produce meaningful results
note: the code uses sub-pixel precision rasterization, allowing smooth movement

Example:

-- 4 pixel wide white line
linefill(45,34,67,96,2,7)
7


Looks nice, I'll have to try and figure out how it works. You said this is a reply to something from me on Twitter?


sorry - pseudo mixup! Was looking for @spellcaster i


The code is neat, the only "issue" I had is that I can't find a combination of values where the thick line and a circfill can agree on the same size. Besides that, it's perfect.


not a surprise - I don’t use the same rounding as native pico8 functions.
if you want an exact match, strip the ‘sub-pixel’ part from my code.
(but at the cost of a lot more pixel jerkiness)


That's why I placed "issue" it in quotes :)

I tinkered aground with it a bit, and found something that n should work well for the idea I have in mind.


the linefill code can be easily extended to draw arbitrary convex polygons. You can draw joints with the same pixel rules


Thanks for this. I realised I needed a thick line routine and this is perfect.



[Please log in to post a comment]