#ifndef GRAPHICS_H
#define GRAPHICS_H

/* Number of concurrent windows that can be created */
#define MAX_WINDOWS 1

#define BLACK 0x0000
#define LIGHTGRAY 0xeeee
#define DARKGRAY 0x1111
#define WHITE 0xffff

struct graph_screen {
	unsigned short bits_per_pixel;
	unsigned char *physcr;
	int fd;
	unsigned int xres;
	unsigned int yres;
	unsigned int line_length;
	unsigned long size;
};

struct window;

int getmaxx(void);
int getmaxy(void);
void setcolor(unsigned short value);
int initgraph(const char *device);

/* Create a window with pixel scale */
struct window *initwindow(int scale);

char *grapherrormsg(int errno);
int closewindow(struct window *win);
int setcurrentwindow(struct window *win);
int closegraph(void);
int cleargraph(void);
int doupdate(void);
int rectangle(int x0, int y0, int x1, int y1);
int line(int x0, int y0, int x1, int y1);
int circle(int x, int y, int radius);
int putimage(unsigned int height, unsigned int width, unsigned int starty, unsigned int startx, void *pixels);
int getimage(unsigned int height, unsigned int width, unsigned int starty, unsigned int startx, void *pixels);

#endif
