Add an AnimatedIcon class and vitool (vector icon tool) to generate data for it (#13530)

This commit is contained in:
amirh
2017-12-21 15:46:05 -08:00
committed by GitHub
parent a5b277030a
commit 56061759fc
29 changed files with 4575 additions and 2 deletions

View File

@@ -166,6 +166,7 @@ Future<Null> _runTests() async {
await _runAllDartTests(path.join(flutterRoot, 'dev', 'devicelab'));
await _runFlutterTest(path.join(flutterRoot, 'dev', 'manual_tests'));
await _runFlutterTest(path.join(flutterRoot, 'dev', 'tools', 'vitool'));
await _runFlutterTest(path.join(flutterRoot, 'examples', 'hello_world'));
await _runFlutterTest(path.join(flutterRoot, 'examples', 'layers'));
await _runFlutterTest(path.join(flutterRoot, 'examples', 'stocks'));

9
dev/tools/vitool/.gitignore vendored Normal file
View File

@@ -0,0 +1,9 @@
# Files and directories created by pub
.packages
.pub/
build/
# Remove the following pattern if you wish to check in your lock file
pubspec.lock
# Directory created by dartdoc
doc/api/

View File

@@ -0,0 +1,13 @@
# vitool
This tool generates Dart files from frames described in SVG files that follow
the small subset of SVG described below.
This tool was crafted specifically to handle the assets for certain Material
design animations as created by the Google Material Design team, and is not
intended to be a general-purpose tool.
## Supported SVG features
- groups
- group transforms
- group opacities
- paths (strokes are not supported, only fills, eliptical arc curve commands are not supported)

View File

@@ -0,0 +1,97 @@
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'dart:io';
import 'package:args/args.dart';
import 'package:vitool/vitool.dart';
const String kCodegenComment =
'// AUTOGENERATED FILE DO NOT EDIT!\n'
'// This file was generated by vitool.\n';
void main(List<String> args) {
final ArgParser parser = new ArgParser();
parser.addFlag(
'help',
abbr: 'h',
negatable: false,
help: 'Display the tool\'s usage instructions and quit.'
);
parser.addOption(
'output',
abbr: 'o',
help: 'Target path to write the generated Dart file to.'
);
parser.addOption(
'asset-name',
abbr: 'n',
help: 'Name to be used for the generated constant.'
);
parser.addOption(
'part-of',
abbr: 'p',
help: 'Library name to add a dart \'part of\' clause for.'
);
parser.addOption(
'header',
abbr: 'd',
help: 'File whose contents are to be prepended to the beginning of '
'the generated Dart file; this can be used for a license comment.'
);
parser.addFlag(
'codegen_comment',
abbr: 'c',
defaultsTo: true,
help: 'Whether to include the following comment after the header:\n'
'$kCodegenComment'
);
final ArgResults argResults = parser.parse(args);
if (argResults['help'] ||
!argResults.wasParsed('output') ||
!argResults.wasParsed('asset-name') ||
argResults.rest.isEmpty) {
printUsage(parser);
return;
}
final List<FrameData> frames = <FrameData>[];
for (String filePath in argResults.rest) {
final FrameData data = interpretSvg(filePath);
frames.add(data);
}
final StringBuffer generatedSb = new StringBuffer();
if (argResults.wasParsed('header')) {
generatedSb.write(new File(argResults['header']).readAsStringSync());
generatedSb.write('\n');
}
if (argResults['codegen_comment'])
generatedSb.write(kCodegenComment);
if (argResults.wasParsed('part-of'))
generatedSb.write('part of ${argResults['part-of']};\n');
final Animation animation = new Animation.fromFrameData(frames);
generatedSb.write(animation.toDart('_AnimatedIconData', argResults['asset-name']));
final File outFile = new File(argResults['output']);
outFile.writeAsStringSync(generatedSb.toString());
}
void printUsage(ArgParser parser) {
print('Usage: vitool --asset-name=<asset_name> --output=<output_path> <frames_list>');
print('\nExample: vitool --asset-name=_\$menu_arrow --output=lib/data/menu_arrow.g.dart assets/svg/menu_arrow/*.svg\n');
print(parser.usage);
}

View File

@@ -0,0 +1,560 @@
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'dart:io';
import 'dart:math';
import 'package:collection/collection.dart';
import 'package:meta/meta.dart';
import 'package:vector_math/vector_math_64.dart';
import 'package:xml/xml.dart' as xml show parse;
import 'package:xml/xml.dart' hide parse;
// String to use for a single indentation.
const String kIndent = ' ';
/// Represents an animation, and provides logic to generate dart code for it.
class Animation {
const Animation(this.size, this.paths);
factory Animation.fromFrameData(List<FrameData> frames) {
_validateFramesData(frames);
final Point<double> size = frames[0].size;
final List<PathAnimation> paths = <PathAnimation>[];
for (int i = 0; i < frames[0].paths.length; i += 1) {
paths.add(new PathAnimation.fromFrameData(frames, i));
}
return new Animation(size, paths);
}
/// The size of the animation (width, height) in pixels.
final Point<double> size;
/// List of paths in the animation.
final List<PathAnimation> paths;
static void _validateFramesData(List<FrameData> frames) {
final Point<double> size = frames[0].size;
final int numPaths = frames[0].paths.length;
for (int i = 0; i < frames.length; i += 1) {
final FrameData frame = frames[i];
if (size != frame.size)
throw new Exception(
'All animation frames must have the same size,\n'
'first frame size was: (${size.x}, ${size.y})\n'
'frame $i size was: (${frame.size.x}, ${frame.size.y})'
);
if (numPaths != frame.paths.length)
throw new Exception(
'All animation frames must have the same number of paths,\n'
'first frame has $numPaths paths\n'
'frame $i has ${frame.paths.length} paths'
);
}
}
String toDart(String className, String varName) {
final StringBuffer sb = new StringBuffer();
sb.write('const $className $varName = const $className(\n');
sb.write('${kIndent}const Size(${size.x}, ${size.y}),\n');
sb.write('${kIndent}const <_PathFrames>[\n');
for (PathAnimation path in paths)
sb.write(path.toDart());
sb.write('$kIndent],\n');
sb.write(');');
return sb.toString();
}
}
/// Represents the animation of a single path.
class PathAnimation {
const PathAnimation(this.commands, {@required this.opacities});
factory PathAnimation.fromFrameData(List<FrameData> frames, int pathIdx) {
if (frames.isEmpty)
return const PathAnimation(const <PathCommandAnimation>[], opacities: const <double>[]);
final List<PathCommandAnimation> commands = <PathCommandAnimation>[];
for (int commandIdx = 0; commandIdx < frames[0].paths[pathIdx].commands.length; commandIdx += 1) {
final int numPointsInCommand = frames[0].paths[pathIdx].commands[commandIdx].points.length;
final List<List<Point<double>>> points = new List<List<Point<double>>>(numPointsInCommand);
for (int j = 0; j < numPointsInCommand; j += 1)
points[j] = <Point<double>>[];
final String commandType = frames[0].paths[pathIdx].commands[commandIdx].type;
for (int i = 0; i < frames.length; i += 1) {
final FrameData frame = frames[i];
final String currentCommandType = frame.paths[pathIdx].commands[commandIdx].type;
if (commandType != currentCommandType)
throw new Exception(
'Paths must be built from the same commands in all frames'
'command $commandIdx at frame 0 was of type \'$commandType\''
'command $commandIdx at frame $i was of type \'$currentCommandType\''
);
for (int j = 0; j < numPointsInCommand; j += 1)
points[j].add(frame.paths[pathIdx].commands[commandIdx].points[j]);
}
commands.add(new PathCommandAnimation(commandType, points));
}
final List<double> opacities =
frames.map<double>((FrameData d) => d.paths[pathIdx].opacity).toList();
return new PathAnimation(commands, opacities: opacities);
}
/// List of commands for drawing the path.
final List<PathCommandAnimation> commands;
/// The path opacity for each animation frame.
final List<double> opacities;
@override
String toString() {
return 'PathAnimation(commands: $commands, opacities: $opacities)';
}
String toDart() {
final StringBuffer sb = new StringBuffer();
sb.write('${kIndent * 2}const _PathFrames(\n');
sb.write('${kIndent * 3}opacities: const <double>[\n');
for (double opacity in opacities)
sb.write('${kIndent * 4}$opacity,\n');
sb.write('${kIndent * 3}],\n');
sb.write('${kIndent * 3}commands: const <_PathCommand>[\n');
for (PathCommandAnimation command in commands)
sb.write(command.toDart());
sb.write('${kIndent * 3}],\n');
sb.write('${kIndent * 2}),\n');
return sb.toString();
}
}
/// Represents the animation of a single path command.
class PathCommandAnimation {
const PathCommandAnimation(this.type, this.points);
/// The command type.
final String type;
/// A matrix with the command's points in different frames.
///
/// points[i][j] is the i-th point of the command at frame j.
final List<List<Point<double>>> points;
@override
String toString() {
return 'PathCommandAnimation(type: $type, points: $points)';
}
String toDart() {
String dartCommandClass;
switch (type) {
case 'M':
dartCommandClass = '_PathMoveTo';
break;
case 'C':
dartCommandClass = '_PathCubicTo';
break;
case 'L':
dartCommandClass = '_PathLineTo';
break;
case 'Z':
dartCommandClass = '_PathClose';
break;
default:
throw new Exception('unsupported path command: $type');
}
final StringBuffer sb = new StringBuffer();
sb.write('${kIndent * 4}const $dartCommandClass(\n');
for (List<Point<double>> pointFrames in points) {
sb.write('${kIndent * 5}const <Offset>[\n');
for (Point<double> point in pointFrames)
sb.write('${kIndent * 6}const Offset(${point.x}, ${point.y}),\n');
sb.write('${kIndent * 5}],\n');
}
sb.write('${kIndent * 4}),\n');
return sb.toString();
}
}
/// Interprets some subset of an SVG file.
///
/// Recursively goes over the SVG tree, applying transforms and opacities,
/// and build a FrameData which is a flat representation of the paths in the SVG
/// file, after applying transformations and converting relative coordinates to
/// absolute.
///
/// This does not support the SVG specification, but is just built to
/// support SVG files exported by a specific tool the motion design team is
/// using.
FrameData interpretSvg(String svgFilePath) {
final File file = new File(svgFilePath);
final String fileData = file.readAsStringSync();
final XmlElement svgElement = _extractSvgElement(xml.parse(fileData));
final double width = parsePixels(_extractAttr(svgElement, 'width')).toDouble();
final double height = parsePixels(_extractAttr(svgElement, 'height')).toDouble();
final List<SvgPath> paths =
_interpretSvgGroup(svgElement.children, new _Transform());
return new FrameData(new Point<double>(width, height), paths);
}
List<SvgPath> _interpretSvgGroup(List<XmlNode> children, _Transform transform) {
final List<SvgPath> paths = <SvgPath>[];
for (XmlNode node in children) {
if (node.nodeType != XmlNodeType.ELEMENT)
continue;
final XmlElement element = node;
if (element.name.local == 'path') {
paths.add(SvgPath.fromElement(element).applyTransform(transform));
}
if (element.name.local == 'g') {
double opacity = transform.opacity;
if (_hasAttr(element, 'opacity'))
opacity *= double.parse(_extractAttr(element, 'opacity'));
Matrix3 transformMatrix = transform.transformMatrix;
if (_hasAttr(element, 'transform'))
transformMatrix = transformMatrix.multiplied(
_parseSvgTransform(_extractAttr(element, 'transform')));
final _Transform subtreeTransform = new _Transform(
transformMatrix: transformMatrix,
opacity: opacity
);
paths.addAll(_interpretSvgGroup(element.children, subtreeTransform));
}
}
return paths;
}
// Given a points list in the form e.g: "25.0, 1.0 12.0, 12.0 23.0, 9.0" matches
// the coordinated of the first point and the rest of the string, for the
// example above:
// group 1 will match "25.0"
// group 2 will match "1.0"
// group 3 will match "12.0, 12.0 23.0, 9.0"
//
// Commas are optional.
final RegExp _pointMatcher = new RegExp(r'^ *([\-\.0-9]+) *,? *([\-\.0-9]+)(.*)');
/// Parse a string with a list of points, e.g:
/// '25.0, 1.0 12.0, 12.0 23.0, 9.0' will be parsed to:
/// [Point(25.0, 1.0), Point(12.0, 12.0), Point(23.0, 9.0)].
///
/// Commas are optional.
List<Point<double>> parsePoints(String points) {
String unParsed = points;
final List<Point<double>> result = <Point<double>>[];
while (unParsed.isNotEmpty && _pointMatcher.hasMatch(unParsed)) {
final Match m = _pointMatcher.firstMatch(unParsed);
result.add(new Point<double>(
double.parse(m.group(1)),
double.parse(m.group(2))
));
unParsed = m.group(3);
}
return result;
}
/// Data for a single animation frame.
class FrameData {
const FrameData(this.size, this.paths);
final Point<double> size;
final List<SvgPath> paths;
@override
bool operator ==(Object other){
if (runtimeType != other.runtimeType)
return false;
final FrameData typedOther = other;
return size == typedOther.size
&& const ListEquality<SvgPath>().equals(paths, typedOther.paths);
}
@override
int get hashCode => size.hashCode ^ paths.hashCode;
@override
String toString() {
return 'FrameData(size: $size, paths: $paths)';
}
}
/// Represents an SVG path element.
class SvgPath {
const SvgPath(this.id, this.commands, {this.opacity = 1.0});
final String id;
final List<SvgPathCommand> commands;
final double opacity;
static final String _pathCommandAtom = ' *([a-zA-Z]) *([\-\.0-9 ,]*)';
static final RegExp _pathCommandValidator = new RegExp('^($_pathCommandAtom)*\$');
static final RegExp _pathCommandMatcher = new RegExp(_pathCommandAtom);
static SvgPath fromElement(XmlElement pathElement) {
assert(pathElement.name.local == 'path');
final String id = _extractAttr(pathElement, 'id');
final String dAttr = _extractAttr(pathElement, 'd');
final List<SvgPathCommand> commands = <SvgPathCommand>[];
final SvgPathCommandBuilder commandsBuilder = new SvgPathCommandBuilder();
if (!_pathCommandValidator.hasMatch(dAttr))
throw new Exception('illegal or unsupported path d expression: $dAttr');
for (Match match in _pathCommandMatcher.allMatches(dAttr)) {
final String commandType = match.group(1);
final String pointStr = match.group(2);
commands.add(commandsBuilder.build(commandType, parsePoints(pointStr)));
}
return new SvgPath(id, commands);
}
SvgPath applyTransform(_Transform transform) {
final List<SvgPathCommand> transformedCommands =
commands.map((SvgPathCommand c) => c.applyTransform(transform)).toList();
return new SvgPath(id, transformedCommands, opacity: opacity * transform.opacity);
}
@override
bool operator ==(Object other) {
if (runtimeType != other.runtimeType)
return false;
final SvgPath typedOther = other;
return id == typedOther.id
&& opacity == typedOther.opacity
&& const ListEquality<SvgPathCommand>().equals(commands, typedOther.commands);
}
@override
int get hashCode => id.hashCode ^ commands.hashCode ^ opacity.hashCode;
@override
String toString() {
return 'SvgPath(id: $id, opacity: $opacity, commands: $commands)';
}
}
/// Represents a single SVG path command from an SVG d element.
///
/// This class normalizes all the 'd' commands into a single type, that has
/// a command type and a list of points.
///
/// Some examples of how d commands translated to SvgPathCommand:
/// * "M 0.0, 1.0" => SvgPathCommand('M', [Point(0.0, 1.0)])
/// * "Z" => SvgPathCommand('Z', [])
/// * "C 1.0, 1.0 2.0, 2.0 3.0, 3.0" SvgPathCommand('C', [Point(1.0, 1.0),
/// Point(2.0, 2.0), Point(3.0, 3.0)])
class SvgPathCommand {
const SvgPathCommand(this.type, this.points);
/// The command type.
final String type;
/// List of points used by this command.
final List<Point<double>> points;
SvgPathCommand applyTransform(_Transform transform) {
final List<Point<double>> transformedPoints =
_vector3ArrayToPoints(
transform.transformMatrix.applyToVector3Array(
_pointsToVector3Array(points)
)
);
return new SvgPathCommand(type, transformedPoints);
}
@override
bool operator ==(Object other) {
if (runtimeType != other.runtimeType)
return false;
final SvgPathCommand typedOther = other;
return type == typedOther.type
&& const ListEquality<Point<double>>().equals(points, typedOther.points);
}
@override
int get hashCode => type.hashCode ^ points.hashCode;
@override
String toString() {
return 'SvgPathCommand(type: $type, points: $points)';
}
}
class SvgPathCommandBuilder {
static const Map<String, Null> kRelativeCommands = const <String, Null> {
'c': null,
'l': null,
'm': null,
't': null,
's': null,
};
Point<double> lastPoint = const Point<double>(0.0, 0.0);
Point<double> subPathStartPoint = const Point<double>(0.0, 0.0);
SvgPathCommand build(String type, List<Point<double>> points) {
List<Point<double>> absPoints = points;
if (_isRelativeCommand(type)) {
absPoints = points.map((Point<double> p) => p + lastPoint).toList();
}
if (type == 'M' || type == 'm')
subPathStartPoint = absPoints.last;
if (type == 'Z' || type == 'z')
lastPoint = subPathStartPoint;
else
lastPoint = absPoints.last;
return new SvgPathCommand(type.toUpperCase(), absPoints);
}
static bool _isRelativeCommand(String type) {
return kRelativeCommands.containsKey(type);
}
}
List<double> _pointsToVector3Array(List<Point<double>> points) {
final List<double> result = new List<double>(points.length * 3);
for (int i = 0; i < points.length; i += 1) {
result[i * 3] = points[i].x;
result[i * 3 + 1] = points[i].y;
result[i * 3 + 2] = 1.0;
}
return result;
}
List<Point<double>> _vector3ArrayToPoints(List<double> vector) {
final int numPoints = (vector.length / 3).floor();
final List<Point<double>> points = new List<Point<double>>(numPoints);
for (int i = 0; i < numPoints; i += 1) {
points[i] = new Point<double>(vector[i*3], vector[i*3 + 1]);
}
return points;
}
/// Represents a transformation to apply on an SVG subtree.
///
/// This includes more transforms than the ones described by the SVG transform
/// attribute, e.g opacity.
class _Transform {
/// Constructs a new _Transform, default arguments create a no-op transform.
_Transform({Matrix3 transformMatrix, this.opacity = 1.0}) :
this.transformMatrix = transformMatrix ?? new Matrix3.identity();
final Matrix3 transformMatrix;
final double opacity;
_Transform applyTransform(_Transform transform) {
return new _Transform(
transformMatrix: transform.transformMatrix.multiplied(transformMatrix),
opacity: transform.opacity * opacity,
);
}
}
final String _transformCommandAtom = ' *([^(]+)\\(([^)]*)\\)';
final RegExp _transformValidator = new RegExp('^($_transformCommandAtom)*\$');
final RegExp _transformCommand = new RegExp(_transformCommandAtom);
Matrix3 _parseSvgTransform(String transform){
if (!_transformValidator.hasMatch(transform))
throw new Exception('illegal or unsupported transform: $transform');
final Iterable<Match> matches =_transformCommand.allMatches(transform).toList().reversed;
Matrix3 result = new Matrix3.identity();
for (Match m in matches) {
final String command = m.group(1);
final String params = m.group(2);
if (command == 'translate') {
result = _parseSvgTranslate(params).multiplied(result);
continue;
}
if (command == 'scale') {
result = _parseSvgScale(params).multiplied(result);
continue;
}
if (command == 'rotate') {
result = _parseSvgRotate(params).multiplied(result);
continue;
}
throw new Exception('unimplemented transform: $command');
}
return result;
}
final RegExp _valueSeparator = new RegExp('( *, *| +)');
Matrix3 _parseSvgTranslate(String paramsStr) {
final List<String> params = paramsStr.split(_valueSeparator);
assert(params.isNotEmpty);
assert(params.length <= 2);
final double x = double.parse(params[0]);
final double y = params.length < 2 ? 0 : double.parse(params[1]);
return _matrix(1.0, 0.0, 0.0, 1.0, x, y);
}
Matrix3 _parseSvgScale(String paramsStr) {
final List<String> params = paramsStr.split(_valueSeparator);
assert(params.isNotEmpty);
assert(params.length <= 2);
final double x = double.parse(params[0]);
final double y = params.length < 2 ? 0 : double.parse(params[1]);
return _matrix(x, 0.0, 0.0, y, 0.0, 0.0);
}
Matrix3 _parseSvgRotate(String paramsStr) {
final List<String> params = paramsStr.split(_valueSeparator);
assert(params.length == 1);
final double a = radians(double.parse(params[0]));
return _matrix(cos(a), sin(a), -sin(a), cos(a), 0.0, 0.0);
}
Matrix3 _matrix(double a, double b, double c, double d, double e, double f) {
return new Matrix3(a, b, 0.0, c, d, 0.0, e, f, 1.0);
}
// Matches a pixels expression e.g "14px".
// First group is just the number.
final RegExp _pixelsExp = new RegExp('^([0-9]+)px\$');
/// Parses a pixel expression, e.g "14px", and returns the number.
/// Throws an [ArgumentError] if the given string doesn't match the pattern.
int parsePixels(String pixels) {
if (!_pixelsExp.hasMatch(pixels))
throw new ArgumentError(
'illegal pixels expression: \'$pixels\''
' (the tool currently only support pixel units).');
return int.parse(_pixelsExp.firstMatch(pixels).group(1));
}
String _extractAttr(XmlElement element, String name) {
try {
return element.attributes.singleWhere((XmlAttribute x) => x.name.local == name)
.value;
} catch (e) {
throw new ArgumentError(
'Can\'t find a single \'$name\' attributes in ${element.name}, '
'attributes were: ${element.attributes}'
);
}
}
bool _hasAttr(XmlElement element, String name) {
return element.attributes.where((XmlAttribute a) => a.name.local == name).isNotEmpty;
}
XmlElement _extractSvgElement(XmlDocument document) {
return document.children.singleWhere(
(XmlNode node) => node.nodeType == XmlNodeType.ELEMENT &&
_asElement(node).name.local == 'svg'
);
}
XmlElement _asElement(XmlNode node) => node;

View File

@@ -0,0 +1,54 @@
name: vitool
description: A tool for generating Dart vector animation code from SVG sequences.
version: 0.0.1
homepage: https://flutter.io
author: Flutter Authors <flutter-dev@googlegroups.com>
environment:
sdk: '>=1.20.1 <2.0.0'
dependencies:
args: 0.13.7
vector_math: 2.0.5
xml: 2.6.0
dev_dependencies:
test: 0.12.26
async: 1.13.3 # TRANSITIVE DEPENDENCY
barback: 0.15.2+13 # TRANSITIVE DEPENDENCY
boolean_selector: 1.0.2 # TRANSITIVE DEPENDENCY
charcode: 1.1.1 # TRANSITIVE DEPENDENCY
collection: 1.14.3 # TRANSITIVE DEPENDENCY
convert: 2.0.1 # TRANSITIVE DEPENDENCY
crypto: 2.0.2+1 # TRANSITIVE DEPENDENCY
glob: 1.1.5 # TRANSITIVE DEPENDENCY
http: 0.11.3+14 # TRANSITIVE DEPENDENCY
http_multi_server: 2.0.4 # TRANSITIVE DEPENDENCY
http_parser: 3.1.1 # TRANSITIVE DEPENDENCY
io: 0.3.1 # TRANSITIVE DEPENDENCY
js: 0.6.1 # TRANSITIVE DEPENDENCY
matcher: 0.12.1+4 # TRANSITIVE DEPENDENCY
meta: 1.1.1 # TRANSITIVE DEPENDENCY
mime: 0.9.5 # TRANSITIVE DEPENDENCY
node_preamble: 1.4.0 # TRANSITIVE DEPENDENCY
package_config: 1.0.3 # TRANSITIVE DEPENDENCY
package_resolver: 1.0.2 # TRANSITIVE DEPENDENCY
path: 1.5.1 # TRANSITIVE DEPENDENCY
petitparser: 1.6.1 # TRANSITIVE DEPENDENCY
pool: 1.3.3 # TRANSITIVE DEPENDENCY
pub_semver: 1.3.2 # TRANSITIVE DEPENDENCY
shelf: 0.7.1 # TRANSITIVE DEPENDENCY
shelf_packages_handler: 1.0.3 # TRANSITIVE DEPENDENCY
shelf_static: 0.2.6 # TRANSITIVE DEPENDENCY
shelf_web_socket: 0.2.2 # TRANSITIVE DEPENDENCY
source_map_stack_trace: 1.1.4 # TRANSITIVE DEPENDENCY
source_maps: 0.10.4 # TRANSITIVE DEPENDENCY
source_span: 1.4.0 # TRANSITIVE DEPENDENCY
stack_trace: 1.9.1 # TRANSITIVE DEPENDENCY
stream_channel: 1.6.2 # TRANSITIVE DEPENDENCY
string_scanner: 1.0.2 # TRANSITIVE DEPENDENCY
term_glyph: 1.0.0 # TRANSITIVE DEPENDENCY
typed_data: 1.1.4 # TRANSITIVE DEPENDENCY
web_socket_channel: 1.0.6 # TRANSITIVE DEPENDENCY
yaml: 2.1.13 # TRANSITIVE DEPENDENCY

View File

@@ -0,0 +1,698 @@
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'dart:math';
import 'package:collection/collection.dart';
import 'package:vitool/vitool.dart';
import 'package:test/test.dart';
import 'package:path/path.dart' as path;
const String kPackagePath = '..';
void main() {
test('parsePixels', () {
expect(parsePixels('23px'), 23);
expect(parsePixels('9px'), 9);
expect(() { parsePixels('9pt'); }, throwsA(const isInstanceOf<ArgumentError>()));
});
test('parsePoints', () {
expect(parsePoints('1.0, 2.0'),
const <Point<double>>[const Point<double>(1.0, 2.0)]
);
expect(parsePoints('12.0, 34.0 5.0, 6.6'),
const <Point<double>>[
const Point<double>(12.0, 34.0),
const Point<double>(5.0, 6.6),
]
);
expect(parsePoints('12.0 34.0 5.0 6.6'),
const <Point<double>>[
const Point<double>(12.0, 34.0),
const Point<double>(5.0, 6.6),
]
);
});
group('parseSvg', () {
test('empty SVGs', () {
interpretSvg(testAsset('empty_svg_1_48x48.svg'));
interpretSvg(testAsset('empty_svg_2_100x50.svg'));
});
test('illegal SVGs', () {
expect(
() { interpretSvg(testAsset('illegal_svg_multiple_roots.svg')); },
throwsA(anything)
);
});
test('SVG size', () {
expect(
interpretSvg(testAsset('empty_svg_1_48x48.svg')).size,
const Point<double>(48.0, 48.0)
);
expect(
interpretSvg(testAsset('empty_svg_2_100x50.svg')).size,
const Point<double>(100.0, 50.0)
);
});
test('horizontal bar', () {
final FrameData frameData = interpretSvg(testAsset('horizontal_bar.svg'));
expect(frameData.paths, <SvgPath>[
const SvgPath('path_1', const<SvgPathCommand>[
const SvgPathCommand('M', const <Point<double>>[const Point<double>(0.0, 19.0)]),
const SvgPathCommand('L', const <Point<double>>[const Point<double>(48.0, 19.0)]),
const SvgPathCommand('L', const <Point<double>>[const Point<double>(48.0, 29.0)]),
const SvgPathCommand('L', const <Point<double>>[const Point<double>(0.0, 29.0)]),
const SvgPathCommand('Z', const <Point<double>>[]),
]),
]);
});
test('leading space path command', () {
interpretSvg(testAsset('leading_space_path_command.svg'));
});
test('SVG illegal path', () {
expect(
() { interpretSvg(testAsset('illegal_path.svg')); },
throwsA(anything)
);
});
test('SVG group', () {
final FrameData frameData = interpretSvg(testAsset('bars_group.svg'));
expect(frameData.paths, const <SvgPath>[
const SvgPath('path_1', const<SvgPathCommand>[
const SvgPathCommand('M', const <Point<double>>[const Point<double>(0.0, 19.0)]),
const SvgPathCommand('L', const <Point<double>>[const Point<double>(48.0, 19.0)]),
const SvgPathCommand('L', const <Point<double>>[const Point<double>(48.0, 29.0)]),
const SvgPathCommand('L', const <Point<double>>[const Point<double>(0.0, 29.0)]),
const SvgPathCommand('Z', const <Point<double>>[]),
]),
const SvgPath('path_2', const<SvgPathCommand>[
const SvgPathCommand('M', const <Point<double>>[const Point<double>(0.0, 34.0)]),
const SvgPathCommand('L', const <Point<double>>[const Point<double>(48.0, 34.0)]),
const SvgPathCommand('L', const <Point<double>>[const Point<double>(48.0, 44.0)]),
const SvgPathCommand('L', const <Point<double>>[const Point<double>(0.0, 44.0)]),
const SvgPathCommand('Z', const <Point<double>>[]),
]),
]);
});
test('SVG group translate', () {
final FrameData frameData = interpretSvg(testAsset('bar_group_translate.svg'));
expect(frameData.paths, const <SvgPath>[
const SvgPath('path_1', const<SvgPathCommand>[
const SvgPathCommand('M', const <Point<double>>[const Point<double>(0.0, 34.0)]),
const SvgPathCommand('L', const <Point<double>>[const Point<double>(48.0, 34.0)]),
const SvgPathCommand('L', const <Point<double>>[const Point<double>(48.0, 44.0)]),
const SvgPathCommand('L', const <Point<double>>[const Point<double>(0.0, 44.0)]),
const SvgPathCommand('Z', const <Point<double>>[]),
]),
]);
});
test('SVG group scale', () {
final FrameData frameData = interpretSvg(testAsset('bar_group_scale.svg'));
expect(frameData.paths, const <SvgPath>[
const SvgPath(
'path_1', const<SvgPathCommand>[
const SvgPathCommand('M', const <Point<double>>[const Point<double>(0.0, 9.5)]),
const SvgPathCommand('L', const <Point<double>>[const Point<double>(24.0, 9.5)]),
const SvgPathCommand('L', const <Point<double>>[const Point<double>(24.0, 14.5)]),
const SvgPathCommand('L', const <Point<double>>[const Point<double>(0.0, 14.5)]),
const SvgPathCommand('Z', const <Point<double>>[]),
]),
]);
});
test('SVG group rotate scale', () {
final FrameData frameData = interpretSvg(testAsset('bar_group_rotate_scale.svg'));
expect(frameData.paths, const <PathMatcher>[
const PathMatcher(
const SvgPath(
'path_1', const<SvgPathCommand>[
const SvgPathCommand('L', const <Point<double>>[const Point<double>(29.0, 0.0)]),
const SvgPathCommand('L', const <Point<double>>[const Point<double>(29.0, 48.0)]),
const SvgPathCommand('L', const <Point<double>>[const Point<double>(19.0, 48.0)]),
const SvgPathCommand('M', const <Point<double>>[const Point<double>(19.0, 0.0)]),
const SvgPathCommand('Z', const <Point<double>>[]),
]),
margin: 0.000000001
)
]);
});
test('SVG illegal transform', () {
expect(
() { interpretSvg(testAsset('illegal_transform.svg')); },
throwsA(anything)
);
});
test('SVG group opacity', () {
final FrameData frameData = interpretSvg(testAsset('bar_group_opacity.svg'));
expect(frameData.paths, const <SvgPath>[
const SvgPath(
'path_1',
const<SvgPathCommand>[
const SvgPathCommand('M', const <Point<double>>[const Point<double>(0.0, 19.0)]),
const SvgPathCommand('L', const <Point<double>>[const Point<double>(48.0, 19.0)]),
const SvgPathCommand('L', const <Point<double>>[const Point<double>(48.0, 29.0)]),
const SvgPathCommand('L', const <Point<double>>[const Point<double>(0.0, 29.0)]),
const SvgPathCommand('Z', const <Point<double>>[]),
],
opacity: 0.5,
),
]);
});
test('horizontal bar relative', () {
// This asset uses the relative 'l' command instead of 'L'.
final FrameData frameData = interpretSvg(testAsset('horizontal_bar_relative.svg'));
expect(frameData.paths, const <SvgPath>[
const SvgPath(
'path_1', const<SvgPathCommand>[
const SvgPathCommand('M', const <Point<double>>[const Point<double>(0.0, 19.0)]),
const SvgPathCommand('L', const <Point<double>>[const Point<double>(48.0, 19.0)]),
const SvgPathCommand('L', const <Point<double>>[const Point<double>(48.0, 29.0)]),
const SvgPathCommand('L', const <Point<double>>[const Point<double>(0.0, 29.0)]),
const SvgPathCommand('Z', const <Point<double>>[]),
]),
]);
});
test('close in middle of path', () {
// This asset uses the relative 'l' command instead of 'L'.
final FrameData frameData = interpretSvg(testAsset('close_path_in_middle.svg'));
expect(frameData.paths, const <SvgPath>[
const SvgPath(
'path_1', const<SvgPathCommand>[
const SvgPathCommand('M', const <Point<double>>[const Point<double>(50.0, 50.0)]),
const SvgPathCommand('L', const <Point<double>>[const Point<double>(60.0, 50.0)]),
const SvgPathCommand('L', const <Point<double>>[const Point<double>(60.0, 60.0)]),
const SvgPathCommand('Z', const <Point<double>>[]),
const SvgPathCommand('L', const <Point<double>>[const Point<double>(50.0, 40.0)]),
const SvgPathCommand('L', const <Point<double>>[const Point<double>(40.0, 40.0)]),
const SvgPathCommand('Z', const <Point<double>>[]),
]),
]);
});
});
group('create PathAnimation', () {
test('single path', () {
final List<FrameData> frameData = const <FrameData>[
const FrameData(
const Point<double>(10.0, 10.0),
const <SvgPath>[
const SvgPath(
'path_1',
const <SvgPathCommand>[
const SvgPathCommand('M', const <Point<double>>[const Point<double>(0.0, 0.0)]),
const SvgPathCommand('L', const <Point<double>>[const Point<double>(10.0, 10.0)]),
],
),
],
),
];
expect(new PathAnimation.fromFrameData(frameData, 0),
const PathAnimationMatcher(const PathAnimation(
const <PathCommandAnimation>[
const PathCommandAnimation('M', const <List<Point<double>>>[
const <Point<double>>[const Point<double>(0.0, 0.0)],
]),
const PathCommandAnimation('L', const <List<Point<double>>>[
const <Point<double>>[const Point<double>(10.0, 10.0)],
]),
],
opacities: const <double>[1.0]
))
);
});
test('multiple paths', () {
final List<FrameData> frameData = const <FrameData>[
const FrameData(
const Point<double>(10.0, 10.0),
const <SvgPath>[
const SvgPath(
'path_1',
const <SvgPathCommand>[
const SvgPathCommand('M', const <Point<double>>[const Point<double>(0.0, 0.0)]),
],
),
const SvgPath(
'path_2',
const <SvgPathCommand>[
const SvgPathCommand('M', const <Point<double>>[const Point<double>(5.0, 6.0)]),
],
),
],
),
];
expect(new PathAnimation.fromFrameData(frameData, 0),
const PathAnimationMatcher(const PathAnimation(
const <PathCommandAnimation>[
const PathCommandAnimation('M', const <List<Point<double>>>[
const <Point<double>>[const Point<double>(0.0, 0.0)],
])
],
opacities: const <double>[1.0]
))
);
expect(new PathAnimation.fromFrameData(frameData, 1),
const PathAnimationMatcher(const PathAnimation(
const <PathCommandAnimation>[
const PathCommandAnimation('M', const <List<Point<double>>>[
const <Point<double>>[const Point<double>(5.0, 6.0)],
])
],
opacities: const <double>[1.0]
))
);
});
test('multiple frames', () {
final List<FrameData> frameData = const <FrameData>[
const FrameData(
const Point<double>(10.0, 10.0),
const <SvgPath>[
const SvgPath(
'path_1',
const <SvgPathCommand>[
const SvgPathCommand('M', const <Point<double>>[const Point<double>(0.0, 0.0)])
],
opacity: 0.5,
),
],
),
const FrameData(
const Point<double>(10.0, 10.0),
const <SvgPath>[
const SvgPath(
'path_1',
const <SvgPathCommand>[
const SvgPathCommand('M', const <Point<double>>[const Point<double>(10.0, 10.0)])
],
),
],
),
];
expect(new PathAnimation.fromFrameData(frameData, 0),
const PathAnimationMatcher(const PathAnimation(
const <PathCommandAnimation>[
const PathCommandAnimation('M', const <List<Point<double>>>[
const <Point<double>>[
const Point<double>(0.0, 0.0),
const Point<double>(10.0, 10.0),
],
]),
],
opacities: const <double>[0.5, 1.0]
))
);
});
});
group('create Animation', () {
test('multiple paths', () {
final List<FrameData> frameData = const <FrameData>[
const FrameData(
const Point<double>(10.0, 10.0),
const <SvgPath>[
const SvgPath(
'path_1',
const <SvgPathCommand>[
const SvgPathCommand('M', const <Point<double>>[const Point<double>(0.0, 0.0)]),
],
),
const SvgPath(
'path_1',
const <SvgPathCommand>[
const SvgPathCommand('M', const <Point<double>>[const Point<double>(5.0, 6.0)]),
],
),
],
),
];
final Animation animation = new Animation.fromFrameData(frameData);
expect(animation.paths[0],
const PathAnimationMatcher(const PathAnimation(
const <PathCommandAnimation>[
const PathCommandAnimation('M', const <List<Point<double>>>[
const <Point<double>>[const Point<double>(0.0, 0.0)],
])
],
opacities: const <double>[1.0]
))
);
expect(animation.paths[1],
const PathAnimationMatcher(const PathAnimation(
const <PathCommandAnimation>[
const PathCommandAnimation('M', const <List<Point<double>>>[
const <Point<double>>[const Point<double>(5.0, 6.0)],
])
],
opacities: const <double>[1.0]
))
);
expect(animation.size, const Point<double>(10.0, 10.0));
});
});
group('toDart', () {
test('_PathMoveTo', () {
final PathCommandAnimation command = const PathCommandAnimation(
'M',
const <List<Point<double>>>[
const <Point<double>>[
const Point<double>(1.0, 2.0),
const Point<double>(3.0, 4.0),
],
],
);
expect(command.toDart(),
' const _PathMoveTo(\n'
' const <Offset>[\n'
' const Offset(1.0, 2.0),\n'
' const Offset(3.0, 4.0),\n'
' ],\n'
' ),\n'
);
});
test('_PathLineTo', () {
final PathCommandAnimation command = const PathCommandAnimation(
'L',
const <List<Point<double>>>[
const <Point<double>>[
const Point<double>(1.0, 2.0),
const Point<double>(3.0, 4.0),
],
],
);
expect(command.toDart(),
' const _PathLineTo(\n'
' const <Offset>[\n'
' const Offset(1.0, 2.0),\n'
' const Offset(3.0, 4.0),\n'
' ],\n'
' ),\n'
);
});
test('_PathCubicTo', () {
final PathCommandAnimation command = const PathCommandAnimation(
'C',
const <List<Point<double>>>[
const <Point<double>>[
const Point<double>(16.0, 24.0),
const Point<double>(16.0, 10.0),
],
const <Point<double>>[
const Point<double>(16.0, 25.0),
const Point<double>(16.0, 11.0),
],
const <Point<double>>[
const Point<double>(40.0, 40.0),
const Point<double>(40.0, 40.0),
],
],
);
expect(command.toDart(),
' const _PathCubicTo(\n'
' const <Offset>[\n'
' const Offset(16.0, 24.0),\n'
' const Offset(16.0, 10.0),\n'
' ],\n'
' const <Offset>[\n'
' const Offset(16.0, 25.0),\n'
' const Offset(16.0, 11.0),\n'
' ],\n'
' const <Offset>[\n'
' const Offset(40.0, 40.0),\n'
' const Offset(40.0, 40.0),\n'
' ],\n'
' ),\n'
);
});
test('_PathClose', () {
final PathCommandAnimation command = const PathCommandAnimation(
'Z',
const <List<Point<double>>>[],
);
expect(command.toDart(),
' const _PathClose(\n'
' ),\n'
);
});
test('Unsupported path command', () {
final PathCommandAnimation command = const PathCommandAnimation(
'h',
const <List<Point<double>>>[],
);
expect(
() { command.toDart(); },
throwsA(anything)
);
});
test('_PathFrames', () {
final PathAnimation pathAnimation = const PathAnimation(
const <PathCommandAnimation>[
const PathCommandAnimation('M', const <List<Point<double>>>[
const <Point<double>>[
const Point<double>(0.0, 0.0),
const Point<double>(10.0, 10.0),
],
]),
const PathCommandAnimation('L', const <List<Point<double>>>[
const <Point<double>>[
const Point<double>(48.0, 10.0),
const Point<double>(0.0, 0.0),
],
]),
],
opacities: const <double>[0.5, 1.0]
);
expect(pathAnimation.toDart(),
' const _PathFrames(\n'
' opacities: const <double>[\n'
' 0.5,\n'
' 1.0,\n'
' ],\n'
' commands: const <_PathCommand>[\n'
' const _PathMoveTo(\n'
' const <Offset>[\n'
' const Offset(0.0, 0.0),\n'
' const Offset(10.0, 10.0),\n'
' ],\n'
' ),\n'
' const _PathLineTo(\n'
' const <Offset>[\n'
' const Offset(48.0, 10.0),\n'
' const Offset(0.0, 0.0),\n'
' ],\n'
' ),\n'
' ],\n'
' ),\n'
);
});
test('Animation', () {
final Animation animation = const Animation(
const Point<double>(48.0, 48.0),
const <PathAnimation>[
const PathAnimation(
const <PathCommandAnimation>[
const PathCommandAnimation('M', const <List<Point<double>>>[
const <Point<double>>[
const Point<double>(0.0, 0.0),
const Point<double>(10.0, 10.0),
],
]),
const PathCommandAnimation('L', const <List<Point<double>>>[
const <Point<double>>[
const Point<double>(48.0, 10.0),
const Point<double>(0.0, 0.0),
],
]),
],
opacities: const <double>[0.5, 1.0]
),
const PathAnimation(
const <PathCommandAnimation>[
const PathCommandAnimation('M', const <List<Point<double>>>[
const <Point<double>>[
const Point<double>(0.0, 0.0),
const Point<double>(10.0, 10.0),
],
]),
],
opacities: const <double>[0.5, 1.0]
),
]);
expect(animation.toDart('_AnimatedIconData', '_\$data1'),
'const _AnimatedIconData _\$data1 = const _AnimatedIconData(\n'
' const Size(48.0, 48.0),\n'
' const <_PathFrames>[\n'
' const _PathFrames(\n'
' opacities: const <double>[\n'
' 0.5,\n'
' 1.0,\n'
' ],\n'
' commands: const <_PathCommand>[\n'
' const _PathMoveTo(\n'
' const <Offset>[\n'
' const Offset(0.0, 0.0),\n'
' const Offset(10.0, 10.0),\n'
' ],\n'
' ),\n'
' const _PathLineTo(\n'
' const <Offset>[\n'
' const Offset(48.0, 10.0),\n'
' const Offset(0.0, 0.0),\n'
' ],\n'
' ),\n'
' ],\n'
' ),\n'
' const _PathFrames(\n'
' opacities: const <double>[\n'
' 0.5,\n'
' 1.0,\n'
' ],\n'
' commands: const <_PathCommand>[\n'
' const _PathMoveTo(\n'
' const <Offset>[\n'
' const Offset(0.0, 0.0),\n'
' const Offset(10.0, 10.0),\n'
' ],\n'
' ),\n'
' ],\n'
' ),\n'
' ],\n'
');'
);
});
});
}
// Matches all path commands' points within an error margin.
class PathMatcher extends Matcher {
const PathMatcher(this.actual, {this.margin = 0.0});
final SvgPath actual;
final double margin;
@override
Description describe(Description description) => description.add('$actual (±$margin)');
@override
bool matches(dynamic item, Map<dynamic, dynamic> matchState) {
if (item == null || actual == null)
return item == actual;
if (item.runtimeType != actual.runtimeType)
return false;
final SvgPath other = item;
if (other.id != actual.id || other.opacity != actual.opacity)
return false;
if (other.commands.length != actual.commands.length)
return false;
for (int i = 0; i < other.commands.length; i += 1) {
if (!commandsMatch(actual.commands[i], other.commands[i]))
return false;
}
return true;
}
bool commandsMatch(SvgPathCommand actual, SvgPathCommand other) {
if (other.points.length != actual.points.length)
return false;
for (int i = 0; i < other.points.length; i += 1) {
if ((other.points[i].x - actual.points[i].x).abs() > margin)
return false;
if ((other.points[i].y - actual.points[i].y).abs() > margin)
return false;
}
return true;
}
}
class PathAnimationMatcher extends Matcher {
const PathAnimationMatcher(this.expected);
final PathAnimation expected;
@override
Description describe(Description description) => description.add('$expected');
@override
bool matches(dynamic item, Map<dynamic, dynamic> matchState) {
if (item == null || expected == null)
return item == expected;
if (item.runtimeType != expected.runtimeType)
return false;
final PathAnimation other = item;
if (!const ListEquality<double>().equals(other.opacities, expected.opacities))
return false;
if (other.commands.length != expected.commands.length)
return false;
for (int i = 0; i < other.commands.length; i += 1) {
if (!commandsMatch(expected.commands[i], other.commands[i]))
return false;
}
return true;
}
bool commandsMatch(PathCommandAnimation expected, PathCommandAnimation other) {
if (other.points.length != expected.points.length)
return false;
for (int i = 0; i < other.points.length; i += 1)
if (!const ListEquality<Point<double>>().equals(other.points[i], expected.points[i]))
return false;
return true;
}
}
String testAsset(String name) {
return path.join(kPackagePath, 'test_assets', name);
}

View File

@@ -0,0 +1,5 @@
<svg id="svg_build_00" xmlns="http://www.w3.org/2000/svg" width="48px" height="48px" >
<g if="group_2" opacity="0.5" >
<path id="path_1" d="M 0,19.0 L 48.0, 19.0 L 48.0, 29.0 L 0, 29.0 Z " fill="#000000" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 227 B

View File

@@ -0,0 +1,5 @@
<svg id="svg_build_00" xmlns="http://www.w3.org/2000/svg" width="48px" height="48px" >
<g if="group_2" transform="translate(48.0, 0) rotate(90.0)">
<path id="path_1" d="M 0,19.0 L 48.0, 19.0 L 48.0, 29.0 L 0, 29.0 Z " fill="#000000" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 256 B

View File

@@ -0,0 +1,5 @@
<svg id="svg_build_00" xmlns="http://www.w3.org/2000/svg" width="48px" height="48px" >
<g if="group_2" transform="scale(0.5,0.5)">
<path id="path_1" d="M 0,19.0 L 48.0, 19.0 L 48.0, 29.0 L 0, 29.0 Z " fill="#000000" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 239 B

View File

@@ -0,0 +1,5 @@
<svg id="svg_build_00" xmlns="http://www.w3.org/2000/svg" width="48px" height="48px" >
<g if="group_2" transform="translate(0,15.0)">
<path id="path_1" d="M 0,19.0 L 48.0, 19.0 L 48.0, 29.0 L 0, 29.0 Z " fill="#000000" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 242 B

View File

@@ -0,0 +1,6 @@
<svg id="svg_build_00" xmlns="http://www.w3.org/2000/svg" width="48px" height="48px" >
<g if="group_1">
<path id="path_1" d="M 0,19.0 L 48.0, 19.0 L 48.0, 29.0 L 0, 29.0 Z " fill="#000000" />
<path id="path_2" d="M 0,34.0 L 48.0, 34.0 L 48.0, 44.0 L 0, 44.0 Z " fill="#000000" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 304 B

View File

@@ -0,0 +1,3 @@
<svg id="svg_build_00" xmlns="http://www.w3.org/2000/svg" width="100px" height="100px" >
<path id="path_1" d="M 50.0 50.0 l 10.0 0 l 0.0 10.0 z l 0.0 -10.0 l -10.0 0.0 z " fill="#000000" />
</svg>

After

Width:  |  Height:  |  Size: 197 B

View File

@@ -0,0 +1,2 @@
<svg id="svg_build_00" xmlns="http://www.w3.org/2000/svg" width="48px" height="48px" >
</svg>

After

Width:  |  Height:  |  Size: 94 B

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Empty SVG file -->
<svg
xmlns="http://www.w3.org/2000/svg"
id="empty_svg"
width="100px"
height="50px">
</svg>

After

Width:  |  Height:  |  Size: 182 B

View File

@@ -0,0 +1,3 @@
<svg id="svg_build_00" xmlns="http://www.w3.org/2000/svg" width="48px" height="48px" >
<path id="path_1" d="M 0,19.0 L 48.0, 19.0 L 48.0, 29.0 L 0, 29.0 Z " fill="#000000" />
</svg>

After

Width:  |  Height:  |  Size: 182 B

View File

@@ -0,0 +1,3 @@
<svg id="svg_build_00" xmlns="http://www.w3.org/2000/svg" width="48px" height="48px" >
<path id="path_1" d="M 0,19.0 l 48.0, 0.0 l 0.0, 10.0 l -48.0, 0.0 Z " fill="#000000" />
</svg>

After

Width:  |  Height:  |  Size: 183 B

View File

@@ -0,0 +1,3 @@
<svg id="svg_build_00" xmlns="http://www.w3.org/2000/svg" width="48px" height="48px" >
<path id="path_1" d="M 1.0 !!!" fill="#000000" />
</svg>

After

Width:  |  Height:  |  Size: 144 B

View File

@@ -0,0 +1,3 @@
<svg id="svg_build_00" xmlns="http://www.w3.org/2000/svg" width="48px" height="48px" >
</svg>
<svg/>

After

Width:  |  Height:  |  Size: 101 B

View File

@@ -0,0 +1,5 @@
<svg id="svg_build_00" xmlns="http://www.w3.org/2000/svg" width="48px" height="48px" >
<g if="group_2" transform="translate(0,15.0) !!">
<path id="path_1" d="M 0,19.0 L 48.0, 19.0 L 48.0, 29.0 L 0, 29.0 Z " fill="#000000" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 245 B

View File

@@ -0,0 +1,3 @@
<svg id="svg_build_00" xmlns="http://www.w3.org/2000/svg" width="48px" height="48px" >
<path id="path_1" d=" z" fill="#000000" />
</svg>

After

Width:  |  Height:  |  Size: 137 B