1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 10:47:35 +00:00

LibGfx: Implement SmoothPixels scaling mode

If you wanted to upscale an image, you had two options:
- use Nearest Neighbor: it's probably a good choice. The image stays
  sharp.. unless you aren't using integer scales.
- use Bilinear blending, but this on the other hand, doesn't handle
  upscaling well. It just blurs everything.

But what if we could take the best of both of them and make the image
sharp on integers and just blur it a little when needed?

Well, there's Smooth Pixels!

This mode is similar to the Bilinear Blend, with the main difference
is that the blend ratio is multiplied by the current scale, so the blur
on corners can be only 1px wide.

From my testing this mode doesn't handles downscaling as good as the
Bilinear blending though.
This commit is contained in:
Karol Kosek 2022-06-03 17:16:38 +02:00 committed by Sam Atkins
parent c409881b5f
commit 3d7838c5fb
2 changed files with 26 additions and 1 deletions

View file

@ -36,6 +36,7 @@ public:
enum class ScalingMode {
NearestNeighbor,
SmoothPixels,
BilinearBlend,
};