+@interface NSImage (WeeAdditions)
+- (NSImage *)imageScaledSmoothlyToSize:(NSSize)scaledSize;
+@end
+
+@implementation NSImage (WeeAdditions)
+
+- (NSImage *)imageScaledSmoothlyToSize:(NSSize)scaledSize
+{
+ NSImage *newImage;
+ NSImageRep *rep = [self bestRepresentationForDevice:nil];
+
+ newImage = [[NSImage alloc] initWithSize:scaledSize];
+ [newImage lockFocus];
+ {
+ [[NSGraphicsContext currentContext] setImageInterpolation:NSImageInterpolationHigh];
+ [[NSGraphicsContext currentContext] setShouldAntialias:YES];
+ [rep drawInRect:NSMakeRect(3, 3, scaledSize.width - 6, scaledSize.height - 6)];
+ }
+ [newImage unlockFocus];
+ return [newImage autorelease];
+}
+
+@end
+