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?




On May 31, 2006, at 1:07 PM, Olaf Krzikalla wrote:

Hi,

actually I have two questions:

1. How can I obtain an CGLayer from an HIView?
Suppose I have an HIView and need a CGLayer compatible with that view. I
have to use CGLayerCreateWithContext. Hence I need a CGContext. But
according to the docs the only time I have a CGContext is during handling of
a paint message (creating a  CGContext from a QD port is no option, because
its deprecated and in some scenarios I even have no QD port).
All this leads to the weird fact, that I have to create a dummy CGLayer
during the first paint message, which later I can use to create my actual
CGLayers. I don't think that this is an intended user story of CGLayer...

I don't understand what you want the "dummy" CGLayer for.  You could 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).

2. Can I prevent background drawing in an HIView?
Suppose I have an HIView with metal attribute set. Profiling has shown, that
drawing the metal background is an important factor in terms of performance.
Also I know that the content of my whole HIView (the client area of the
window) actually is opaque. That is, all the metal background drawing after
an invalidate is always overdrawn and thus redundant. Can I supress the
background drawing ?

Yes, you can mark your HIView as opaque (kHIViewFeatureIsOpaque) This feature tells the system that you intend to draw every pixel in the area of your view so the system need not bother drawing anything behind it.

Scott

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



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.