Expand description
SVG2 filter function shortcuts - blur(), brightness(), etc.
The <filter> element from SVG1.1 (also present in SVG2) uses some verbose XML to
define chains of filter primitives. In SVG2, there is a shortcut form of the filter
attribute and property, where one can simply say filter="blur(5)" and get the
equivalent of writing a full <filter> with a <feGaussianBlur> element.
This module has a type for each of the filter functions in SVG2 with the function’s
parameters, for example Blur stores the blur’s standard deviation parameter.
Those types get aggregated in the FilterFunction enum. A FilterFunction can
then convert itself into a FilterSpec, which is ready to be rendered on a surface.
Structs§
- Blur
- Parameters for the
blur()filter function - Brightness
- Parameters for the
brightness()filter function - Contrast
- Parameters for the
contrast()filter function - Drop
Shadow - Parameters for the
drop-shadow()filter function - Grayscale
- Parameters for the
grayscale()filter function - HueRotate
- Parameters for the
hue-rotate()filter function - Invert
- Parameters for the
invert()filter function - Opacity
- Parameters for the
opacity()filter function - Saturate
- Parameters for the
saturate()filter function - Sepia
- Parameters for the
sepia()filter function
Enums§
- Filter
Function - CSS Filter functions from the Filter Effects Module Level 1
Functions§
- drop_
shadow_ primitives - Creates the filter primitives required for a
feDropShadoweffect. - parse_
blur 🔒 - parse_
brightness 🔒 - parse_
contrast 🔒 - parse_
dropshadow 🔒 - parse_
function 🔒 - parse_
grayscale 🔒 - parse_
huerotate 🔒 - parse_
invert 🔒 - parse_
num_ 🔒or_ percentage - Reads an optional number or percentage from the parser. Negative numbers are not allowed.
- parse_
num_ 🔒or_ percentage_ clamped - Reads an optional number or percentage from the parser, returning a value clamped to [0, 1]. Negative numbers are not allowed.
- parse_
opacity 🔒 - parse_
saturate 🔒 - parse_
sepia 🔒