Skip to content

Conversation

@madsmtm
Copy link
Member

@madsmtm madsmtm commented Jan 27, 2026

Provide a few helper functions for handling the alpha channel when the pixel format of the buffer is PixelFormat::Bgra8 or PixelFormat::Rgba8.

I'm a bit unsure whether it makes sense to provide these? Their current implementations are quite simple, and if we can provide AlphaMode::Premultiplied everywhere, the [un-]premultiplication functions probably aren't really necessary. And perhaps the use-case of actually needing AlphaMode::Ignored is kinda niche, which makes make_pixels_opaque unnecessary too?


I think the biggest problem with providing these is that it kinda signals that they're fast implementations, which... They aren't really, they could be made much more performant using SIMD and/or rayon.

I know that I don't want Softbuffer to be in the business of providing drawing primitives like tiny-skia or vello_cpu does, and I guess you could argue that this is kinda in that category, at least in the sense that it's a very different set of things you need to worry about (CPU speed vs. abstracting platform details and managing buffers).

@madsmtm madsmtm added enhancement New feature or request question Further information is requested labels Jan 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request question Further information is requested

Development

Successfully merging this pull request may close these issues.

2 participants