Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to get an CGLayer from an HIView?



Hi,

simply create the actual CGLayer on the first invocation of
(kEventClassControl, kEventControlDraw) and reuse that layer so long
as the display environment for the view doesn't change.  Depending on
how the layer is used, it may be to your advantage to recreate the
layer when the display environment changes (such as when the window
containing the view moves to another screen).

That's what I'm doing now. But two things are bothering me:
1. Due to the above approach there is a conceptional flaw in my software architecture (lets say, it's not as simple as it could be). Actually, I want to cache an image in a CGLayer immediately after I've loaded or created it. But I had to introduce some sort of an 'inbetween-structure' to transfer the creation of the CGLayer to the draw event handling.
2. The performance of the draw event handling becomes unpredictable. Creating a CGLayer with some content is a rather costly operation (compared to copying the layer to a CGContext), which I better should make outside the draw event (nobody bothers, if some animation stops during some loading process or the like, but everybody does (including me) if it occassionally happens somewhen else).



Yes, you can mark your HIView as opaque (kHIViewFeatureIsOpaque)
Thank you. That will help a lot.


Best regards Olaf Krzikalla

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Quartz-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/quartz-dev/email@hidden

This email sent to email@hidden
References: 
 >How to get an CGLayer from an HIView? (From: "Olaf Krzikalla" <email@hidden>)
 >Re: How to get an CGLayer from an HIView? (From: Scott Thompson <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.