Jump to content
rodovich

SVG `transform`s not applied to `clip-path`s correctly

Recommended Posts

Affinity Designer appears not to import the following SVG correctly: the `transform` on the `g` element is not being applied to the `clip-path` on the `path` element.

<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" viewBox="0, 0, 200, 100" width="200" height="100" xmlns="http://www.w3.org/2000/svg">
 <defs>
  <clipPath id="c1">
   <path d="M 50,5 5,50 50,95 95,50 Z"/>
  </clipPath>
 </defs>
 <g transform="translate(50, 0)">
  <path clip-path="url(#c1)" d="M 20,20 20,80 80,80 80,20 Z" fill="blue" stroke="red" stroke-width="5"/>
 </g>
</svg>

I tried to find how W3 spec says these attributes are supposed to interact, without success. However, Safari, Chrome, Firefox, Sketch, and Graphic all applied the transformation to the nested `clip-path`, and I did not find any other applications that matched the behavior of Affinity Designer.

svg-safari.png

svg-affinity.png

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

Please note the Annual Company Closure section in the Terms of Use. These are the Terms of Use you will be asked to agree to if you join the forum. | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.