Your comments have been really helpful. I've done two things to get everything 
to work:

Firstly, I turned my triangle upside down, and I set alpha for black at 0.7 and 
for white 0.3.

Now it is clear that everything works as it should.

Many Thanks.

Kevin

On 31 Mar 2014, at 20:43, Bill Monk <billm...@mac.com> wrote:

> 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  );
> 
> <Screen Shot 2014-03-31 at 2.08.23 PM.png>
> -------
> 
> 
> 
> 
> 
> 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:
> 
> <Screen Shot 2014-03-31 at 1.53.28 PM.png>
> 
> 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:
> 
> 
> <Screen Shot 2014-03-31 at 2.24.40 PM.png>
> 
> 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 (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to