aboutsummaryrefslogtreecommitdiff
path: root/src/canvas.h
blob: 2bdb775f5ebc2b44c0bf4e7a300fcb92e1ecc9e6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
struct Layer {
    unsigned int *pix;
};

struct Canvas {
	unsigned char layer_arr_cnt, layer_arr_sz;
	unsigned int cur_col, cur_layer;
	unsigned int w, h, zoom;
	char *proj_path;
	struct Layer **layers;
	int x, y;
	void *back, *pres;
	void *temp_pix;
	uint *pres_pix;
};

typedef struct Layer Layer;
typedef struct Canvas Canvas;

extern unsigned char is_drawing;
extern const unsigned int maxzoom; /* move to another tab */
extern Canvas* cur_canvas;  /* current canvas */

Canvas         *canvas_init(unsigned int, unsigned int, void *);
Canvas         *canvas_import_png(const char *, void *);
Canvas         *canvas_open(const char *, void *); /* TODO: open function per version */
void            canvas_destroy(Canvas *);
void            canvas_redraw(Canvas *, void *, int, int);
void            canvas_present(Canvas *, void *);
void            canvas_zoom_change(Canvas *, short int);
void            canvas_point_draw(Canvas *, long int, long int);
void            canvas_mousel_up(Canvas *);
void            canvas_mousel_down(Canvas *, long int, long int);
void            canvas_mouse_move(Canvas *, long int, long int);
void            canvas_add_layer(Canvas *, unsigned char);
void            canvas_move_x(Canvas *, long int);
void            canvas_move_y(Canvas *, long int);
void            canvas_refresh(Canvas *);
unsigned char   canvas_save(Canvas *, const char *, short int);
unsigned char   canvas_export_png(Canvas *, const char *, void *);