cefbcffe00c44abde706d0f9f1a980ddc887eb0f
[ITKit.git] / ITImageCell.m
1 #import "ITImageCell.h"
2
3
4 @implementation ITImageCell
5
6
7 - (id)initImageCell:(NSImage *)image
8 {
9     if ( (self = [super initImageCell:image]) ) {
10         _scalesSmoothly = YES;
11     }
12     NSLog(@"foo");
13     return self;
14 }
15
16
17
18 - (void)drawWithFrame:(NSRect)rect inView:(NSView *)controlView
19 {
20     NSImageInterpolation interpolation;
21
22     if ( _scalesSmoothly ) {
23         interpolation = [[NSGraphicsContext currentContext] imageInterpolation];
24         [[NSGraphicsContext currentContext] setImageInterpolation:NSImageInterpolationHigh];
25     }
26     
27     [super drawWithFrame:rect inView:controlView];
28
29     if ( _scalesSmoothly ) {
30         [[NSGraphicsContext currentContext] setImageInterpolation:interpolation];
31     }
32 }
33
34 - (BOOL)scalesSmoothly
35 {
36     return _scalesSmoothly;
37 }
38
39 - (void)setScalesSmoothly:(BOOL)flag
40 {
41     _scalesSmoothly = flag;
42     [[self controlView] setNeedsDisplay:YES];
43 }
44
45
46 @end