Re: Preparation for doing a bug report for CIPageCurlTransition
Re: Preparation for doing a bug report for CIPageCurlTransition
- Subject: Re: Preparation for doing a bug report for CIPageCurlTransition
- From: Bill Monk <email@hidden>
- Date: Mon, 31 Mar 2014 14:47:40 -0500
CIPageCurlTransition's inputBacksideImage does work, but its scaling and/or interaction with the shading image seems under-documented (to me anyway), and as such, seems to behave oddly...
But I can definitely get a visible backside image by tweaking your code a little (using https://gist.github.com/SheffieldKevin/98734).
(No doubt the list will eat the screenshots I'm about to paste in...)
First, the shading image needs some transparency, else you get just get a gray gradient on the back, regardless of the backside image.
I used:
----
CIColor *color0 = [CIColor colorWithRed:1.0 green:1.0 blue:1.0 alpha:0.5];
[radialGradientFilter setValue:color0 forKey:@"inputColor0"];
CIColor *color1 = [CIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:0.5];
[radialGradientFilter setValue:color1 forKey:@"inputColor1"];
---
Alone, that doesn't appear to do much; just a green gradient on the back side. That's because
a) the back side image is getting scaled in weird way. All that's visible of your triangle image its green background. The red triangle in the center is "wrapped" so far back behind, it isn't visible at all (this will become apparent...).
b) your back side image and target image both have extensive green areas, so it's difficult to tell them apart where they meet.
Different colors on the triangle backside image helps:
----
CGColorRef backColor = CGColorCreateGenericRGB(1.0, 0.5, 0.2, 1.0); // magenta-ish
CGColorRef triangleColor = CGColorCreateGenericRGB(0.7, 0.2, 0.5, 1.0); // orange-y
---
But now the back side is just a magenta gradient. Where's the triangle? Maybe it's wrapped too far around back to be visible...
Let's flip it to point upwards, with the point touching the top of the image and the base the full width of the image:
-------
CGPoint trianglePoint1 = CGPointMake( 0, 0 );
CGPoint trianglePoint2 = CGPointMake( kBoundsRect.size.width, 0);
CGPoint trianglePoint3 = CGPointMake( kBoundsRect.size.width / 2, kBoundsRect.size.height );
<image>
-------
But hmm: when wrapped onto the backside, still only a magenta area is visible...
Let's swap the backside image and the target image (the target is the one revealed by the curl):
----------
CIImage *inputImage = [CIImage imageWithCGImage:sourceImage];
[pageCurlFilter setValue:inputImage forKey:@"inputImage"];
#define SwapDestAndBack (1)
#if SwapDestAndBack
CGImageRef temp = destinationImage;
destinationImage;
destinationImage = temp;
#endif
CIImage *inputTargetImage = [CIImage imageWithCGImage:destinationImage];
[pageCurlFilter setValue:inputTargetImage forKey:@"inputTargetImage"];
CIImage *inputBacksideImage = [CIImage imageWithCGImage:backsideImage];
[pageCurlFilter setValue:inputBacksideImage forKey:@"inputBacksideImage"];
---------
OK, now that looks like as expected:
<image>
The backside image is gradient red, and its green center visible, just-barely "wrapped around". And the revealed target is magenta, with its centered orange triangle.
So, why doesn't the magenta image image work on the backside...
Swapping the images back the way you had them originally with the macro
#define SwapDestAndBack (0)
and changing your DrawFillTriangleAndCreateImage() to return a backside image 30% larger than the other two, things look a little more as expected:
<image>
Now the revealed target image is red, with its green central rect. And the backside image does show the orange triangle, and a bit of the magenta background...
But the backside seems really scaled-up. Well, we scaled it up 30%... but making it even a tiny bit larger or smaller results in very different results, such that either only a magenta or orange area is visible at all.
There seems to be *lots* of interaction with the inputRectangle of the crop filter producing the shadingImage. That may be the key...
That was all I had time to tweak, but hopefully it'll help a bit.
_______________________________________________
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