SVGElement: A class representing a single SVG element.

Description Super class Public fields Methods Examples

Description

A class representing a single SVG element.

A class representing a single SVG element.

Super class

minisvg::SVGNode -> SVGElement

Public fields

name

Tag name for this node e.g. "circle"

attribs

named list of attributes for this node

children

ordered list of direct child nodes (kept in insertion order)

child

lists of child nodes indexed by tag name.

Methods

Public methods

Inherited methods

Method a()

Usage
SVGElement$a(..., href = NULL)

Method animate()

Usage
SVGElement$animate(
  ...,
  attributeName = NULL,
  attributeType = NULL,
  from = NULL,
  to = NULL,
  dur = NULL,
  repeatCount = NULL,
  begin = NULL,
  end = NULL,
  calcMode = NULL,
  values = NULL,
  keyTimes = NULL,
  keySplines = NULL,
  by = NULL
)

Method animateMotion()

Usage
SVGElement$animateMotion(
  ...,
  calcMode = NULL,
  path = NULL,
  keyPoints = NULL,
  rotate = NULL,
  origin = NULL
)

Method animateTransform()

Usage
SVGElement$animateTransform(
  ...,
  attributeName = NULL,
  attributeType = NULL,
  by = NULL,
  from = NULL,
  to = NULL,
  type = NULL,
  dur = NULL,
  repeatCount = NULL
)

Method circle()

Usage
SVGElement$circle(..., cx = NULL, cy = NULL, r = NULL)

Method clipPath()

Usage
SVGElement$clipPath(..., id = NULL)

Method defs()

Usage
SVGElement$defs(...)

Method desc()

Usage
SVGElement$desc(...)

Method discard()

Usage
SVGElement$discard(..., begin = NULL, href = NULL)

Method ellipse()

Usage
SVGElement$ellipse(..., cx = NULL, cy = NULL, rx = NULL, ry = NULL)

Method feBlend()

Usage
SVGElement$feBlend(..., in_ = NULL, in2 = NULL, mode = NULL, result = NULL)

Method feColorMatrix()

Usage
SVGElement$feColorMatrix(
  ...,
  in_ = NULL,
  type = NULL,
  values = NULL,
  result = NULL
)

Method feComponentTransfer()

Usage
SVGElement$feComponentTransfer(..., in_ = NULL, result = NULL)

Method feComposite()

Usage
SVGElement$feComposite(
  ...,
  in_ = NULL,
  in2 = NULL,
  operator = NULL,
  k1 = NULL,
  k2 = NULL,
  k3 = NULL,
  k4 = NULL,
  result = NULL
)

Method feConvolveMatrix()

Usage
SVGElement$feConvolveMatrix(
  ...,
  in_ = NULL,
  order = NULL,
  kernelMatrix = NULL,
  divisor = NULL,
  bias = NULL,
  targetX = NULL,
  targetY = NULL,
  edgeMode = NULL,
  kernelUnitLength = NULL,
  preserveAlpha = NULL,
  result = NULL
)

Method feDiffuseLighting()

Usage
SVGElement$feDiffuseLighting(
  ...,
  in_ = NULL,
  surfaceScale = NULL,
  diffuseConstant = NULL,
  kernelUnitLength = NULL,
  result = NULL
)

Method feDisplacementMap()

Usage
SVGElement$feDisplacementMap(
  ...,
  in_ = NULL,
  in2 = NULL,
  scale = NULL,
  xChannelSelector = NULL,
  yChannelSelector = NULL,
  result = NULL
)

Method feFlood()

Usage
SVGElement$feFlood(
  ...,
  flood_color = NULL,
  flood_opacity = NULL,
  result = NULL
)

Method feFuncR()

Usage
SVGElement$feFuncR(..., type = NULL, tableValues = NULL)

Method feFuncG()

Usage
SVGElement$feFuncG(..., type = NULL, tableValues = NULL)

Method feFuncB()

Usage
SVGElement$feFuncB(..., type = NULL, tableValues = NULL)

Method feFuncA()

Usage
SVGElement$feFuncA(..., type = NULL, tableValues = NULL)

Method feGaussianBlur()

Usage
SVGElement$feGaussianBlur(
  ...,
  in_ = NULL,
  stdDeviation = NULL,
  edgeMode = NULL,
  result = NULL
)

Method feImage()

Usage
SVGElement$feImage(
  ...,
  preserveAspectRatio = NULL,
  xlink_href = NULL,
  result = NULL
)

Method feMerge()

Usage
SVGElement$feMerge(..., result = NULL)

Method feMergeNode()

