title: How can I draw a "soft" line in WPF (presumably using a LinearGradientBrush)?
body: <p>I'm trying to draw a line with soft edges, regardless of the slope.  </p>
  
  <p>Here's the code I have so far:  </p>
  
  <pre><code>&lt;Line   HorizontalAlignment="Stretch" VerticalAlignment="Center"
          Stretch="Uniform" StrokeThickness="5" X1="0" Y1="0" X2="1" Y2="0"&gt;
      &lt;Shape.Stroke&gt;
          &lt;LinearGradientBrush StartPoint="0,0" EndPoint="0,1"&gt;
              &lt;GradientStop Color="Transparent" Offset="0" /&gt;
              &lt;GradientStop Color="Green" Offset="0.5" /&gt;
              &lt;GradientStop Color="Transparent" Offset="1" /&gt;
          &lt;/LinearGradientBrush&gt;
      &lt;/Shape.Stroke&gt;
  &lt;/Line&gt;
  </code></pre>
  
  <p>This makes sense to me, since the line is horizontal, and the linear gradient is vertical, with the edges being transparent and the middle of the line being solid green.  </p>
  
  <p>The result is pleasing:<br>
  <a href="https://i.stack.imgur.com/d75yZ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/d75yZ.png" alt=""></a>
  <br>
  Zoomed in so you can see the gradient:<br>
  <a href="http://img225.imageshack.us/img225/5027/horizontalsoftlinezoomeb.png" rel="nofollow noreferrer">http://img225.imageshack.us/img225/5027/horizontalsoftlinezoomeb.png</a>  </p>
  
  <p>However, when the line is no longer horizontal, the gradient is calculated based on the line's bounding rectangle, rather than on the geometry of the line itself. The result is a slanted line that is shaded vertically, instead of the gradient being perpendicular to the line:<br>
  <a href="https://i.stack.imgur.com/twWBf.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/twWBf.png" alt=""></a>
    </p>
  
  <p>Does anyone know how WPF handles soft edges? I can't find anything on Google or MSDN, and I know there is a way to do this somewhow...</p>