blob: 678ba3d7c7e28c9aebfe8db37e23ee3121292aba [file] [log] [blame]
Dianne Hackborn8b49bd12010-06-30 13:56:17 -07001/*
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
22extern "C" {
23#endif
24
Dianne Hackborn8ae5a8e2010-07-01 18:44:46 -070025/*
26 * Pixel formats that a window can use.
27 */
28enum {
29 WINDOW_FORMAT_RGBA_8888 = 1,
30 WINDOW_FORMAT_RGBX_8888 = 2,
31 WINDOW_FORMAT_RGB_565 = 4,
32};
33
Dianne Hackborn8b49bd12010-06-30 13:56:17 -070034struct ANativeWindow;
35typedef struct ANativeWindow ANativeWindow;
36
Dianne Hackborn54a181b2010-06-30 18:35:14 -070037/*
38 * Return the current width in pixels of the window surface. Returns a
39 * negative value on error.
40 */
41int32_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 */
47int32_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 */
53int32_t ANativeWindow_getFormat(ANativeWindow* window);
Dianne Hackborn8b49bd12010-06-30 13:56:17 -070054
Dianne Hackborn8ae5a8e2010-07-01 18:44:46 -070055/*
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 */
68int32_t ANativeWindow_setBuffersGeometry(ANativeWindow* window, int32_t width,
69 int32_t height, int32_t format);
70
Dianne Hackborn8b49bd12010-06-30 13:56:17 -070071#ifdef __cplusplus
72};
73#endif
74
75#endif // ANDROID_NATIVE_WINDOW_H