blob: f26fecb8b14709f3298c76bfb3b221b516d7fefa [file] [log] [blame]
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -08001/*
2 * Copyright (C) 2005 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17//
18
19// Pixel formats used across the system.
20// These formats might not all be supported by all renderers, for instance
21// skia or SurfaceFlinger are not required to support all of these formats
22// (either as source or destination)
23
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -080024
25#ifndef UI_PIXELFORMAT_H
26#define UI_PIXELFORMAT_H
27
Mathias Agopian54ed4f62010-02-16 17:33:37 -080028#include <hardware/hardware.h>
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -080029
30namespace android {
31
32enum {
33 //
34 // these constants need to match those
35 // in graphics/PixelFormat.java & pixelflinger/format.h
36 //
37 PIXEL_FORMAT_UNKNOWN = 0,
38 PIXEL_FORMAT_NONE = 0,
39
40 // logical pixel formats used by the SurfaceFlinger -----------------------
41 PIXEL_FORMAT_CUSTOM = -4,
42 // Custom pixel-format described by a PixelFormatInfo structure
43
44 PIXEL_FORMAT_TRANSLUCENT = -3,
45 // System chooses a format that supports translucency (many alpha bits)
46
47 PIXEL_FORMAT_TRANSPARENT = -2,
48 // System chooses a format that supports transparency
49 // (at least 1 alpha bit)
50
51 PIXEL_FORMAT_OPAQUE = -1,
52 // System chooses an opaque format (no alpha bits required)
Pannag Sanketiacb7b5d2011-06-10 18:30:30 -070053
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -080054 // real pixel formats supported for rendering -----------------------------
55
Dan Stoza6a5d35d2014-01-07 15:25:02 -080056 PIXEL_FORMAT_RGBA_8888 = HAL_PIXEL_FORMAT_RGBA_8888, // 4x8-bit RGBA
57 PIXEL_FORMAT_RGBX_8888 = HAL_PIXEL_FORMAT_RGBX_8888, // 4x8-bit RGB0
58 PIXEL_FORMAT_RGB_888 = HAL_PIXEL_FORMAT_RGB_888, // 3x8-bit RGB
59 PIXEL_FORMAT_RGB_565 = HAL_PIXEL_FORMAT_RGB_565, // 16-bit RGB
60 PIXEL_FORMAT_BGRA_8888 = HAL_PIXEL_FORMAT_BGRA_8888, // 4x8-bit BGRA
61 PIXEL_FORMAT_RGBA_5551 = 6, // 16-bit ARGB
62 PIXEL_FORMAT_RGBA_4444 = 7, // 16-bit ARGB
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -080063};
64
65typedef int32_t PixelFormat;
66
Dan Stozad3182402014-11-17 12:03:59 -080067uint32_t bytesPerPixel(PixelFormat format);
68uint32_t bitsPerPixel(PixelFormat format);
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -080069
70}; // namespace android
71
72#endif // UI_PIXELFORMAT_H