filter_erode: Filter: add an erosion effect to an element

Description Usage Arguments Value Examples

View source: R/filters.R

Description

The filter_erode() filter effectively thins out a source graphic by a given radius value. The higher the radius, the greater the extent of thinning.

Usage

1
filter_erode(radius = 1)

Arguments

radius

The extent to which the source graphic will be eroded. If a vector of two values are provided, the first value represents the x-radius and the second one the y-radius. If one value is provided, then that value is used for both x and y.

Value

An svg object.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
if (interactive()) {

# Add a text element to an
# SVG drawing and erode it with
# the `filter_erode()` filter
SVG(width = 200, height = 100) %>%
  svg_filter(
    id = "erode",
    filters = list(
      filter_erode(radius = c(1, 0))
    )
  ) %>%
  svg_text(
    x = 10, y = 40,
    text = "Erosion",
    attrs = svg_attrs_pres(
      font_size = "3em",
      font_weight = "bolder",
      filter = "erode"
    )
  )
}

omsvg documentation built on Feb. 10, 2021, 5:10 p.m.