Use CoreGraphics transitions
Status: Beta
Brought to you by:
pikester42
Since the cross fade transition doesn't work, maybe you can use the CoreGraphics transition instead.
I've been trying, with limited success, to implement the CoreGraphics transitions. Please refer to the following URL:
http://dev.lipidity.com/feature/tutorial/xcode-transitions-core-graphics-image-2
I have been trying combinations of [myCoveringWindow windowNumber] and [myOtherCoveringWindow windowNumber] as parameters to spec.wid but all it ever does is transition from one image to the same image, and then advance the image, and repeat.
Logged In: YES
user_id=802662
Originator: YES
If you download the sample xcode from the above project, and copy the CGSPrivate.h file into JPEGDeux project. You can more or less copy the AnimWindow.m code directly into the fade function in the TransitionScreenShow.m file to get the transition working.
However, that may be my mistake. Maybe getting the transition to transform the myCoveringWindow and myOtherCoveringWindow requires a little more sophisticated changes than that. Here's what I did that doesn't work:
- (void)fade:(NSImage*)image {
// float i;
// [myOtherImageView setRotation:myRotation];
//myRotation=0;
// for (i=1; i>0; i-=myIncrement) {
// [myCoveringWindow setAlphaValue:i];
// }
// [myOtherCoveringWindow makeKeyAndOrderFront:self];
// [myCoveringWindow setAlphaValue:1];
// swap(myCoveringWindow, myOtherCoveringWindow);
// swap(myImageView, myOtherImageView);
// declare our variables
int handle;
CGSTransitionSpec spec;
// assign our transition handle
handle = -1;
// specify our specifications
spec.unknown1=0;
spec.type=CGSCube;
spec.option=CGSLeft;
spec.backColour=NULL;
spec.wid=[myOtherCoveringWindow windowNumber];
// Let’s get a connection
CGSConnection cgs= _CGSDefaultConnection();
// Create a transition
CGSNewTransition(cgs, &spec, &handle);
// Redraw the window [self display];
/* Pass the connection, handle,
* and duration to apply the animation
*/
CGSInvokeTransition(cgs, handle, 3);
/* We need to wait for the transition to finish
* before we get rid of it, otherwise we’ll get
* all sorts of nasty errors
*/
usleep((useconds_t)(3000000));
/* Finally, release all our variables */
CGSReleaseTransition(cgs, handle);
handle=0;
swap(myCoveringWindow, myOtherCoveringWindow);
swap(myImageView, myOtherImageView);
}