【问题标题】:CGBitmapContextCreate bitsPerComponent for RBG565CGBitmapContext为 RBG565 创建 bitsPerComponent
【发布时间】:2013-01-24 07:55:06
【问题描述】:

我正在尝试使用CGBitmapContextCreate 创建一个CGContextRef。我要创建的位图是 RBG565(红色和蓝色是 5 位,绿色是 6 位)。 CGBitmapContextCreate 的参数之一是bitsPerComponent。由于我有变量bitsPerComponent,我不确定我是否只是将其设置为 5,还是有更好的方法来做到这一点?

谢谢。

【问题讨论】:

    标签: objective-c cgbitmapcontextcreate cgcontextref


    【解决方案1】:

    CoreGraphics 本身不支持 RGB565。您需要使用不同格式创建位图上下文,然后使用 vImageConvert_ARGB8888toRGB565 之类的内容转换为 RGB565。

    【讨论】:

    • 谢谢,我稍后试试。