Skip to content

ass::Backdrop#

Represents backdrop filter effect which applied to the pixels behind the view (i.e., blur, grayscale, etc.)

Header:#include <AUI/ASS/Property/Backdrop.h>
CMake:aui_link(my_target PUBLIC aui::views)

Detailed Description#

Matches CSS property backdrop-filter.

Because the effect is applied to everything behind the view, to see the effect the view's background needs to be transparent or partially transparent.

Examples#

examples/ui/backdrop/src/main.cpp

Backdrop - Backdrop effects demo.

                      FixedSize { 60_dp },
                      BorderRadius { 60_dp / 2.f },
                      Padding { 0 },
                      ATextAlign::CENTER,
                      Backdrop {
                          Backdrop::LiquidFluid {},
                      },
//                      Border { 1_dp, AColor::GRAY.transparentize(0.7f) },
                      BoxShadow { 0, 32_dp, 32_dp, AColor::BLACK.transparentize(0.8f) },
                  },

Public Types#

GaussianBlurCustom#


struct ass::Backdrop::GaussianBlurCustom

Underlying type of GaussianBlur but with customizable downscale. Generally, use GaussianBlur.

Field Description
AMetric radius blur radius. Performance costs of radius is O^2. Please use downscale factor to approximate large blur radius.
int downscale downscale factor. =1 equals don't affect. Must be positive. Effective blur radius is radius * downscale. However, the downscale part is done by cheap downscaling of the framebuffer texture. Thus, by raising downscale factor you can achieve larger blur radius with approximately same visual result. Performance benefit of downscale factor { .radius = 6_dp, .downscale = x } in comparison to { .radius = 6_dp * x, .downscale = 1 } is x^2.
view AUI_WITH_STYLE {
  Backdrop { Backdrop::GaussianBlur { .radius = 6_dp, .downscale = 4 } },
}
is visually approximately same as
view AUI_WITH_STYLE {
  Backdrop { Backdrop::GaussianBlur { .radius = 24_dp } },
}
but 16 times cheaper.
bool operator
const = default

GaussianBlur#


struct ass::Backdrop::GaussianBlur

Fast gaussian blur. Strictly speaking, it's not an actual gaussian blur but a faster implementation of it.

GaussianBlur calculates best downscale parameter applicable for passed radius.

Downscale factor allows to produce approximately same visual result at drastically lower cost. You can use GaussianBlurCustom directly to specify your downscale factor.

Field Description
AMetric radius

LiquidFluid#


struct ass::Backdrop::LiquidFluid

Empty structure.