【问题标题】:Create bitmap of a DOMElement Objective C创建 DOMElement 目标 C 的位图
【发布时间】:2010-12-12 15:21:36
【问题描述】:

我有一个 Webkit DOMElement,例如一个 div。 现在我想要一个渲染的 NSImage 或 NSBitmapImageRep。

这就像一个 DOMElement 的屏幕截图。

【问题讨论】:

    标签: objective-c cocoa webkit


    【解决方案1】:

    公共 API 选择:

    -[NSView cacheDisplayInRect:toBitmapImageRep:]
    -[NSBitmapImageRep initWithFocusedViewRect:]
    

    私有 WebKit 方法:

    -[DOMElement renderedImage]
    

    【讨论】:

    • renderedImage 在我的情况下不起作用。我的 DOMElement 是一个 SVG 组 。它返回一个没有任何表示的 NSImage。
    • 我更新了我的 Webkit 版本。现在,私有方法有效,谢谢!
    • 相信 -renderedImage 已添加到 Safari/WebKit 4 中,如果有帮助的话。
    • 怎么更新webkit版本,怎么知道你有什么版本?
    • WebKit 更新作为 Safari 或操作系统更新的一部分提供。可能他安装了 Safari 4.1 或 5.0
    猜你喜欢
    • 2013-03-04
    • 2015-05-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-11-22
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多