Usage
SVGElement$feMergeNode(..., in_ = NULL)

Method feMorphology()

Usage
SVGElement$feMorphology(
  ...,
  in_ = NULL,
  operator = NULL,
  radius = NULL,
  result = NULL
)

Method feOffset()

Usage
SVGElement$feOffset(..., in_ = NULL, dx = NULL, dy = NULL, result = NULL)

Method feSpecularLighting()

Usage
SVGElement$feSpecularLighting(
  ...,
  in_ = NULL,
  surfaceScale = NULL,
  specularConstant = NULL,
  specularExponent = NULL,
  kernelUnitLength = NULL,
  result = NULL
)

Method feTile()

Usage
SVGElement$feTile(..., in_ = NULL, result = NULL)

Method feTurbulence()

Usage
SVGElement$feTurbulence(
  ...,
  type = NULL,
  baseFrequency = NULL,
  numOctaves = NULL,
  seed = NULL,
  stitchTiles = NULL,
  result = NULL
)

Method filter()

Usage
SVGElement$filter(
  ...,
  id = NULL,
  x = NULL,
  y = NULL,
  width = NULL,
  height = NULL,
  filterRes = NULL,
  filterUnits = NULL,
  primitiveUnits = NULL,
  xlink_href = NULL
)

Method foreignObject()

Usage
SVGElement$foreignObject(..., x = NULL, y = NULL, width = NULL, height = NULL)

Method g()

Usage
SVGElement$g(..., id = NULL)

Method image()

Usage
SVGElement$image(
  ...,
  x = NULL,
  y = NULL,
  width = NULL,
  height = NULL,
  xlink_href = NULL,
  preserveAspectRatio = NULL
)

Method line()

Usage
SVGElement$line(..., x1 = NULL, y1 = NULL, x2 = NULL, y2 = NULL)

Method linearGradient()

Usage
SVGElement$linearGradient(
  ...,
  x1 = NULL,
  y1 = NULL,
  x2 = NULL,
  y2 = NULL,
  href = NULL,
  gradientTransform = NULL,
  gradientUnits = NULL,
  spreadMethod = NULL
)

Method marker()

Usage
SVGElement$marker(
  ...,
  refX = NULL,
  refY = NULL,
  markerWidth = NULL,
  markerHeight = NULL,
  markerUnits = NULL,
  orient = NULL,
  preserveAspectRatio = NULL,
  viewBox = NULL
)

Method mask()

Usage
SVGElement$mask(
  ...,
  x = NULL,
  y = NULL,
  width = NULL,
  height = NULL,
  maskUnits = NULL,
  maskContentUnits = NULL
)

Method mpath()

Usage
SVGElement$mpath(..., xlink_href = NULL)

Method path()

Usage
SVGElement$path(..., d = NULL, pathLength = NULL)

Method pattern()

Usage
SVGElement$pattern(
  ...,
  id = NULL,
  x = NULL,
  y = NULL,
  width = NULL,
  height = NULL,
  href = NULL,
  patternUnits = NULL,
  patternTransform = NULL,
  preserveAspectRatio = NULL
)

Method radialGradient()

Usage
SVGElement$radialGradient(
  ...,
  id = NULL,
  cx = NULL,
  cy = NULL,
  r = NULL,
  fx = NULL,
  fy = NULL,
  fr = NULL,
  href = NULL,
  gradientUnits = NULL,
  gradientTransform = NULL,
  spreadMethod = NULL
)

Method rect()

Usage
SVGElement$rect(
  ...,
  x = NULL,
  y = NULL,
  width = NULL,
  height = NULL,
  rx = NULL,
  ry = NULL
)

Method script()

Usage
SVGElement$script(..., type = NULL, href = NULL)

Method set()

Usage
SVGElement$set(..., to = NULL)

Method stop()

Usage
SVGElement$stop(..., offset = NULL, stop_color = NULL, stop_opacity = NULL)

Method style()

Usage
SVGElement$style(...)

Method switch()

Usage
SVGElement$switch(...)

Method symbol()

Usage
SVGElement$symbol(
  ...,
  id = NULL,
  x = NULL,
  y = NULL,
  width = NULL,
  height = NULL,
  refX = NULL,
  refY = NULL,
  preserveAspectRatio = NULL
)

Method text()

Usage
SVGElement$text(
  ...,
  x = NULL,
  y = NULL,
  dx = NULL,
  dy = NULL,
  rotate = NULL,
  textWidth = NULL,
  lengthAdjust = NULL
)

Method textPath()

