Note that there are some explanatory texts on larger screens.

plurals
  1. POApplying a scaled SVG pattern to a translated path
    primarykey
    data
    text
    <p>I'm confused as to why a scaled tiled pattern doesn't line up perfectly with the borders of the object it's being applied to in the case of this: <a href="http://jsfiddle.net/J8xeR/" rel="nofollow">http://jsfiddle.net/J8xeR/</a></p> <p>For reference, the pattern is defined as such:</p> <pre><code>&lt;pattern id="tile" x="15" y="15" width="150" height="130" patternUnits="userSpaceOnUse" patternTransform="scale(.4,.4)"&gt; &lt;image fill="#000000" width="150" height="130" preserveAspectRatio="none" xlink:href="http://good-b.com/wp-content/uploads/2011/06/star1.jpg"&gt;&lt;/image&gt; &lt;/pattern&gt; </code></pre> <p>Additionally, the pattern is being applied here: </p> <pre><code>&lt;rect x="15" y="15" width="150" height="130" style="fill: url(#tile);" /&gt; </code></pre> <p>I'm especially confused because the <code>patternUnits</code> attribute of the pattern is set to <code>"userSpaceOnUse"</code> and the <code>x</code> and <code>y</code> of both the <code>pattern</code> and the <code>rect</code> are the same, yet it looks like the pattern is slightly offset. </p> <p>I determined that if you set the <code>x</code> and <code>y</code> of the pattern to <code>37.5 (= 15 / .4)</code> then the borders do line up properly; however, is there a cleaner way to achieve the same thing? This becomes especially problematic if instead of a rectangle, you have an equivalent path that is rotated by some amount. I'm not even sure how I would orient and line up the pattern correctly at that point.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload