title: On OSX, how do I gradient fill a path stroke?
body: <p>Using the plethora of drawing functions in Cocoa or Quartz it's rather easy to draw paths, and fill them using a gradient. I can't seem to find an acceptable way however, to 'stroke'-draw a path with a line width of a few pixels and fill this stroke using a gradient. How is this done?</p>
  
  <p>Edit: Apparently the question wasn't clear enough. Thanks for the responses so far, but I already figured that out. What I want to do is this:</p>
  
  <p><a href="https://i.stack.imgur.com/DcepF.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/DcepF.png" alt="squares"></a><br>
  <sub>(source: <a href="http://emle.nl/forumpics/misc/squares.png" rel="nofollow noreferrer">emle.nl</a>)</sub>  </p>
  
  <p>The left square is NSGradient drawn in a path followed by a path stroke message. The right is what I want to do; I want to fill the stroke using the gradient.</p>