Dianne Hackborn | 8b49bd1 | 2010-06-30 13:56:17 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2010 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 | #ifndef ANDROID_NATIVE_WINDOW_H |
| 19 | #define ANDROID_NATIVE_WINDOW_H |
| 20 | |
| 21 | #ifdef __cplusplus |
| 22 | extern "C" { |
| 23 | #endif |
| 24 | |
Dianne Hackborn | 8ae5a8e | 2010-07-01 18:44:46 -0700 | [diff] [blame^] | 25 | /* |
| 26 | * Pixel formats that a window can use. |
| 27 | */ |
| 28 | enum { |
| 29 | WINDOW_FORMAT_RGBA_8888 = 1, |
| 30 | WINDOW_FORMAT_RGBX_8888 = 2, |
| 31 | WINDOW_FORMAT_RGB_565 = 4, |
| 32 | }; |
| 33 | |
Dianne Hackborn | 8b49bd1 | 2010-06-30 13:56:17 -0700 | [diff] [blame] | 34 | struct ANativeWindow; |
| 35 | typedef struct ANativeWindow ANativeWindow; |
| 36 | |
Dianne Hackborn | 54a181b | 2010-06-30 18:35:14 -0700 | [diff] [blame] | 37 | /* |
| 38 | * Return the current width in pixels of the window surface. Returns a |
| 39 | * negative value on error. |
| 40 | */ |
| 41 | int32_t ANativeWindow_getWidth(ANativeWindow* window); |
| 42 | |
| 43 | /* |
| 44 | * Return the current height in pixels of the window surface. Returns a |
| 45 | * negative value on error. |
| 46 | */ |
| 47 | int32_t ANativeWindow_getHeight(ANativeWindow* window); |
| 48 | |
| 49 | /* |
| 50 | * Return the current pixel format of the window surface. Returns a |
| 51 | * negative value on error. |
| 52 | */ |
| 53 | int32_t ANativeWindow_getFormat(ANativeWindow* window); |
Dianne Hackborn | 8b49bd1 | 2010-06-30 13:56:17 -0700 | [diff] [blame] | 54 | |
Dianne Hackborn | 8ae5a8e | 2010-07-01 18:44:46 -0700 | [diff] [blame^] | 55 | /* |
| 56 | * Change the format and size of the window buffers. |
| 57 | * |
| 58 | * The width and height control the number of pixels in the buffers, not the |
| 59 | * dimensions of the window on screen. If these are different than the |
| 60 | * window's physical size, then it buffer will be scaled to match that size |
| 61 | * when compositing it to the screen. |
| 62 | * |
| 63 | * The format may be one of the window format constants above. |
| 64 | * |
| 65 | * For all of these parameters, if 0 is supplied than the window's base |
| 66 | * value will come back in force. |
| 67 | */ |
| 68 | int32_t ANativeWindow_setBuffersGeometry(ANativeWindow* window, int32_t width, |
| 69 | int32_t height, int32_t format); |
| 70 | |
Dianne Hackborn | 8b49bd1 | 2010-06-30 13:56:17 -0700 | [diff] [blame] | 71 | #ifdef __cplusplus |
| 72 | }; |
| 73 | #endif |
| 74 | |
| 75 | #endif // ANDROID_NATIVE_WINDOW_H |