graphics.h revision da1a1f629b0f3b3a63d9951de4381a41bc31fb91
1/* 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 decoders and 52 * applications. EGLImageKHR must support it in conjunction with the 53 * OES_EGL_image_external extension. 54 * 55 * YV12 is a 4:2:0 YCrCb planar format comprised of a WxH Y plane followed 56 * by (W/2) x (H/2) Cr and Cb planes. 57 * 58 * This format assumes 59 * - an even width 60 * - an even height 61 * - a horizontal stride multiple of 16 pixels 62 * - a vertical stride equal to the height 63 * 64 * y_size = stride * height 65 * c_size = ALIGN(stride/2, 16) * height/2 66 * size = y_size + c_size * 2 67 * cr_offset = y_size 68 * cb_offset = y_size + c_size 69 * 70 */ 71 HAL_PIXEL_FORMAT_YV12 = 0x32315659, // YCrCb 4:2:0 Planar 72 73 74 75 /* Legacy formats (deprecated), used by ImageFormat.java */ 76 HAL_PIXEL_FORMAT_YCbCr_422_SP = 0x10, // NV16 77 HAL_PIXEL_FORMAT_YCrCb_420_SP = 0x11, // NV21 78 HAL_PIXEL_FORMAT_YCbCr_422_I = 0x14, // YUY2 79}; 80 81 82/** 83 * Transformation definitions 84 * 85 * IMPORTANT NOTE: 86 * HAL_TRANSFORM_ROT_90 is applied CLOCKWISE and AFTER HAL_TRANSFORM_FLIP_{H|V}. 87 * 88 */ 89 90enum { 91 /* flip source image horizontally (around the vertical axis) */ 92 HAL_TRANSFORM_FLIP_H = 0x01, 93 /* flip source image vertically (around the horizontal axis)*/ 94 HAL_TRANSFORM_FLIP_V = 0x02, 95 /* rotate source image 90 degrees clockwise */ 96 HAL_TRANSFORM_ROT_90 = 0x04, 97 /* rotate source image 180 degrees */ 98 HAL_TRANSFORM_ROT_180 = 0x03, 99 /* rotate source image 270 degrees clockwise */ 100 HAL_TRANSFORM_ROT_270 = 0x07, 101}; 102 103__END_DECLS 104 105#endif /* SYSTEM_CORE_INCLUDE_ANDROID_GRAPHICS_H */ 106