> 
> 
> Show all the code by which the layer is configured and put into the interface 
> if you want a more educated response. m.
> 

I'll try, it's a bit scattered throughout my program.
(I was a bit hesitant to flood my original post with potentially unwanted code 
...)

Here goes:

        CGImageRef imageRef = CGImageSourceCreateImageAtIndex( sourceRef, 0, 
NULL );
        CALayer * newlayer;

        NSSize startsize = drawRect_.size;
        startsize.width *= MinimalImageSizeDisplayed;
        startsize.height *= MinimalImageSizeDisplayed;
        
        NSSize endsize = startsize;
        endsize.width *= 1.5;
        endsize.height *= 1.5;                                                  
                                                                        
        newlayer = [self makeImageLayer: imageRef fromSize: startsize toSize: 
endsize withOrientation: img_orientation];

        // swap the old and the new layer 
        [CATransaction begin];
        // causes cross-dissolve animation
        [CATransaction setValue: [NSNumber numberWithFloat: fading_duration] 
forKey: kCATransactionAnimationDuration  ];
        
        [mainLayer_ replaceSublayer: currentLayer_ with: newlayer];
        currentLayer_ = newlayer;
        
        [CATransaction commit];



- (CALayer *) makeImageLayer: (CGImageRef) img fromSize: (NSSize) startsize 
toSize: (NSSize) endsize withOrientation: (int) orientation
{
        CALayer * imgLayer = [self makeImageLayer: img withOrientation: 
orientation];
        
        // create animation for growing/shrinking
        CABasicAnimation * anim = [CABasicAnimation animationWithKeyPath: 
@"bounds.size"];
        anim.timingFunction     = [CAMediaTimingFunction functionWithName: 
kCAMediaTimingFunctionEaseOut];
        anim.duration           = durationPerCycle_;
        anim.autoreverses       = YES;
        anim.repeatCount        = 1e100;        // = forever
        
        if ( orientation < 1 || orientation > 8 )
                orientation = 1;
        if ( orientation <= 4 )
        {
                anim.fromValue  = [NSValue valueWithSize: startsize];
                anim.toValue    = [NSValue valueWithSize: endsize];
        }
        else
        {
                // swap width & height, because the image's orientation is a 
transposition or rotation
                anim.fromValue  = [NSValue valueWithSize: 
NSMakeSize(startsize.height, startsize.width) ];
                anim.toValue    = [NSValue valueWithSize: 
NSMakeSize(endsize.height, endsize.width) ];
        }
        
        [imgLayer addAnimation: anim forKey: nil];
        
        return imgLayer;
}


As I said, some images just won't get displayed under 10.5, but the same images 
work fine under 10.6.

Best regards,
Gabriel.


Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________

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

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

Reply via email to