2010-03-08 16:18:32 +00:00
|
|
|
#import <AppKit/NSRaise.h>
|
2020-05-11 15:52:05 +00:00
|
|
|
#import <QuartzCore/CIImage.h>
|
2010-03-08 16:18:32 +00:00
|
|
|
|
|
|
|
@implementation CIImage
|
|
|
|
|
2020-05-11 15:52:05 +00:00
|
|
|
+ (CIImage *) emptyImage {
|
|
|
|
return [[self alloc] initWithCGImage: NULL];
|
2010-03-08 16:18:32 +00:00
|
|
|
}
|
|
|
|
|
2020-05-11 15:52:05 +00:00
|
|
|
- initWithCGImage: (CGImageRef) cgImage {
|
|
|
|
_cgImage = CGImageRetain(cgImage);
|
|
|
|
_filter = nil;
|
|
|
|
return self;
|
2010-03-08 16:18:32 +00:00
|
|
|
}
|
|
|
|
|
2020-05-11 15:52:05 +00:00
|
|
|
- (void) dealloc {
|
|
|
|
CGImageRelease(_cgImage);
|
|
|
|
[_filter release];
|
|
|
|
[super dealloc];
|
2010-03-08 16:18:32 +00:00
|
|
|
}
|
|
|
|
|
2020-05-11 15:52:05 +00:00
|
|
|
- (CGRect) extent {
|
|
|
|
CGRect result;
|
|
|
|
|
|
|
|
result.origin.x = 0;
|
|
|
|
result.origin.y = 0;
|
|
|
|
result.size.width = CGImageGetWidth(_cgImage);
|
|
|
|
result.size.height = CGImageGetHeight(_cgImage);
|
2010-03-08 16:18:32 +00:00
|
|
|
|
2020-05-11 15:52:05 +00:00
|
|
|
return result;
|
2010-03-08 16:18:32 +00:00
|
|
|
}
|
|
|
|
|
2020-05-11 15:52:05 +00:00
|
|
|
- (CGImageRef) CGImage {
|
|
|
|
return _cgImage;
|
2010-03-08 16:18:32 +00:00
|
|
|
}
|
|
|
|
|
2020-05-11 15:52:05 +00:00
|
|
|
- (CIFilter *) filter {
|
|
|
|
return _filter;
|
2010-03-08 16:18:32 +00:00
|
|
|
}
|
|
|
|
|
2020-05-11 15:52:05 +00:00
|
|
|
- (void) setFilter: (CIFilter *) filter {
|
|
|
|
filter = [filter retain];
|
|
|
|
[_filter release];
|
|
|
|
_filter = filter;
|
2010-03-08 16:18:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@end
|