Canvas_ity: A tiny, single-header <canvas>-like 2D rasterizer for C++
35 points - today at 6:50 PM
SourceThe project is great. The HN comments are embarrassing. Isn’t it ironic to imply laziness by chiming in with “vibe coded” which in itself is such a lazy reaction.
Thank you for sharing. The only thing I don't understand why this is a header only implementation with a macro that goes in a C++ file.
#define CANVAS_ITY_IMPLEMENTATION
erwincoumans
today at 10:36 PM
It is common for header-only libraries: you need to include this header in one c++ using the macro for linking (don't use that macro in other c++ files to avoid duplicate symbols). In C++, you can declare a function as many times as you want, but you can only define it (write the actual body) once in the entire project.
It would be interesting to compile to WASM to compare side by side for performance and accuracy.
ranger_danger
today at 7:38 PM
vibe-coded?
nicoburns
today at 7:40 PM
Most likely not seeing as the commit containing the bulk of the implementation dropped in 2022.
ranger_danger
today at 7:45 PM
maybe just the README then
flowerbreeze
today at 8:02 PM
The README is older than ChatGPT too. It's very unlikely that it's vibe coded or vibe written.
peter-m80
today at 8:15 PM
Would that be an issue?
Yes, it's a canvas library, there's a lot of risks of including AI generated code that hasn't been checked in a rasterizing library.
ivanjermakov
today at 9:01 PM
A lot of risks compared to what? I imagine bugs in kernel drivers or disk utilities be riskier.
JoeyJoJoJr
today at 10:01 PM
Such as?