Skip to content

v0.4.0

Pre-release
Pre-release
Compare
Choose a tag to compare
@zenozeng zenozeng released this 14 Aug 14:02

p5.svg

[email protected] (built on top of [email protected], with patch#850)

Filters

  • SVGFilters.apply(element, filter, arg)

  • filters chain using svg's in and result.

  • SVGElement.prototype.filter = function(filter, arg)

  • SVGElement.prototype.unfilter = function(filter, arg)

    Undo the filter applied.

  • SVGFilters.colorMatrix = function(inGraphics, resultGraphics, matrix)

  • SVGFilters.blur using feGaussianBlur

  • SVGFilters.gray using feColorMatrix (CIE luminance)

  • SVGFilters.invert using feColorMatrix

  • SVGFilters.threshold using feColorMatrix and feComponentTransfer (linear feFunc)

  • SVGFilters.opaque using feColorMatrix

  • SVGFilters._discreteTableValues

    Generate discrete table values based on the given color map function

  • SVGFilters.posterize using feComponentTransfer (discrete feFunc)

  • SVGFilters.erode using feOffset and feBlend

    Will create 4 offset layer and combine them with current layer using darken blend mode.

  • SVGFilters.dilate using feOffset and feBlend

    Will create 4 offset layer and combine them with current layer using lighten blend mode.

p5.SVGElement

  • add p5.prototype.querySVG (querySelectorAll and map to SVGElement objects)

  • Extends p5.Element

  • SVGElement.prototype.query (querySelectorAll and map to SVGElement objects)

  • SVGElement.prototype.attribute (setAttributeNS, setAttribute and getAttribute)

  • SVGElement.prototype.append

  • SVGElement.create = function(nodeName, attributes)

  • SVGElement.prototype.parentNode()

    Get parent node

  • SVGElement.prototype.parentNode(selector)

    Get parent node matching given selector

  • SVGElement.prototype.matches = function(selector)

    To tell whether a element matches certain selector

  • SVGElement.prototype._getDefs

    Get defs element, or create one if not exists

RendererSVG

  • image(SVGElement) now supported

IO

  • private method p5.prototype._svg_get that handles dataurl and http requests
  • force request to dataurl to be async so that it won't mess up preload
  • p5.prototype.loadSVG (will return a SVGElement Object)

Etc

  • RendererSVG's image() now uses directly instead of drawImage
  • use [email protected] & update tests, fixes #104
  • add testRender.lock and testRender.unlock
  • add testRender.setMaxDiff
  • add testRender.setMaxPixelDiff

svgcanvas

  • replace encodeURI with encodeURIComponent in toDataURL
  • use new XMLSerializer().serializeToString(this.svg)
  • remove the buggy Context.prototype.getSerializedSvg