1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 04:37:44 +00:00

LibGfx: Add StackBlurFilter, an efficient almost gaussian blur

This adds an implementation of StackBlur which is a very efficient
blur that closely approximates a gaussian blur. It has a number of
benefits over the existing FastBoxBlurFilter:

1. It's faster (~half the pixel lookups of a single box blur pass)
2. It only requires a single pass over image to produce good results
  - (Rather than the 3 the box blur requires)
3. It only needs to allocate a buffer of `blur_radius * 2 + 1` colors
  - These easily fits on the stack for any reasonable radius

For a detailed explanation of the algorithm check out this link:
https://observablehq.com/@jobleonard/mario-klingemans-stackblur
This commit is contained in:
MacDue 2022-06-28 10:55:48 +01:00 committed by Andreas Kling
parent 072a78b958
commit 7f8cf81f7a
3 changed files with 345 additions and 6 deletions

View file

@ -1,10 +1,10 @@
set(SOURCES
AffineTransform.cpp
AntiAliasingPainter.cpp
Bitmap.cpp
BitmapMixer.cpp
BMPLoader.cpp
BMPWriter.cpp
Bitmap.cpp
BitmapMixer.cpp
ClassicStylePainter.cpp
ClassicWindowTheme.cpp
Color.cpp
@ -14,27 +14,28 @@ set(SOURCES
Filters/ColorBlindnessFilter.cpp
Filters/FastBoxBlurFilter.cpp
Filters/LumaFilter.cpp
Filters/StackBlurFilter.cpp
Font/BitmapFont.cpp
Font/Emoji.cpp
Font/FontDatabase.cpp
Font/ScaledFont.cpp
Font/TrueType/Cmap.cpp
Font/TrueType/Font.cpp
Font/TrueType/Glyf.cpp
Font/TrueType/Cmap.cpp
Font/Typeface.cpp
Font/WOFF/Font.cpp
GIFLoader.cpp
ICOLoader.cpp
ImageDecoder.cpp
JPGLoader.cpp
Painter.cpp
Palette.cpp
Path.cpp
PBMLoader.cpp
PGMLoader.cpp
PNGLoader.cpp
PNGWriter.cpp
PPMLoader.cpp
Painter.cpp
Palette.cpp
Path.cpp
Point.cpp
QOILoader.cpp
QOIWriter.cpp