Apple的OpenGLScreenCapture示例显示了如何从主屏幕捕获而不是从隐藏表面捕获.
知道CamTwist如何访问NSWindow的像素缓冲区吗?
解决方法 AFAIK,官方API可以在CGWindow.h中找到,作为CoreGraphics的一部分:/* Create an image containing a composite of the specifIEd set of windows contained within a rectangular area. The set of windows is specifIEd using options from `CGWindowListOption',along with an optional additional window ID. The windows List options are: --- kCGWindowListOptionAll,kCGWindowListOptionOnScreenOnly: Use all on-screen windows in this user session to construct the image. The parameter `windowID' should be `kCGNullWindowID'. --- kCGWindowListOptionOnScreenAboveWindow: Use all on-screen windows in this user session above the window specifIEd by `windowID',ordered from front to back,to construct the image. To include the window specifIEd by `windowID',add the flag `kCGWindowListOptionIncludingWindow'. --- kCGWindowListOptionOnScreenBelowWindow: Use all on-screen windows in this user session below the window specifIEd by `windowID',add the flag `kCGWindowListOptionIncludingWindow'. --- kCGWindowListOptionIncludingWindow: Use only the window specifIEd by `windowID' to construct the image. The parameter `screenBounds' specifIEs the rectangle in screen space (origin at the upper-left; y-value increasing downward). Setting `screenBounds' to `CGRectInfinite' will include all the windows on the entire desktop. Setting `screenBounds' to `CGRectNull' will use the bounding Box of the specifIEd windows as the screen space rectangle.
打破
/* The parameter `imageOptions' allows you to specify whether the window frame ornamentation,such as a shadow or similar effect,should be included or excluded in the bounds calculation when `CGRectNull' is specifIEd for the window bounds. If no windows meet the specifIEd criteria,or the windows can't be read,then a transparent black image will be returned. Any on-screen window with sharing type `kCGwindowsharingNone' will not be included in the image. This function returns NulL if the caller is not running within a Quartz GUI session or the window server is @R_404_4610@. */CG_EXTERN CGImageRef CGWindowListCreateImage(CGRect screenBounds,CGWindowListOption ListOption,CGWindowID windowID,CGWindowImageOption imageOption) CG_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA);/* Create an image containing a composite of the specifIEd set of windows contained within a rectangular area à la `CGWindowListCreateImage'. The set of windows is specifIEd by `windowArray',an array of window IDs. */CG_EXTERN CGImageRef CGWindowListCreateImageFromArray(CGRect screenBounds,CFArrayRef windowArray,__IPHONE_NA);
抱歉,找不到Apple网站上文档的链接.但是,他们似乎在Son of Grab中有示例代码.
总结以上是内存溢出为你收集整理的cocoa – 如何在OSX中访问NSWindow的像素缓冲区?全部内容,希望文章能够帮你解决cocoa – 如何在OSX中访问NSWindow的像素缓冲区?所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)