Log In  

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

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

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)
P#80095 2020-07-29 16:32 ( Edited 2020-07-29 16:35)

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?

P#80109 2020-07-30 01:34

sorry - pseudo mixup! Was looking for @spellcaster i

P#80118 2020-07-30 07:01

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.

P#80119 2020-07-30 07:53

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)

P#80124 2020-07-30 11:17

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.

P#80130 2020-07-30 16:45

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

P#80137 2020-07-30 19:49

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

P#85699 2020-12-22 21:48

[Please log in to post a comment]

Follow Lexaloffle:        
Generated 2022-09-29 01:59:45 | 0.035s | Q:25