Merge pull request #10 from gunyarakun/fix-invalid-return
[cocotron.git] / QuartzCore / CIFilter.m
blob74d4bf8819c5d220974559b6e506329ed3c5c39d
1 #import <QuartzCore/CIFilter.h>
2 #import <QuartzCore/CIImage.h>
3 #import <AppKit/NSRaise.h>
4 #import <Foundation/NSDictionary.h>
6 @interface CIImage(private)
7 -(void)setFilter:(CIFilter *)filter;
8 @end
10 @implementation CIFilter
12 -initWithName:(NSString *)name {
13    _keyValues=[NSMutableDictionary new];
14    [_keyValues setObject:name forKey:@"kCIAttributeFilterName"];
15    return self;
18 -(void)dealloc {
19    [_keyValues release];
20    [super dealloc];
23 +(CIFilter *)filterWithName:(NSString *)name {
24    return [[[self alloc] initWithName:name] autorelease];
27 -(void)setDefaults {
28  //  NSUnimplementedMethod();
31 -(void)setValue:value forKey:(NSString *)key {
32    if(value)
33     [_keyValues setObject:value forKey:key];
34    else
35     [_keyValues removeObjectForKey:key];
38 -valueForKey:(NSString *)key {
39    if([key isEqual:@"outputImage"]){
40     CIImage *image=[CIImage emptyImage];
41     
42     [image setFilter:self];
43     return image;
44    }
45    
46    return [_keyValues objectForKey:key];
49 @end