"filter" and "backdrop-filter" properties of View

The "filter" property (Filter constant) applies graphical effects to the View, such as blurring, color shifting, changing brightness/contrast, etc.The "backdrop-filter" property (BackdropFilter constant) applies the same effects but to the area behind a View.

Only the ViewFilter interface is used as the value of the "filter" properties.ViewFilter is created using the function

func NewViewFilter(params Params) ViewFilter

The argument lists the effects to apply. The following effects are possible:

Effect Constant Type Description
"blur" Blur float64 0…10000px Gaussian blur
"brightness" Brightness float64 0…10000% Brightness change
"contrast" Contrast float64 0…10000% Contrast change
"drop-shadow" DropShadow []ViewShadow Adding shadow
"grayscale" Grayscale float64 0…100% Converting to grayscale
"hue-rotate" HueRotate AngleUnit Hue rotation
"invert" Invert float64 0…100% Invert colors
"opacity" Opacity float64 0…100% Changing transparency
"saturate" Saturate float64 0…10000% Saturation change
"sepia" Sepia float64 0…100% Conversion to sepia

Example

rui.Set(view, "subview", rui.Filter, rui.NewFilter(rui.Params{rui.Brightness: 200,rui.Contrast: 150,}))

You can get the value of the current filter using functions

func GetFilter(view View, subviewID ...string) ViewFilter
func GetBackdropFilter(view View, subviewID ...string) ViewFilter