• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
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 // Pixel formats used across the system.
18 // These formats might not all be supported by all renderers, for instance
19 // skia or SurfaceFlinger are not required to support all of these formats
20 // (either as source or destination)
21 #ifndef UI_PIXELFORMAT_H
22 #define UI_PIXELFORMAT_H
23 #include <hardware/hardware.h>
24 namespace android {
25 enum {
26     //
27     // these constants need to match those
28     // in graphics/PixelFormat.java & pixelflinger/format.h
29     //
30     PIXEL_FORMAT_UNKNOWN    =   0,
31     PIXEL_FORMAT_NONE       =   0,
32     // logical pixel formats used by the SurfaceFlinger -----------------------
33     PIXEL_FORMAT_CUSTOM         = -4,
34         // Custom pixel-format described by a PixelFormatInfo structure
35     PIXEL_FORMAT_TRANSLUCENT    = -3,
36         // System chooses a format that supports translucency (many alpha bits)
37     PIXEL_FORMAT_TRANSPARENT    = -2,
38         // System chooses a format that supports transparency
39         // (at least 1 alpha bit)
40     PIXEL_FORMAT_OPAQUE         = -1,
41         // System chooses an opaque format (no alpha bits required)
42     // real pixel formats supported for rendering -----------------------------
43     PIXEL_FORMAT_RGBA_8888    = HAL_PIXEL_FORMAT_RGBA_8888,    // 4x8-bit RGBA
44     PIXEL_FORMAT_RGBX_8888    = HAL_PIXEL_FORMAT_RGBX_8888,    // 4x8-bit RGB0
45     PIXEL_FORMAT_RGB_888      = HAL_PIXEL_FORMAT_RGB_888,      // 3x8-bit RGB
46     PIXEL_FORMAT_RGB_565      = HAL_PIXEL_FORMAT_RGB_565,      // 16-bit RGB
47     PIXEL_FORMAT_BGRA_8888    = HAL_PIXEL_FORMAT_BGRA_8888,    // 4x8-bit BGRA
48     PIXEL_FORMAT_RGBA_5551    = 6,                             // 16-bit ARGB
49     PIXEL_FORMAT_RGBA_4444    = 7,                             // 16-bit ARGB
50     PIXEL_FORMAT_RGBA_FP16    = HAL_PIXEL_FORMAT_RGBA_FP16,    // 64-bit RGBA
51     PIXEL_FORMAT_RGBA_1010102 = HAL_PIXEL_FORMAT_RGBA_1010102, // 32-bit RGBA
52 };
53 typedef int32_t PixelFormat;
54 uint32_t bytesPerPixel(PixelFormat format);
55 uint32_t bitsPerPixel(PixelFormat format);
56 }; // namespace android
57 #endif // UI_PIXELFORMAT_H
58