Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread Display Modes
Old Jun 29, 2009, 11:52 PM   #1
macrumors member
Join Date: Jul 2008
Assigning input for filter

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"])
                                   [tFilter setValue:result forKey:@"inputImage"]; 
                                  [tFilter setValue:iimage forKey:@"inputImage"]; 
		       result = [tFilter valueForKey: @"outputImage"];
	 return result;
mahaboob is offline   0 Reply With Quote
Old Jun 30, 2009, 06:29 AM   #2
Thread Starter
macrumors member
Join Date: Jul 2008
I managed to solve it.
Now I need to position the effects over the graphics by dragging it.
Now it is coming from one position in the graphics and I can't make any adjustments by dragging it. How can I do it?
mahaboob is offline   0 Reply With Quote

MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
Macbook self-assigning IP address, can't connect to wifi neonbliss Mac Basics and Help 6 Sep 5, 2014 08:12 AM
Assigning instances from difference classes to Array childoftheko4n iPhone/iPad Programming 27 Jul 25, 2013 07:58 PM
Assigning a hot key to a non active window? MarkC426 OS X 0 May 11, 2013 04:35 PM
Assigning photos/pictures to contacts problem! Chuckstones iMac 1 Jan 21, 2013 07:03 AM
Calendar - assigning colours to events? Big Stevie OS X 10.8 Mountain Lion 6 Nov 25, 2012 06:14 PM

Forum Jump

All times are GMT -5. The time now is 03:26 AM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013,, LLC