RazrFalcon / tiny-skia

A tiny Skia subset ported to Rust
BSD 3-Clause "New" or "Revised" License
1.05k stars 67 forks source link

Middleware Pattern #101

Closed notgull closed 11 months ago

notgull commented 11 months ago

I'm designing an API that uses tiny-skia as a public dependency. So far I've designed it to just take a PixmapMut<'_> to render into and a specialized cache object that contains some allocations to re-use.

Other graphics APIs, like wgpu, have an established middleware pattern that helps API users make their APIs composable with other graphics modules. Does tiny-skia have a model like this to ensure maximum compatibility with other packages?

If it's not just "pass along the pixmap" it should be written down somewhere.

RazrFalcon commented 11 months ago

If it's not just "pass along the pixmap" it should be written down somewhere.

It is just "pass along the pixmap". The whole point of tiny-skia is to remove as much abstractions as possible. You have a pixmap and you can draw directly onto it. That's it. It's intentionally low-level.

I would describe tiny-skia as a foundation for a 2D library and not the one.

notgull commented 11 months ago

That makes sense, thanks!