gpt4 book ai didi

cocoa - 在 Mac OS X 上将 RGBA 数据绘制到 View 中最直接的方法是什么?

转载 作者:行者123 更新时间:2023-12-03 18:04:52 25 4
gpt4 key购买 nike

长话短说,每隔 60 秒,我就有一个相对较小的 RGBA 数据缓冲区 (256x240)(每个组件 8 位,每个像素 4 字节),并用新数据刷新,我想显示它(我想在 NSView 内,但任何东西都是受欢迎的)。最直接的方法是什么?从 CGBitmapContext 构建 CGImageRef 并将其写入从 NSGraphicsContext 获取的 CGContextRef 似乎有点复杂。

最佳答案

Building a CGImageRef from a CGBitmapContext to write it to the CGContextRef obtained from the NSGraphicsContext seems a bit convoluted.

是的。具体来说,“位”就是CGBitmapContext;如果您已经有光栅数据来创建图像,则不需要它。只是create the image ,然后将其绘制到从当前 NSGraphicsContext 获得的 CGContext 中。

关于cocoa - 在 Mac OS X 上将 RGBA 数据绘制到 View 中最直接的方法是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3175516/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com