Ivans Chou - 2007-06-25

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);

}