shared memory: TODO fix client bug
[winnie] / libwinnie / src / gfx.h
1 /*
2 winnie - an experimental window system
3
4 Copyright (C) 2013 Eleni Maria Stea
5
6 This program is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program.  If not, see <http://www.gnu.org/licenses/>.
18
19 Author: Eleni Maria Stea <elene.mst@gmail.com>
20 */
21
22 #ifndef GFX_H_
23 #define GFX_H_
24
25 #include "geom.h"
26 #include "pixmap.h"
27
28 bool init_gfx();
29 void destroy_gfx();
30
31 bool client_open_gfx(void *smem_start, int offset);
32 void client_close_gfx();
33
34 unsigned char *get_framebuffer();
35 Pixmap *get_framebuffer_pixmap();
36
37 Rect get_screen_size();
38 int get_color_depth();
39
40 void set_clipping_rect(const Rect &clip_rect);
41 const Rect &get_clipping_rect();
42
43 void clear_screen(int r, int g, int b);
44 void fill_rect(const Rect &rect, int r, int g, int b);
45
46 void set_cursor_visibility(bool visible);
47
48 void blit(unsigned char *src_img, const Rect &src_rect, unsigned char* dest_img,
49                 const Rect &dest_rect, int dest_x, int dest_y);
50
51 void blit_key(unsigned char *src_img, const Rect &src_rect, unsigned char* dest_img,
52                 const Rect &dest_rect, int dest_x, int dest_y, int key_r, int key_g, int key_b);
53
54 void gfx_update(const Rect &rect);
55
56 void wait_vsync(); // vertical synchronization
57
58 void get_rgb_order(int *r, int *g, int *b);
59
60 #endif //GFX_H_