blob: fab6ec9ca5ceb686c61db30d6ad817e5baf436d1 [file] [log] [blame]
Iliyan Malchev66ea3572011-05-01 14:05:30 -07001/*
2 * Copyright (C) 2011 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#ifndef SYSTEM_CORE_INCLUDE_ANDROID_GRAPHICS_H
18#define SYSTEM_CORE_INCLUDE_ANDROID_GRAPHICS_H
19
20__BEGIN_DECLS
21
22/**
23 * pixel format definitions
24 */
25
26enum {
27 HAL_PIXEL_FORMAT_RGBA_8888 = 1,
28 HAL_PIXEL_FORMAT_RGBX_8888 = 2,
29 HAL_PIXEL_FORMAT_RGB_888 = 3,
30 HAL_PIXEL_FORMAT_RGB_565 = 4,
31 HAL_PIXEL_FORMAT_BGRA_8888 = 5,
32 HAL_PIXEL_FORMAT_RGBA_5551 = 6,
33 HAL_PIXEL_FORMAT_RGBA_4444 = 7,
34
35 /* 0x8 - 0xFF range unavailable */
36
37 /*
38 * 0x100 - 0x1FF
39 *
40 * This range is reserved for pixel formats that are specific to the HAL
41 * implementation. Implementations can use any value in this range to
42 * communicate video pixel formats between their HAL modules. These formats
43 * must not have an alpha channel. Additionally, an EGLimage created from a
44 * gralloc buffer of one of these formats must be supported for use with the
45 * GL_OES_EGL_image_external OpenGL ES extension.
46 */
47
48 /*
49 * Android YUV format:
50 *
51 * This format is exposed outside of the HAL to software
52 * decoders and applications.
53 * EGLImageKHR must support it in conjunction with the
54 * OES_EGL_image_external extension.
55 *
56 * YV12 is 4:2:0 YCrCb planar format comprised of a WxH Y plane followed
57 * by (W/2) x (H/2) Cr and Cb planes.
58 *
59 * This format assumes
60 * - an even width
61 * - an even height
62 * - a horizontal stride multiple of 16 pixels
63 * - a vertical stride equal to the height
64 *
65 * y_size = stride * height
66 * c_size = ALIGN(stride/2, 16) * height/2
67 * size = y_size + c_size * 2
68 * cr_offset = y_size
69 * cb_offset = y_size + c_size
70 *
71 */
72 HAL_PIXEL_FORMAT_YV12 = 0x32315659, // YCrCb 4:2:0 Planar
73
74
75
76 /* Legacy formats (deprecated), used by ImageFormat.java */
77 HAL_PIXEL_FORMAT_YCbCr_422_SP = 0x10, // NV16
78 HAL_PIXEL_FORMAT_YCrCb_420_SP = 0x11, // NV21
79 HAL_PIXEL_FORMAT_YCbCr_422_I = 0x14, // YUY2
80};
81
82
83/**
84 * Transformation definitions
85 *
86 * IMPORTANT NOTE:
87 * HAL_TRANSFORM_ROT_90 is applied CLOCKWISE and AFTER HAL_TRANSFORM_FLIP_{H|V}.
88 *
89 */
90
91enum {
92 /* flip source image horizontally (around the vertical axis) */
93 HAL_TRANSFORM_FLIP_H = 0x01,
94 /* flip source image vertically (around the horizontal axis)*/
95 HAL_TRANSFORM_FLIP_V = 0x02,
96 /* rotate source image 90 degrees clockwise */
97 HAL_TRANSFORM_ROT_90 = 0x04,
98 /* rotate source image 180 degrees */
99 HAL_TRANSFORM_ROT_180 = 0x03,
100 /* rotate source image 270 degrees clockwise */
101 HAL_TRANSFORM_ROT_270 = 0x07,
102};
103
104__END_DECLS
105
106#endif /* SYSTEM_CORE_INCLUDE_ANDROID_GRAPHICS_H */