Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Creating a Image Unit form a CI Kernel



Hi,

I've written an CI Kernel in Quartz Composer.
The CI Kernel patch works well and I wanted to make an Image Unit out of this.
Unfortunately it does not work as assumed.


The output image from the Image Unit has infinite dimensions.
But I noticed that even the input image has infinite dimensions and I don't know what to do.


I'm using

vec2 imageDimension = samplerSize(src) / 2.0;

to find the center and do some transformations relative to the center.
It works well directly in QuartzComposer.
As an Image Unit it works well in Core Image Fun House on images that are smaller than the screen resolution.
As soon as the Image is larger than the screen, it fails.
Same in QuartzComposer, while the plain code in a CI Kernel patch works great, the Image Unit creates the same issue as in CoreImage Fun House PLUS the output has infinite dimensions.


Hope someone can help me.


-Michael


here is the source code :

kernel vec4 fisheye( sampler src,  float p)
{
	//cubic barrel or pincusion distortion determined by coefficients.
	vec2 t1, t2;

vec2 ctr = samplerSize(src) / 2.0;
t1 = destCoord();
float a = -0.0;
float b = -.1 * p ;
float c = -.0;
float d = 1.0 - 1.1 * ( a + b + c );
float r1, r2;
float unit = length(ctr) / 2.0;

r1 = distance( t1, ctr )/unit;
r2 = r1 *( r1*( r1 * (a*r1 + b) + c) + d );
float sc = step( 0.0 , r1) * ( r1/(r2 + .000001)) + (1.0 - step ( 0.0 , r1));


	t2  = ctr + ( t1 - ctr) * sc;
	return sample(src, samplerTransform(src, t2));
}


_______________________________________________ Do not post admin requests to the list. They will be ignored. Quartzcomposer-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/quartzcomposer-dev/email@hidden

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.