title: Cocoa draw image with rounded corners and shadow
body: <p>I am trying to draw an image using core graphics such that it has rounded corners and a drop shadow.  Here is a snippet of my code:</p>
  
  <pre><code>CGContextSetShadowWithColor(context, CGSizeMake(0, 1), 2, shadowColor);    
  CGContextAddPath(context, path);
  CGContextClip(context);
  CGContextDrawImage(context, rect, image);
  </code></pre>
  
  <p>The problem I am having is that the clipping to create the rounded corners is also clipping the shadow.  Since the image may be transparent in areas, I cannot simply draw the rounded rectangle with a shadow under the image.  I guess I need to apply the rounded shape to the image first, and then draw the resulting image to the screen and add the shadow.  Does anyone know how to do this?</p>
  
  <p>Thanks!</p>