aboutsummaryrefslogtreecommitdiff
path: root/src/canvas.h
blob: dbda7cf64bf71241f032ba93a311534c447b231a (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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
/* Should include action.h before it */

/* TODO: move to config.h */
#define HISTLENGTH 2000
#define LAYERNAMELEN 30

struct Layer {
	unsigned char visible;
	char name[LAYERNAMELEN+1];
};

struct Frame {
	unsigned char state;
};

struct Canvas {
	unsigned int layer_arr_cnt, layer_arr_sz;
	unsigned int frame_arr_cnt, frame_arr_sz;
	unsigned int cell_arr_cnt, cell_arr_sz;
	unsigned int cur_col, cur_layer, cur_frame;
	unsigned int w, h, zoom;
	char *proj_path;
	struct Layer *layers;
	struct Frame *frames;
	unsigned int **cells;
	int x, y;
	void *back, *pres, *half_pres;
	struct action_pixcol *temp_pix;
	int temp_cnt;
	uint *pres_pix;
	Action history[HISTLENGTH];
	int hist_s, hist_e, hist_i, hist_isend;


	/* Variables used for various editing states */
	unsigned int a;
};

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);
unsigned char   canvas_add_layer(Canvas *, unsigned int);
unsigned char   canvas_add_frame(Canvas *, unsigned int);
void            canvas_move_x(Canvas *, long int);
void            canvas_move_y(Canvas *, long int);
void            canvas_refresh(Canvas *);
void            canvas_change_layer(Canvas *, unsigned int);
void            canvas_change_frame(Canvas *, unsigned int);
unsigned char   canvas_save(Canvas *, const char *, short int);
unsigned char   canvas_export_png(Canvas *, const char *, void *);
void            action_undo(Canvas *);
void            action_redo(Canvas *);