Lots more stuff merged in. Added an ITImageView/ITImageCell object to allow smooth...
[ITKit.git] / ITImageCell.m
diff --git a/ITImageCell.m b/ITImageCell.m
new file mode 100755 (executable)
index 0000000..cefbcff
--- /dev/null
@@ -0,0 +1,46 @@
+#import "ITImageCell.h"
+
+
+@implementation ITImageCell
+
+
+- (id)initImageCell:(NSImage *)image
+{
+    if ( (self = [super initImageCell:image]) ) {
+        _scalesSmoothly = YES;
+    }
+    NSLog(@"foo");
+    return self;
+}
+
+
+
+- (void)drawWithFrame:(NSRect)rect inView:(NSView *)controlView
+{
+    NSImageInterpolation interpolation;
+
+    if ( _scalesSmoothly ) {
+        interpolation = [[NSGraphicsContext currentContext] imageInterpolation];
+        [[NSGraphicsContext currentContext] setImageInterpolation:NSImageInterpolationHigh];
+    }
+    
+    [super drawWithFrame:rect inView:controlView];
+
+    if ( _scalesSmoothly ) {
+        [[NSGraphicsContext currentContext] setImageInterpolation:interpolation];
+    }
+}
+
+- (BOOL)scalesSmoothly
+{
+    return _scalesSmoothly;
+}
+
+- (void)setScalesSmoothly:(BOOL)flag
+{
+    _scalesSmoothly = flag;
+    [[self controlView] setNeedsDisplay:YES];
+}
+
+
+@end