Usage
SVGElement$textPath(
  ...,
  href = NULL,
  path = NULL,
  method = NULL,
  side = NULL,
  spacing = NULL,
  startOffset = NULL,
  textLength = NULL,
  lengthAdjust = NULL
)

Method title()

Usage
SVGElement$title(...)

Method use()

Usage
SVGElement$use(
  ...,
  x = NULL,
  y = NULL,
  width = NULL,
  height = NULL,
  href = NULL
)

Method matrix()

Usage
SVGElement$matrix(a, b, c, d, e, f)

Method translate()

Usage
SVGElement$translate(x, y = NULL)

Method scale()

Usage
SVGElement$scale(x, y = NULL)

Method rotate()

Usage
SVGElement$rotate(a, x = NULL, y = NULL)

Method skewX()

Usage
SVGElement$skewX(a)

Method skewY()

Usage
SVGElement$skewY(a)

Method polygon()

Usage
SVGElement$polygon(xs = NULL, ys = NULL, points = NULL, ...)

Method polyline()

Usage
SVGElement$polyline(xs = NULL, ys = NULL, points = NULL, ...)

Method new()

Initialize an SVGElement

Usage
SVGElement$new(name, ...)
Arguments
name

node name e.g. "circle"

...

further arguments. Named arguments treated as attributes, unnamed arguments treated as child nodes


Method update()

Update the SVG Element.

Usage
SVGElement$update(...)
Arguments
...

attributes and children to set on this node

Details

Named arguments are considered attributes and will overwrite existing attributes with the same name. Set to NULL to delete the attribute

Unnamed arguments are appended to the list of child nodes. These should be text, other SVGElements or any ojbect that can be represented as a single text string using "as.character()"

To print just the attribute name, but without a value, set to NA


Method append()

Append child nodes at the specified position.

Usage
SVGElement$append(..., position = NULL)
Arguments
...

child nodes

position

by default at the end of the list of children nodes but 'position' argument can be used to set location by index


Method update_child_list()

Update the list of child nodes by tag name

Usage
SVGElement$update_child_list(new_elem)
Arguments
new_elem

the element being added


Method rebuild_child_list()

URebuild the list of child nodes by tag name

Usage
SVGElement$rebuild_child_list()

Method add()

Simultaneous create an SVG element and add it as a child node

Usage
SVGElement$add(name, ...)
Arguments
name

name of node to create

...

attributes and children of this newly created node

Returns

In contrast to most other methods, $add() returns the newly created element, not the document


Method remove()

Remove child objects at the given indices

Usage
SVGElement$remove(indices)
Arguments
indices

indices of the children to remove


Method reset_transform()

Remove any transform attributes from this node

Usage
SVGElement$reset_transform()

Method as_character_inner()

Recursively convert this SVGElement and children to text

Usage
SVGElement$as_character_inner(..., depth = 0)
Arguments
...

ignored

depth

recursion depth

Returns

single character string


Method as_character()

Recursively convert this SVGElement and children to text

Usage
SVGElement$as_character(..., depth = 0, include_declaration = FALSE)
Arguments
...

ignored

depth

recursion depth. default: 0

include_declaration

Include the leading XML declaration? default: FALSE

Returns

single character string


Method save()

Save the text representation of this node and its children

Usage
SVGElement$save(filename, include_declaration = FALSE, ...)
Arguments
filename

filename

include_declaration

Include the leading XML declaration? default: FALSE

...

Extra arguments passed to SVGElement$as_character()


Method has_attribs()

test if this element has all of the named attributes

Usage
SVGElement$has_attribs(attribs)
Arguments
named

list of attributes

Returns

logical. Note: if length(attribs) == 0, this method returns TRUE


Method find()

Find elements which match the given tag names and attributes.

Usage
SVGElement$find(tag = c(), attribs = list())
Arguments
tag

character vector of tags to find. default: c()

attribs

named list of attributes to match. default: list(). Note that attribute matching is matched using in

Returns

List of R6 reference objects

Examples
\dontrun{
doc$find(tag = c('rect', 'circle'), attribs = list(fill = c('red', 'black')))
}


Method copy()

Make a deep copy of this node and its children

Usage
SVGElement$copy()

Method clone()

The objects of this class are cloneable with this method.

Usage
SVGElement$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.

Examples

1
2
3
4
5
6
7
8
## ------------------------------------------------
## Method `SVGElement$find`
## ------------------------------------------------

## Not run: 
doc$find(tag = c('rect', 'circle'), attribs = list(fill = c('red', 'black')))

## End(Not run)

coolbutuseless/minisvg documentation built on May 2, 2020, 3:15 a.m.