Input for CIFilter
Input for CIFilter
- Subject: Input for CIFilter
- From: Mahaboob <email@hidden>
- Date: Tue, 30 Jun 2009 11:29:24 +0530
- Thread-topic: Input for CIFilter
Hi,
I can apply almost all filter effects to my graphics except Generator and
Gradient effects. I'm applying filters in drawRect: method. This method is
calling a function for applying filters. This function checks all the
filters in effect stack and assigns input graphics for the input key named
"inputImage" and return the output after applying the filters. For those
filters (Generator and Gradient) there is no input keys named "inputImage".
So how can I assign input graphics?
I'm using code in this function is :
-(CIImage*)CIImageResultForEffectStack:(CIImage*)iimage {
NSMutableArray* arr = [self effectStack];
CIImage* result = nil;
CIFilter* tFilter;
JPFilter* tJPFilter;
NSString *key, *classstring;
NSArray *inputKeys;
NSDictionary *attr;
NSEnumerator *enumerator;
int i;
for(i = 0 ; i< [arr count] ; i++)
{
tJPFilter = [ arr objectAtIndex:i];
if([tJPFilter isEnabled])
{
tFilter = [tJPFilter filter];
attr = [tFilter attributes];
inputKeys = [tFilter inputKeys];
enumerator = [inputKeys objectEnumerator];
while ((key = [enumerator nextObject]) != nil)
{
id parameter = [attr objectForKey:key];
if ([parameter isKindOfClass:[NSDictionary class]])
{
classstring = [(NSDictionary *)parameter objectForKey:
kCIAttributeClass];
if ([classstring isEqualToString:@"CIImage"] )
{
[tFilter setValue:[self
imageMask] forKey:key];
}
}
}
if([inputKeys containsObject:@"inputImage"])
{
if(result!=nil)
[tFilter setValue:result
forKey:@"inputImage"];
else
[tFilter setValue:iimage
forKey:@"inputImage"];
}
result = [tFilter valueForKey: @"outputImage"];
}
}
return result;
}
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden