michael@0: /* michael@0: * Copyright (C) 2011 The Android Open Source Project michael@0: * michael@0: * Licensed under the Apache License, Version 2.0 (the "License"); michael@0: * you may not use this file except in compliance with the License. michael@0: * You may obtain a copy of the License at michael@0: * michael@0: * http://www.apache.org/licenses/LICENSE-2.0 michael@0: * michael@0: * Unless required by applicable law or agreed to in writing, software michael@0: * distributed under the License is distributed on an "AS IS" BASIS, michael@0: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. michael@0: * See the License for the specific language governing permissions and michael@0: * limitations under the License. michael@0: */ michael@0: michael@0: #ifndef SYSTEM_CORE_INCLUDE_ANDROID_GRAPHICS_H michael@0: #define SYSTEM_CORE_INCLUDE_ANDROID_GRAPHICS_H michael@0: michael@0: #ifdef __cplusplus michael@0: extern "C" { michael@0: #endif michael@0: michael@0: /* michael@0: * If the HAL needs to create service threads to handle graphics related michael@0: * tasks, these threads need to run at HAL_PRIORITY_URGENT_DISPLAY priority michael@0: * if they can block the main rendering thread in any way. michael@0: * michael@0: * the priority of the current thread can be set with: michael@0: * michael@0: * #include michael@0: * setpriority(PRIO_PROCESS, 0, HAL_PRIORITY_URGENT_DISPLAY); michael@0: * michael@0: */ michael@0: michael@0: #define HAL_PRIORITY_URGENT_DISPLAY (-8) michael@0: michael@0: /** michael@0: * pixel format definitions michael@0: */ michael@0: michael@0: enum { michael@0: HAL_PIXEL_FORMAT_RGBA_8888 = 1, michael@0: HAL_PIXEL_FORMAT_RGBX_8888 = 2, michael@0: HAL_PIXEL_FORMAT_RGB_888 = 3, michael@0: HAL_PIXEL_FORMAT_RGB_565 = 4, michael@0: HAL_PIXEL_FORMAT_BGRA_8888 = 5, michael@0: HAL_PIXEL_FORMAT_RGBA_5551 = 6, michael@0: HAL_PIXEL_FORMAT_RGBA_4444 = 7, michael@0: michael@0: /* 0x8 - 0xFF range unavailable */ michael@0: michael@0: /* michael@0: * 0x100 - 0x1FF michael@0: * michael@0: * This range is reserved for pixel formats that are specific to the HAL michael@0: * implementation. Implementations can use any value in this range to michael@0: * communicate video pixel formats between their HAL modules. These formats michael@0: * must not have an alpha channel. Additionally, an EGLimage created from a michael@0: * gralloc buffer of one of these formats must be supported for use with the michael@0: * GL_OES_EGL_image_external OpenGL ES extension. michael@0: */ michael@0: michael@0: /* michael@0: * Android YUV format: michael@0: * michael@0: * This format is exposed outside of the HAL to software decoders and michael@0: * applications. EGLImageKHR must support it in conjunction with the michael@0: * OES_EGL_image_external extension. michael@0: * michael@0: * YV12 is a 4:2:0 YCrCb planar format comprised of a WxH Y plane followed michael@0: * by (W/2) x (H/2) Cr and Cb planes. michael@0: * michael@0: * This format assumes michael@0: * - an even width michael@0: * - an even height michael@0: * - a horizontal stride multiple of 16 pixels michael@0: * - a vertical stride equal to the height michael@0: * michael@0: * y_size = stride * height michael@0: * c_size = ALIGN(stride/2, 16) * height/2 michael@0: * size = y_size + c_size * 2 michael@0: * cr_offset = y_size michael@0: * cb_offset = y_size + c_size michael@0: * michael@0: */ michael@0: HAL_PIXEL_FORMAT_YV12 = 0x32315659, // YCrCb 4:2:0 Planar michael@0: michael@0: michael@0: michael@0: /* Legacy formats (deprecated), used by ImageFormat.java */ michael@0: HAL_PIXEL_FORMAT_YCbCr_422_SP = 0x10, // NV16 michael@0: HAL_PIXEL_FORMAT_YCrCb_420_SP = 0x11, // NV21 michael@0: HAL_PIXEL_FORMAT_YCbCr_422_I = 0x14, // YUY2 michael@0: }; michael@0: michael@0: michael@0: /** michael@0: * Transformation definitions michael@0: * michael@0: * IMPORTANT NOTE: michael@0: * HAL_TRANSFORM_ROT_90 is applied CLOCKWISE and AFTER HAL_TRANSFORM_FLIP_{H|V}. michael@0: * michael@0: */ michael@0: michael@0: enum { michael@0: /* flip source image horizontally (around the vertical axis) */ michael@0: HAL_TRANSFORM_FLIP_H = 0x01, michael@0: /* flip source image vertically (around the horizontal axis)*/ michael@0: HAL_TRANSFORM_FLIP_V = 0x02, michael@0: /* rotate source image 90 degrees clockwise */ michael@0: HAL_TRANSFORM_ROT_90 = 0x04, michael@0: /* rotate source image 180 degrees */ michael@0: HAL_TRANSFORM_ROT_180 = 0x03, michael@0: /* rotate source image 270 degrees clockwise */ michael@0: HAL_TRANSFORM_ROT_270 = 0x07, michael@0: }; michael@0: michael@0: #ifdef __cplusplus michael@0: } michael@0: #endif michael@0: michael@0: #endif /* SYSTEM_CORE_INCLUDE_ANDROID_GRAPHICS_H */