Re: Binding to CoreImage?
Re: Binding to CoreImage?
- Subject: Re: Binding to CoreImage?
- From: Troy Stephens <email@hidden>
- Date: Fri, 21 Oct 2005 13:27:06 -0700
On Oct 20, 2005, at 11:58 PM, Colin Cornaby wrote:
Has anyone tried binding to a CIFilter? Anyone have any success?
Doesn't look like binding to the attributes will work too well
because that won't actually render it. I just have some controls on
the screen that I want to progmatically bind.
Has anyone ever played with this? Google search found nothing.
See
http://developer.apple.com/samplecode/Reducer/Reducer.html
for one example. Some of Reducer's UI elements have their values
bound directly to CIFilter properties -- for example, the sharpen
"Intensity" slider is bound to a CIUnsharpMaskFilter's
"inputIntensity" attribute.
To receive notification that the output image needs to be re-rendered
when one of these attributes is changed, the ImageReducer object uses
KVO to add itself as an observer of the same attributes:
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object
change:(NSDictionary *)change context:(void *)context {
if (object == unsharpMaskFilter || object == shadow) {
[self updateOutputImage];
}
}
- init {
...
[unsharpMaskFilter addObserver:self
forKeyPath:@"inputIntensity" options:0 context:NULL];
[unsharpMaskFilter addObserver:self forKeyPath:@"inputRadius"
options:0 context:NULL];
...
Hope this helps!
--
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