GPUImage源码阅读

GPUImage源码阅读(三):OpenGL 与 BGRA/RG

2018-02-15  本文已影响234人  苦艾酒艾

GPUImagePicture.m 的源码中提到,只有这两种格式的图像数据可以直接在 OpenGL 中使用:

在 Apple 的官方 sample code GLImageProcessing 有这样的说明:

CGImage may return pixels in RGBA, BGRA, or ARGB order.
On the device, CGImage will generally return BGRA or RGBA.
On the simulator, CGImage may return ARGB, depending on the file format.

为了提升 Core Graphics 的性能,苹果推荐使用 BGRA。

参考:

  1. Quick Tip: Working with CGBitmapContext and pixel ordering (RGBA, BGRA etc)
  2. How can I use ARGB color in opengl/SDL?
  3. Programming with Quartz: 2D and PDF Graphics in Mac OS X
  4. Determining color order from an image file
  5. adobe/chromium
上一篇 下一篇

猜你喜欢

热点阅读