blob: 2284a3374f37fe231d59695c429c141ee2d65003 [file] [log] [blame]
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -08001/*
2 * Copyright (C) 2007 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 _MINUI_H_
18#define _MINUI_H_
19
Dima Zavin4daf48a2011-08-30 11:59:20 -070020#include <stdbool.h>
21
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -080022typedef void* gr_surface;
23typedef unsigned short gr_pixel;
24
25int gr_init(void);
26void gr_exit(void);
27
28int gr_fb_width(void);
29int gr_fb_height(void);
30gr_pixel *gr_fb_data(void);
31void gr_flip(void);
Dima Zavin4daf48a2011-08-30 11:59:20 -070032void gr_fb_blank(bool blank);
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -080033
34void gr_color(unsigned char r, unsigned char g, unsigned char b, unsigned char a);
35void gr_fill(int x, int y, int w, int h);
36int gr_text(int x, int y, const char *s);
37int gr_measure(const char *s);
Dima Zavin3c7f00e2011-08-30 11:58:24 -070038void gr_font_size(int *x, int *y);
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -080039
40void gr_blit(gr_surface source, int sx, int sy, int w, int h, int dx, int dy);
41unsigned int gr_get_width(gr_surface surface);
42unsigned int gr_get_height(gr_surface surface);
43
44// input event structure, include <linux/input.h> for the definition.
45// see http://www.mjmwired.net/kernel/Documentation/input/ for info.
46struct input_event;
47
The Android Open Source Projectc24a8e62009-03-03 19:28:42 -080048int ev_init(void);
49void ev_exit(void);
50int ev_get(struct input_event *ev, unsigned dont_wait);
51
52// Resources
53
54// Returns 0 if no error, else negative.
55int res_create_surface(const char* name, gr_surface* pSurface);
56void res_free_surface(gr_surface surface);
57
58#endif