1 #ifndef GRAPHICS_GRAPHICS_H
2 #define GRAPHICS_GRAPHICS_H
3 
4 #include "graphics/color.h"
5 
6 typedef enum {
7     CANVAS_UI = 0,
8     CANVAS_CITY = 1,
9     CANVAS_CUSTOM = 2,
10     MAX_CANVAS = 3
11 } canvas_type;
12 
13 typedef enum {
14     CLIP_NONE,
15     CLIP_LEFT,
16     CLIP_RIGHT,
17     CLIP_TOP,
18     CLIP_BOTTOM,
19     CLIP_BOTH,
20     CLIP_INVISIBLE
21 } clip_code;
22 
23 typedef struct {
24     clip_code clip_x;
25     clip_code clip_y;
26     int clipped_pixels_left;
27     int clipped_pixels_right;
28     int clipped_pixels_top;
29     int clipped_pixels_bottom;
30     int visible_pixels_x;
31     int visible_pixels_y;
32     int is_visible;
33 } clip_info;
34 
35 void graphics_init_canvas(int width, int height);
36 const void *graphics_canvas(canvas_type type);
37 void graphics_set_active_canvas(canvas_type type);
38 void graphics_set_custom_canvas(color_t *pixels, int width, int height);
39 void graphics_restore_original_canvas(void);
40 canvas_type graphics_get_canvas_type(void);
41 
42 void graphics_in_dialog(void);
43 void graphics_in_dialog_with_size(int width, int height);
44 void graphics_reset_dialog(void);
45 
46 void graphics_set_clip_rectangle(int x, int y, int width, int height);
47 void graphics_reset_clip_rectangle(void);
48 const clip_info *graphics_get_clip_info(int x, int y, int width, int height);
49 
50 void graphics_save_to_buffer(int x, int y, int width, int height, color_t *buffer);
51 void graphics_draw_from_buffer(int x, int y, int width, int height, const color_t *buffer);
52 
53 color_t *graphics_get_pixel(int x, int y);
54 
55 void graphics_clear_screen(canvas_type type);
56 void graphics_clear_city_viewport(void);
57 void graphics_clear_screens(void);
58 
59 void graphics_draw_vertical_line(int x, int y1, int y2, color_t color);
60 void graphics_draw_horizontal_line(int x1, int x2, int y, color_t color);
61 
62 void graphics_draw_rect(int x, int y, int width, int height, color_t color);
63 void graphics_draw_inset_rect(int x, int y, int width, int height);
64 
65 void graphics_fill_rect(int x, int y, int width, int height, color_t color);
66 void graphics_shade_rect(int x, int y, int width, int height, int darkness);
67 
68 #endif // GRAPHICS_GRAPHICS_H
69