Hey, #pixelsart and/or #gamedev mastodon, I’m trying to figure out how to blit a scaled sprite from a sprite sheet onto a pixel buffer. This must be something you do all the damn time but I can’t find a single description of an algorithm for doing it.

Is it too trivial? It doesn’t seem trivial to me! I might be able to figure out something on graphing paper but I’m very dense and that seems like needlessly reinventing the wheel.

You have 24 hours or I’ll ask Clown Code
@amanda https://maque.github.io/roto-zoom/ maybe more than you asked for but all claudes are cops
Roto Zoom

@amanda I would expect low level stuff like this to be provided by the library I'm using, but if I had to do it from first principles (off the top of my head) I'd loop through the destination pixels and set them from the source pixel calculated using the ratio of the destination size to the source size

That doesn't sound very performant, so I'd probably optimize by doing one row at a time and copying the previous row if the math says they should be the same