Learn/Remade with Rust

rusty_raster: A Hardened tiny-skia Fork in Pure Rust

rusty_raster 0.1.0 is a forbid(unsafe_code) fork of tiny-skia 0.12: anti-aliased fills, strokes, gradients and masks, bit-identical on 641 of 645 scenes.

Signed by M·
A painted workshop where a sign painter fills smooth curved letters on a wooden board with a fine brush, a ruler and dashed chalk guide lines beside the work
What is rusty_raster and how close is it to tiny-skia?

rusty_raster is a hardened forbid(unsafe_code) fork of tiny-skia 0.12 with the same API shape. On a 645-scene corpus rendered live against tiny-skia on Windows, Linux and macOS, 641 scenes are bit-identical and the other 4 differ by at most 1 level.

Every chart, icon, map line and vector logo ends up as pixels, and some piece of code has to decide which pixels a curve covers and how much. Browsers hand that job to Skia, a large C++ library. In Rust, the common answer has been tiny-skia, a CPU-only subset of Skia's ideas. rusty_raster is a hardened fork of tiny-skia 0.12 that keeps the familiar API and compiles with forbid(unsafe_code) from top to bottom.

It went to crates.io on 20 November 2026, under Apache-2.0 AND BSD-3-Clause. The source lives inside the media monorepo at crates/rusty_raster, Remade with Rust publishes a crate card, and MATA's usage notes are on the landing page.

Trust comes from a drawing library whose output was checked scene by scene against the code it forked. Security comes from a compiler that refuses every unsafe block in the crate. Incentive is a familiar API, so moving over is a dependency swap rather than a rewrite.

Why a 2D Rasteriser Belongs in the Safe Column

A rasteriser looks harmless because it draws shapes instead of parsing files. It still takes untrusted numbers. Path coordinates, stroke widths, dash arrays and gradient stops often arrive from an SVG, a font, a chart spec or a document someone else wrote. Feed an extreme value to code that does pointer arithmetic on a pixel buffer and the result is a write outside that buffer. The NIST Secure Software Development Framework and CISA's memory safe roadmaps both point at the same answer: keep code like this in a memory-safe language and keep the escape hatches closed.

Forking was the honest route. tiny-skia already had a careful design and years of users. The fork keeps that design, forbids unsafe throughout, and treats the original as the reference it must match.

What rusty_raster Draws

The feature list follows the parts of tiny-skia most programs actually call. For those features it can stand in for tiny-skia or for Skia's CPU path.

Fills, Strokes, Joins and Dashes

Paths fill with anti-aliased edges, so a diagonal line does not turn into a staircase. Strokes come with the usual joins and caps, dash patterns, and hairlines for one-pixel lines that stay crisp at any zoom. Those details are where a chart axis or a map border looks right or looks blurry, so they sit inside the scene-by-scene comparison described below.

Gradients, Blend Modes and Masks

Gradients cover shading, and blend modes decide how new paint mixes with what is already on the canvas, the same idea the W3C Compositing and Blending specification sets out for the web. Masks restrict where paint lands. Pixmap drawing composites one image onto another, which is how an icon gets stamped onto a thumbnail or a badge onto a photo.

One Optional Dependency and a Kept License

The only dependency is rusty_png, and it is optional: it writes a finished pixmap to disk as a PNG. A program that hands pixels straight to a screen or a video encoder can leave it out. Licensing follows the fork. The crate is Apache-2.0 AND BSD-3-Clause, tiny-skia's license is kept, and LICENSE-BSD-3-Clause plus NOTICE.md ship inside the package so credit travels with the code.

How the Fork Was Checked Against tiny-skia

A fork that claims to match its parent needs a test that would catch it lying, and building that test turned out to be the interesting part.

Stored Digests Could Not Pass Everywhere

The first idea was a folder of reference digests: render each scene with tiny-skia once, save a hash, and compare the fork against it forever. That never passed on every operating system. tiny-skia calls the platform maths library for functions such as acos, cos and powf, and those libraries disagree in the last bit between Windows, Linux and macOS. The reference itself changes per machine, so no single stored digest can be correct everywhere.

Rendering Both Libraries Live

The test now renders tiny-skia and the fork side by side on whichever machine runs it, and demands bit-identical output. Across a 645-scene corpus run on Windows, Linux and macOS, 641 scenes match exactly. The remaining four use the ColorDodge and ColorBurn blend modes and differ by at most one level. That is a measured difference, written down, not rounded away. Because the comparison runs on each operating system rather than against one saved answer, a future change that drifts on only one platform shows up on that platform's run instead of hiding behind a stale digest.

Where rusty_raster Fits

The first consumer is rusty_svgtree, which parses SVG into a tree and hands the drawing to this crate. Still images on either side of it come from rusty_png and rusty_jpeg, and the surrounding pipeline is remade_ffmpeg_rs. On a Home Computer, thumbnails and previews can be drawn locally instead of by a hosted renderer, which matters for the reasons the EFF keeps documenting. Why the distributed cloud needs memory-safe Rust makes the broader case, and MATA's rebuild catalog lists the rest of the family.

FAQ

Short answers already in this article.

What can rusty_raster draw?

Anti-aliased fills and strokes with joins, caps, dashes and hairlines, plus gradients, blend modes, masks and drawing one pixmap onto another. Those are the features where it replaces tiny-skia and Skia's CPU rasteriser.

Which scenes does rusty_raster not match bit for bit?

Four of the 645 scenes, all using the ColorDodge and ColorBurn blend modes. In those, rusty_raster differs from tiny-skia by at most one level per channel. The other 641 scenes are bit-identical.

Why does rusty_raster compare against tiny-skia live instead of stored images?

tiny-skia calls the platform maths library for functions such as acos, cos and powf, and those disagree in the last bit across operating systems. Stored reference digests could never pass everywhere, so the test renders both libraries on the machine running it.

What license does rusty_raster use?

Apache-2.0 AND BSD-3-Clause. tiny-skia's BSD-3-Clause license is kept, and the crate ships LICENSE-BSD-3-Clause and NOTICE.md so the original authors stay credited.

Does rusty_raster have dependencies?

One, and it is optional: rusty_png, for writing the finished pixmap as a PNG. Without that feature the rasteriser builds with nothing else from crates.io.