svgpath 1.0.0

  • Installing
  • Versions
  • 7

svgpath #

This is a Dart port of Fontello's svgpath JavaScript library.

Low level toolkit for SVG paths transformations. Sometime you can't use transform attributes and have to apply changes to svg paths directly. Then this package is for you :) !

This package works both in browser and on server.


new SvgPath(path) #

Constructor. Creates new SvgPath class instance.

.abs() #

Converts all path commands to absolute.

.rel() #

Converts all path commands to relative. Useful to reduce output size.

.scale(sx [, sy])

Rescale path (the same as SVG scale transformation). sy = sx by default.

.translate(x [, y])

Translate path (the same as SVG translate transformation). y = 0 by default.

.rotate(angle [, rx, ry])

Rotate path to angle degrees around (rx, ry) point. If rotation center not set, (0, 0) used. The same as SVG rotate transformation.

.skewX(degrees) #

Skew path along the X axis by degrees angle.

.skewY(degrees) #

Skew path along the Y axis by degrees angle.

.matrix([ m1, m2, m3, m4, m5, m6 ])

Apply 2x3 affine transform matrix to path. Params - array. The same as SVG matrix transformation.

.transform(string) #

Any SVG transform or their combination. For example rotate(90) scale(2,3). The same format, as described in SVG standard for transform attribute.

.unshort() #

Converts smooth curves T/t/S/s with "missed" control point to generic curves (Q/q/C/c).

.unarc() #

Replaces all arcs with bezier curves.

.toString() -> String #

Returns final path string.

.round(precision) #

Round all coordinates to given decimal precision. By default round to integer. Useful to reduce resulting output string size.

.iterate(function(segment, index, x, y) [, keepLazyStack])

Apply iterator to all path segments.

  • Each iterator receives segment, index, x and y params. Where (x, y) - absolute coordinates of segment start point.
  • Iterator can modify current segment directly (return nothing in this case).
  • Iterator can return array of new segments to replace current one ([] means that current segment should be deleted).

If second param keepLazyStack set to true, then iterator will not evaluate stacked transforms prior to run. That can be useful to optimize calculations.

Changelog #

1.0.0 #

  • Fix matrix value helper function.

0.1.0 #

  • Implement BoundingBox

0.0.1 #

  • Initial version

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  svgpath: ^1.0.0

2. Install it

You can install packages from the command line:

with pub:

$ pub get

Alternatively, your editor might support pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:svgpath/svgpath.dart';
Version Uploaded Documentation Archive
1.0.0 Jan 15, 2017 Go to the documentation of svgpath 1.0.0 Download svgpath 1.0.0 archive
0.1.0 Jan 6, 2017 Go to the documentation of svgpath 0.1.0 Download svgpath 0.1.0 archive
0.0.1 Dec 31, 2016 Go to the documentation of svgpath 0.0.1 Download svgpath 0.0.1 archive
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

The package version is not analyzed, because it does not support Dart 2. Until this is resolved, the package will receive a health and maintenance score of 0.

Analysis issues and suggestions

Support Dart 2 in pubspec.yaml.

The SDK constraint in pubspec.yaml doesn't allow the Dart 2.0.0 release. For information about upgrading it to be Dart 2 compatible, please see

Maintenance issues and suggestions

Make sure dartdoc successfully runs on your package's source files. (-10 points)

Dependencies were not resolved.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.0.0 <2.0.0