Re: CALayer bounds with ResizeAspect mask?
Re: CALayer bounds with ResizeAspect mask?
- Subject: Re: CALayer bounds with ResizeAspect mask?
- From: "Colin Doncaster" <email@hidden>
- Date: Thu, 9 Oct 2008 10:53:43 +1300
Hey Matt -
No worries.
It seems like the best approach is to do as you suggest and handle the
aspect resizing of the layer myself - that way I can maintain the same
dimensions with the drawing layer.
It'd be interesting to have some sort of insight as to what's actually
changing then - it seems that QTMovieLayer is handling the
transformations internally - but I wonder what ramifications this
would have if you were drawing your own content on a CALayer. It
seems like it would be ideal to be able to access this information.
cheers.
On Thu, Oct 9, 2008 at 8:15 AM, Matt Long <email@hidden> wrote:
> Colin,
>
> My assumptions were totally wrong. It seems that once you set it to maintain
> the aspect ratio with kCAGravityResizeAspect, it is simply updating the
> contents as you pointed out, and there doesn't appear to be any way to get
> the movie's display frame. Seems to me you will probably have to do the
> calculations manually as you suspected.
>
> You could maintain the aspect ratio yourself, however, the changes to your
> layer's frame would have to have animation turned off or it would always
> look like it was playing catchup.
>
> Sorry I wasn't more thorough before my initial response.
>
> -Matt
>
>
>
> On Oct 8, 2008, at 11:43 AM, Colin Doncaster wrote:
>
>> Hey Matt,
>>
>> So - if you create an NSView with a resolution of 640x300 and then create
>> a QTMovieLayer that fits that frame, is resizable and has
>>
>> [myMovieLayer setContentsGravity:kCAGravityResizeAspect]
>>
>> Core Animation resizes the movie to fit within the bounds of the layer
>> while maintaining it's aspect ratio ( which is totally cool, and what I want
>> ). So a 640x480 movie would be played at a resolution of 400x300. Of
>> course, the math is fairly simple to work out but I guess I got confused as
>> to what's happening under the hood.
>>
>> As it's a general CALayer property and not just a QTMoviePlayer property I
>> thought it would be actually resizing the layer to fit within the bounds of
>> the super layer, but it appears that the layer itself isn't changing and
>> just the contents of the layer is being resized while maintaining it's
>> aspect ratio.
>>
>> Does that make a little more sense?
>>
>> Also, to expand on the question - would it be incorrect to resize another
>> layer every time it redraws so it maintains the same resolution as the movie
>> vs. the movie layer? ie. would setting the frame and/or bounds many times
>> over be considered a bad thing?
>>
>> Thanks!
>>
>
_______________________________________________
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