RazrFalcon / tiny-skia

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

BGRA8888 format #56

Closed i509VCB closed 1 year ago

i509VCB commented 1 year ago

It would be desirable to support BGRA8888 along side RGBA8888 because some windowing systems, namely Wayland are required to support what tiny-skia would call BGRA8888. Compositors can support RGBA8888 but it's optional.

CryZe commented 1 year ago

I've had the same problem. One thing I've considered doing is simply swapping the B and R channel for all the input colors I use for drawing.

RazrFalcon commented 1 year ago

You should simply swap B a R before passing to tiny-skia and swap it back after. Because the only way it could be implemented on the tiny-skia side is by doing the same before each draw call, which only be slower.

I can add a PixmapMut method for doing this, but that's about it.