//
//  ImageView.m
//  Eagle
//
//  Created by Richard Kettering on 10/16/08.
//  Copyright 2008 __MyCompanyName__. All rights reserved.
//

#import "ImageView.h"
#import "ImageFilter.h"


@implementation ImageView

- (id)initWithFrame:(NSRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        // Initialization code here.
		//NSString* imageName = [[NSBundle mainBundle] pathForResource:@"frogatto-native" ofType:@"PNG"];
		//myimage = [[NSImage alloc] initWithContentsOfFile:imageName];
		NSString * file_name = @"test/frogatto-native.png";
		NSString * filePath = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:file_name];
		//NSString * filePath = @"frogatto-native.png";
		NSImage * tempImage = [[NSImage alloc] initWithContentsOfFile:filePath];
		
		ImageFilter *filter = [[ImageFilter alloc] init];
		myimage = [filter filterImage:tempImage];
		//myimage = tempImage;
		
    }
    return self;
}

- (void)drawRect:(NSRect)rect {
    // Drawing code here.
	/*[[NSColor redColor] set];
	NSRectFill ( rect);*/
	
	[myimage drawInRect: rect
			   fromRect: NSZeroRect
			  operation: NSCompositeSourceOver
			   fraction: 1.0];
}

@end
