在 GPUImagePicture.m
的源码中提到,只有这两种格式的图像数据可以直接在 OpenGL 中使用:
- Little endian,alpha-first,即 BGRA(也就是 ARGB 反过来)
- Big endian,alpha-last,即 RGBA
在 Apple 的官方 sample code GLImageProcessing 有这样的说明:
为了提升 Core Graphics 的性能,苹果推荐使用 BGRA。
参考:
- Quick Tip: Working with CGBitmapContext and pixel ordering (RGBA, BGRA etc)
- How can I use ARGB color in opengl/SDL?
- Programming with Quartz: 2D and PDF Graphics in Mac OS X
- Determining color order from an image file
- adobe/chromium