Most recent edit on 2007-11-12 10:16:09 by GusMueller
Deletions:
trorc4telbas
Edited on 2007-11-11 23:49:30 by RacelTerla
Additions:
trorc4telbas
Edited on 2007-09-13 15:58:17 by GusMueller
Additions:
A version of this, along with the Xcode project is available in SampleAcornPlugins.zip∞
Oldest known version of this page was edited on 2007-09-12 17:54:49 by GusMueller []
Page view:
And here is an example which takes the current bitmap layer and converts it to grayscale using
CoreImage, using Objective-C.
// the header file
#import <Cocoa/Cocoa.h>
#import <QuartzCore/QuartzCore.h>
#import "ACPlugin.h"
@interface ACGrayscalePlugin : NSObject <ACPlugin> {
}
@end
// the implementation
#import "ACGrayscalePlugin.h"
@implementation ACGrayscalePlugin
+ (id) plugin {
return [[[self alloc] init] autorelease];
}
- (void) willRegister:(id<ACPluginManager>)pluginManager {
[pluginManager addFilterMenuTitle:@"Grayscale"
withSuperMenuTitle:@"Color"
target:self
action:@selector(convert:userObject:)
keyEquivalent:@""
keyEquivalentModifierMask:0
userObject:nil];
}
- (CIImage*) convert:(CIImage*)image userObject:(id)uo {
#pragma unused (uo)
CIFilter *filter = [CIFilter filterWithName: @"CIColorMonochrome" keysAndValues: @"inputImage", image, nil];
CIColor *color = [CIColor colorWithRed:0.5f green:0.5f blue:0.5f];
[filter setDefaults];
[filter setValue:color forKey:@"inputColor"];
[filter setValue:[NSNumber numberWithFloat:1] forKey:@"inputIntensity"];
return [filter valueForKey: @"outputImage"];
}
- (void) didRegister {
}
@end
Back to
AcornPlugins