Implement a basic rewrite of redundant commands
This basic implementation can drop and rewrite some cases of "m0 0" and "z" without triggering the issues experienced in #163. It works by analysing the path backwards and tracking "z" and "m" commands. Signed-off-by: Niels Thykier <niels@thykier.net>
This commit is contained in:
parent
a2c94c96fb
commit
38274f75bc
4 changed files with 68 additions and 13 deletions
8
unittests/path-command-rewrites.svg
Normal file
8
unittests/path-command-rewrites.svg
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0"?>
|
||||
<svg xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="m100 100 l200 100 m0 0z" />
|
||||
<path d="m100 100 v200 m0 0 100 100z" />
|
||||
<path d="m100 100 v200 m0 0m0 0 2-1-2 1z" />
|
||||
<path d="m100 100 v200 m0 0 3-5-5 3m0 0 2-1-2 1z" />
|
||||
<path d="m100 100 v200 m0 0 3-5-5 3zm0 0 2-1-2 1z" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 310 B |
|
|
@ -1,5 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<svg xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="m100 100 l200 100 m0 0z" />
|
||||
<path d="m100 100 v200 m0 0 100 100z" />
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 152 B |
Loading…
Add table
Add a link
Reference in a new issue