Conversation
304f431 to
dc30b3c
Compare
4e611ed to
4a776fe
Compare
fe20944 to
693551c
Compare
On one hand, if some platforms only support premultiplied alpha and some only support postmultiplied, it would be nice for a user of softbuffer to not need to depend on But yeah, if we're only going to provide fairly trivial unoptimized helpers, maybe the user of the library can do that themself. And I'm not familiar with the tricks for optimizing this sort of thing, but I don't know if we want to add fancy SIMD code to |
I'm kinda in the same boat. I think we can support |
Provide a few helper functions for handling the alpha channel when the pixel format of the buffer is
PixelFormat::Bgra8orPixelFormat::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::Premultipliedeverywhere, the [un-]premultiplication functions probably aren't really necessary. And perhaps the use-case of actually needingAlphaMode::Ignoredis kinda niche, which makesmake_pixels_opaqueunnecessary 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-skiaorvello_cpudoes, 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).