Closed ripytide closed 3 months ago
I've managed to generically implement the map()
function using a PixelExt
trait with a generic associated type. It's the easiest way I could find.
Okay this time I've switched to HomogenousPixel
and HeterogeneousPixel
traits following the discussion in #79.
This way we're able to provide the map()
map_colors()
and map_alpha()
functions!
Does this fit your requirements @kornelski?
That's an interesting approach. I'm a bit worried how type errors may look like when this is used incorrectly, but let's roll with this for now.
Is my usage of
core::mem::transmute()
safe here? I couldn't find non-unsafe way of doing this.If this is okay then I'll add implementations for the other Pixel types.