Dagang Wei
Dagang Wei

Reputation: 26528

Android: GraphicBuffer data format

As far as I know, there're 2 graphics engines in Android: OpenGL ES and Skia. Both of them provide a set of drawing API and output graphics data to the underlying GraphicBuffer. My question is what's the data format for GraphicBuffer? Is it a standard?

Upvotes: 0

Views: 678

Answers (1)

datenwolf
datenwolf

Reputation: 162269

OpenGL is not a graphics engine, it's a drawing API that talks directly with the GPU. It's not like OpenGL is a library with which a image in a certain format is drawn which is then loaded onto the graphics processor. OpenGL usually operates directly on the graphics processor.

Skia however really is a graphics engine. It can render either in software to a pixel buffer, or to a PDF. Or it can make OpenGL calls, which is what it usually does on Android.

A graphics buffer object is actually an abstract handle thing that represents the actual memory which holds the graphics data. But there is no "standard format"; each GPU may have its own preferrable layout. The important parameters are those of every RAW image format: Origin, row length, stride, number of channels, bits per channel, pixel data alignment.

However the most common format out there is BGRA with 8 bits per pixel, stride == row length, 4 bytes data alignment. But it's not important for you as a developer, what the OS uses behind the scenes.

Upvotes: 2

Related Questions