Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Re: Image from CGWindowListCreateImage causes crash when window resizes
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Image from CGWindowListCreateImage causes crash when window resizes



Ok, I changed my code to use the function CGDataProviderCopyData and this seems to work very well.

Thanks everyone for the pointers and information. This really helps me get a handle on how to extract raw pixels out of a bitmap. I'm now kind of surprised that my use of NSBitmapImageRep worked as well as it did.

And thanks again to the Quartz Services/Window Manager engineers for giving us the window capture functions. This simplifies my life so much not having to use skanky undocumented API's *cough* cgprivate *cough*.

Doug Hill
Oracle Corp.

On Nov 11, 2009, at 9:10 PM, David Duncan wrote:

On Nov 11, 2009, at 11:24 AM, Douglas Hill wrote:

However, for my application, I need access to the raw pixels, I'm fine with the format of the CGImage, and can't do processing with drawing. I need to bundle up the pixels I get and pass them to another library (non-Macintosh). Maybe I could make the performance better but I'm not that concerned about it right now, over just getting this to work. I also don't want/need to use Core Image.

The basic problem is your assuming that the geometry for the CGImage matches that of the NSBitmapImageRep – they need  not match at all. Instead I would recommend that you either draw the image to a CGBitmapContext (as Shawn mentioned) or use CGDataProviderCopyData(). Neither is likely to be significantly different in this case.
--
Reality is what, when you stop believing in it, doesn't go away.
Failure is not an option. It is a privilege reserved for those who try.

David Duncan


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

This email sent to email@hidden

References: 
 >Re: Image from CGWindowListCreateImage causes crash when window resizes (From: Douglas Hill <email@hidden>)
 >Re: Image from CGWindowListCreateImage causes crash when window resizes (From: David Duncan <email@hidden>)



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

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.