nowfound

Dev tools · October 10, 2022

CI

canvas_ity - A tiny, single-header canvas-like 2D rasterizer for C++

Hi HN! After a few years of off-and-on work on it, I'm pleased to release my canvas_ity library as open source. TLDR: This is a single-header C++ library with no dependencies beyond the standard C++ library. In about 2300 lines of 78-column code (not counting blanks or comments), or 1300 semicolons, it implements an API based on the basic W3C specification to draw 2D vector graphics into an image buffer: - Strokes and fills (with antialiasing and gamma-correct blending) - Linear and radial gradients - Patterns (with repeat modes and bi-cubic resampling) - Line caps and line joins (handling…

What it does

In the maker’s words, at launch

Hi HN! After a few years of off-and-on work on it, I'm pleased to release my canvas_ity library as open source. TLDR: This is a single-header C++ library with no dependencies beyond the standard C++ library. In about 2300 lines of 78-column code (not counting blanks or comments), or 1300 semicolons, it implements an API based on the basic W3C <canvas> specification to draw 2D vector graphics into an image buffer: - Strokes and fills (with antialiasing and gamma-correct blending) - Linear and radial gradients - Patterns (with repeat modes and bi-cubic resampling) - Line caps and line joins (handling high curvature) - Dash patterns and dash offsets - Transforms - Lines, quadratic and cubic Beziers, arcs, and rectangles - Text (very basic, but does its own TTF font file parsing) - Raster images (i.e., sprites) - Clipping (via masking) - Compositing modes (Porter-Duff) - Drop shadows with Gaussian blurs Why? Some years ago I needed to programmatically draw on an image file. I looked at Skia and was put off by its size and build complexity. Cairo was much better, but by then I was spoiled by the STB single-header libraries. I like tiny code and writing a single-header but powerful vector graphics library seemed like a fun challenge and a good way to pay things forward. I ended up with something that can compile down to less than 36 KiB of object code on x86-64 and uncovered a lot of interesting browser <canvas> quirks along the way with my testing suite. Enjoy!

Does the same job

all alternatives →

More dev tools this month

the category →
  • Dograh592

    The open source VAPI alternative

    Dev tools · 25d ago · dograh.com

  • Meridian530

    Don't let your work go unnoticed. Get promoted!

    Dev tools · 20d ago · meridiona.com

  • x1516

    Lovable for iPhone apps go from idea to App Store

    Dev tools · 11d ago · x1.new

  • Open-source GTM skills for technical founders

    Dev tools · 29d ago · gtmcofounder.com

  • OpenTrailPaper is open-source bike computer firmware for the LilyGO T5S3 4.7" E-Paper PRO. It supports offline maps, GPX routes, FIT recording and Bluetooth sensors.

    Dev tools · 1d ago · opentrailpaper.com

  • Nuphos380

    The AI-Native DevOps Workspace.

    Dev tools · 24d ago · nuphos.ai

Launched alongside, October 2022

the whole month →
  • I3

    Hey HN, I 3d scanned the interior of the Great Pyramid &#x2F; Khufu's pyramid for the Giza Project this summer and just finished the guided version to share. Would love feedback and&#x2F;or problems you encounter. I used both a Leica BLK 360 and Matterport Pro 2 to do the scanning and the Matterport SDK for the web viewer. Matterport's web display with Three.js has been the most accessible to a wide audience in the past (previous iterations are in Unity and Unreal, but difficult to download over slower connections). I've been interviewing social studies teachers around the 6th grade level to…

    Dev tools · 2022 · giza.mused.org

  • Clay819

    Discover, organize, and deepen relationships

    Work · 2022 · me.sh

  • RO

    Last time I posted this it didn't garner much interest. There have been lots of improvements and fixes since the last release. Quick list of features: - Workspaces - Tabs - Nested Folders - Lots of context menus - Response history - Plugins - Runs fully in the browser and runs offline if necessary - Chrome and Firefox extension to bypass CORS restrictions - Desktop builds for all platforms - GraphQL support - Import collections exported from Postman and Insomnia - Simple user friendly interface I built this because I love Insomnia but wanted a portable version that I could run in the…

    Dev tools · 2022 · restfox.dev

  • 100+ newsletters ready to promote your product

    Growth · 2022

  • Profitable Micro SaaS ideas, supportive community

    Life & fun · 2022 · microsaashq.com

  • AR

    APIs are a little like the open road—always waiting, full of opportunity, but hardly utilized. So here’s America, composed of several APIs that paint a vivid, real-time picture of a good old-fashioned road trip. Get local classifieds and photos. Tune into local radio stations. Talk wit other drivers. And more. Exploring the country by car was an invaluable experience for me during my time in the states. I’ve since moved to Barcelona, and find myself missing the territory. This is my attempt at recreating the magic.

    Life & fun · 2022 · 4m3ric4.com