Module filter_func

Module filter_func 

Source
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
DropShadow
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§

FilterFunction
CSS Filter functions from the Filter Effects Module Level 1

Functions§

drop_shadow_primitives
Creates the filter primitives required for a feDropShadow effect.
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 🔒