• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Newbie: Chaining CIFilters together?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Newbie: Chaining CIFilters together?


  • Subject: Re: Newbie: Chaining CIFilters together?
  • From: Troy Stephens <email@hidden>
  • Date: Tue, 24 May 2005 11:51:01 -0700

On May 23, 2005, at 8:16 PM, M. Carlson wrote:
Okay, it's probably a case of RTFM, but I can't figure how to chain CIFilters for combined effects.

There is a sample project, CIExposureSample, under Developer > Examples > Quartz > Core Image. I can replace the CIExposureAdjust filter with CIHueAdjust, for instance, and it works fine. But if I try to make the output of one CIFilter become the input of another, like:

selectedImage = [CIImage imageWithContentsOfURL: ...
hueFilter = [CIFilter filterWithName:@"CIHueAdjust"
                keysAndValues:@"inputImage",selectedImage,nil];
expFilter = [CIFilter filterWithName:@"CIExposureAdjust"
                keysAndValues:@"inputImage",[hueFilter valueForKey:@"outputImage"],nil];
[context drawImage:[ expFilter valueForKey: @"outputImage"] ...

This does not seem to work. Apparently, I don't quite get the paradigm used.
Thanks for any pointers.

--M

You've got the right approach, but perhaps your hueFilter isn't yet fully configured at the point where you're asking for its "outputImage"?

A gotcha that may be biting you is that each time you change one or more of a filter's parameters, its "outputImage" actually changes identity ([theFilter valueForKey:@"outputImage"] subsequently returns a different pointer value).

Your "hueFilter" has some other parameters, which presumably you're setting later on in your code (maybe individually, or via a [hueFilter setDefaults] message).  After you change those values, it's necessary to re-establish the connection between filters, since the hueFilter will now return a different "outputImage" instance:

    [expFilter setValue:[hueFilter valueForKey:@"outputImage"] forKey:@"inputImage"];


--

Troy Stephens

Cocoa Frameworks

Apple Computer, Inc.



 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Newbie: Chaining CIFilters together?
      • From: "M. Carlson" <email@hidden>
References: 
 >Newbie: Chaining CIFilters together? (From: "M. Carlson" <email@hidden>)

  • Prev by Date: Re: AppleScript: Returning object references in Cocoa
  • Next by Date: Where does an NSDocument get it's initial NSWindowController from?
  • Previous by thread: Newbie: Chaining CIFilters together?
  • Next by thread: Re: Newbie: Chaining CIFilters together?
  • Index(es):
    • Date
    • Thread