title: How to draw a rounded NSImage
body: <p>I am trying to create a <code>NSImage</code> or <code>NSImageCell</code> with rounded corners inside a <code>NSTableView</code>.  I can't get anything to work.  Here is the best I have so far inside my custom <code>NSCell</code>:</p>
  
  <pre><code>- (void)drawInteriorWithFrame:(NSRect)frame inView:(NSView *)controlView { 
    if (thumbnailLink) {
      NSURL *url = [NSURL URLWithString:thumbnailLink];
      if (url) {
          NSRect imageFrame = [self _imageFrameForInteriorFrame:frame];
          NSImage *image = [[NSImage alloc] initWithContentsOfURL:url];
          [image setScalesWhenResized:YES];
          [image setSize:NSMakeSize(IMAGE_HEIGHT, IMAGE_WIDTH)];
  
          [NSGraphicsContext saveGraphicsState];
          imageFrame = NSInsetRect(imageFrame, 1, 1);
          NSBezierPath *clipPath = [NSBezierPath bezierPathWithRoundedRect:imageFrame cornerRadius:5.0];
          [clipPath setWindingRule:NSEvenOddWindingRule];
          [clipPath addClip];
          [NSGraphicsContext restoreGraphicsState];   
          [image drawInRect:imageFrame fromRect:NSMakeRect(0, 0, 0, 0) operation:NSCompositeSourceIn fraction:1.0];
          [image release];
      }
  }
  ...
  </code></pre>
  
  <p>Any ideas on how to this?</p>