canvas_ity
scheme-for-max
canvas_ity | scheme-for-max | |
---|---|---|
7 | 34 | |
318 | 181 | |
- | - | |
2.5 | 2.8 | |
2 months ago | about 1 month ago | |
C++ | C | |
ISC License | GNU General Public License v3.0 or later |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
canvas_ity
-
Writing a TrueType font renderer
I have a small TTF implementation that's in the neighborhood of that size and is open source. It's part of my canvas_ity single-header library [0] that's around 2300 LOC / 36 KB object size and implements a C++ version of most of the 2D HTML5 canvas spec [1].
The core implementation of the TTF parsing and drawing is in L1526-L1846 with another small bit at L3205-L3274 of src/canvas_ity.hpp.
It's something of a toy implementation that only supports western left-to-right text, and doesn't do any hinting at all, nor kerning, nor shaping. But it's enough to draw a basic "Hello world!" using any typical TTF file.
The test suite in test/test.cpp L84-304 embeds a few custom Base64-encoded TTF files. They're small and only have a few glyphs but they do exercise a number of interesting edge cases in the OpenType TTF spec [2]. Have a look at the HTML5 port of the test suite at test/test.html in different browsers to see how their canvas implementations render those fonts.
[0] https://github.com/a-e-k/canvas_ity
[1] https://www.w3.org/TR/2015/REC-2dcontext-20151119/
[2] https://standards.iso.org/ittf/PubliclyAvailableStandards/c0...
-
The Lone Developer Problem
Agreed, that sort of documentation is pure gold when done well.
It's something I always try to pay forward by doing in my own code. For example, one of my own solo projects was an STB-style single-header -like rasterizer library for C++. I started the implementation half of the library with a short outline of the rendering pipeline's dataflow and the top-level functions responsible for each stage:
https://github.com/a-e-k/canvas_ity/blob/f32fbb37e2fe7c0fcae...
-
Ask HN: What have you created that deserves a second chance on HN?
https://github.com/a-e-k/canvas_ity
This is an STB-style 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 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
I also uncovered a number of interesting browser quirks along the way with the HTML5 port of my testing suite.
- Hello, PNG
- A tiny, single-header -like 2D rasterizer for C++
-
canvas_ity - A tiny, single-header <canvas>-like 2D rasterizer
Repository: https://github.com/a-e-k/canvas_ity
- Show HN: Canvas_ity – A tiny, single-header -like 2D rasterizer for C++
scheme-for-max
- Music for Programming
- Learn How to Build Your Own Max for Live Devices
- MAX lessons
-
Ask HN: Most interesting tech you built for just yourself?
Mine is Scheme for Max, now on it's fourth open source release, but really written so I could make computer music how I want to. It's an extension to the popular Max/MSP visual music programming environment that embeds an s7 Scheme interpreter and provides a substantial API/FFI to Max. It allows you to script Max (and thus also Ableton Live) with Scheme, enabling interactive coding, algorithmic music, live coding, macros, and just much more pleasant scripting than in JavaScript. It locks in with the scheduler so you can even use Scheme powered sequencers within Ableton Live alongside regular Live tracks, and you can build sophisticated Live control surfaces using the Live API.
Github page here: https://github.com/iainctduncan/scheme-for-max
-
Need explanation for MIDI
The project page is here, with links to lots of documentation I've done: https://github.com/iainctduncan/scheme-for-max
- Controlling parameters with audio?
-
Processing audio buffers with Scheme for Max (cookbook and tutorial)
To download Scheme for Max and for tutorials, documentation, and the cookbook, visit the GitHub page: https://github.com/iainctduncan/scheme-for-max
-
The Janet Language
If you like things like Janet, you might also like s7 Scheme. It is also a minimal Scheme built entirely in C and dead easy to embed. I used it to make Scheme for Max and Scheme for Pd, extensions to the Max and Pd computer music platform to allow scripting them in Scheme. (https://github.com/iainctduncan/scheme-for-max) Janet was one of the options I looked pretty closely at before choosing s7.
The author (Bill Schottstaedt, Stanford CCRMA) is not too interested in making pretty web pages, ha, but the language is great!
-
Which coding language to start with?
Project page: https://github.com/iainctduncan/scheme-for-max
-
Ask HN: What have you created that deserves a second chance on HN?
I created Scheme for Max and Scheme for Pure Data. They are extensions to the Max/MSP, Ableton Live, and Pure Data computer music environments that embed an s7 Scheme interpreter in the host so that you can script, automate, and live code the hosts with s7, a Scheme from the CCRMA computer music center at Stanford and the same one used in the Snd editor and the Common Music 3 algorithmic composition environment. This allows you to do things like write algorithmic music tools, sequencers, and use the Ableton Live API in Scheme, including with Common Lisp style macros. It has an API for integrating with Max to share data structures, hook into the scheduler, run in the high priority thread, and so on. S4M allows you to do all the goodness of high level music programming in a Lisp, without losing the ability to use modern commercial tooling and instruments. It's my thesis project for a Masters in Music Technology with Andy Schloss and George Tzanetakis at the University of Victoria, and I plan to continue to a PhD working on it. I tried submitting twice, but it never made the page, which surprised me a bit given Lisp interest here.
The github page is here: https://github.com/iainctduncan/scheme-for-max
The youtube channel with various demos is here: https://www.youtube.com/c/musicwithlisp
What are some alternatives?
nanovgXC - Lightweight vector graphics library implementing exact-coverage antialiasing in OpenGL
janet - A dynamic language and bytecode vm
tinf - Tiny inflate library (inflate, gzip, zlib)
Rack - The virtual Eurorack studio
Tephra - A modern, high-performance C++17 graphics and compute library based on Vulkan
BespokeSynth - Software modular synth [Moved to: https://github.com/BespokeSynth/BespokeSynth]
art - @Bigfan/art is a React custom renderer for HTML5 Canvas.
score - ossia score, an interactive sequencer for the intermedia arts
osxphotos - Python app to work with pictures and associated metadata from Apple Photos on macOS. Also includes a package to provide programmatic access to the Photos library, pictures, and metadata.
BespokeSynth - Software modular synth
fpng - Super fast C++ .PNG writer/reader
pyo - Python DSP module