tamlyn / svg-bounds

Calculate bounding box for SVG path in PHP

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SVG Bounds in PHP

Calculate smallest bounding rectangle for given SVG path strings and points.

Only handles paths composed of straight lines. Bezier and arc commands throw an exception.

Example usage:

 $bounds = SvgBounds::fromPath('M 100 100L300 100 200 300z');
 echo $bounds->getWidth(); //200
 $bounds->extend(350, 100);
 echo $bounds->getWidth(); //250

License: Public domain

About

Calculate bounding box for SVG path in PHP


Languages

Language:PHP 100.0%