Skip to content

Make struct Pixel a type alias for rgb::RGBA8

Sven Neumann requested to merge svenfoo/librsvg:alias-pixel into master

Defining Pixel as a type alias for the RGBA type from the rgb crate allows us to use the traits implemented on that type.

The functions on Pixel however also need to be defined as a trait then as we are effectively adding methods to a foreign type. I've used PixelOps for now. We could consider to split this into several traits with more specific names.

IMO the code becomes more readable and also more idiomatic. However I am still somewhat concerned about the performance. The existing benchmarks indicate some improvements and some regressions and I'd like to have a closer look before this is merged.

Edited by Sven Neumann

Merge request reports