fill the void

Posts from January 2010

Cocoa Tip: NSImage Composites

Recently, I wanted to composite together two images, much like Tweetie’s retweet UI for avatars: display the main icon in its original size but overlay a second icon smaller and offset. Turns out to be only a couple lines of code using NSImage: NSImage *mainIcon = [NSImage imageNamed:@"main_icon"]; NSImage *overlayIcon = [NSImage imageNamed:@"overlay_icon"]; [mainIcon lockFocus]; [...]