SixLabors / ImageSharp

:camera: A modern, cross-platform, 2D Graphics library for .NET
https://sixlabors.com/products/imagesharp/
Other
7.31k stars 846 forks source link

Modernize and optimize pixel format operations across platforms. #2645

Closed JimBobSquarePants closed 6 months ago

JimBobSquarePants commented 7 months ago

Prerequisites

Description

Fixes #2232 and #594

I don't expect anyone to reasonably find the time to analyze this line-by-line as it's a massive piece of work. However, changes on the whole are simplistic and the developer benefit massive.

API change Elevator Pitch

The abomination that is.

TPixel pixel = default;
pixel.FromScaledVector(vector)

Becomes, as nature intended.

TPixel pixel = TPixel.FromScaledVector(vector);

All other conversion methods follow suit where applicable.

JimBobSquarePants commented 6 months ago

Let's merge this. It's awesome.