/* A simple graphics library for CSE 20211 by Douglas Thain Updated / extended by R. Ansari (Dec 2024) Paris-Saclay Univ. for Magistere C-language course project This work is licensed under a Creative Commons Attribution 4.0 International License. https://creativecommons.org/licenses/by/4.0/ For course assignments, you should not change this file. For complete documentation, see: http://www.nd.edu/~dthain/courses/cse20211/fall2013/gfx Version 3, 11/07/2012 - Now much faster at changing colors rapidly. Version 2, 9/23/2011 - Fixes a bug that could result in jerky animation. ------ December 2024 Version V=4 ? 27/12/2024 - by R. Ansari , Univ. Paris-Saclay, for Magistere C-language course project */ #ifndef GFX_H #define GFX_H #ifdef __cplusplus extern "C" { #endif /* R. Ansari - December 2024 , added list of predefined colors See https://en.wikipedia.org/wiki/X11_color_names for X11 color definition */ enum gfx_colors { gfx_black=0, gfx_white=1, gfx_grey=2, gfx_darkgrey=3, gfx_red=4, gfx_green=5, gfx_blue=6, gfx_yellow=7, gfx_orange=8, gfx_magenta=9, gfx_purple=10, gfx_skyblue=11, gfx_teal=12, gfx_ivory=13, gfx_wheat=14}; /* Open a new graphics window. default background color=black */ void gfx_open( int width, int height, const char *title); /* R. Ansari - December 2024 , open a window with the specified background color */ void gfx_open_c( int width, int height, const char *title, enum gfx_colors bkgcol); /* R. Ansari - December 2024 , closes and unmap the window */ void gfx_close(); /* Draw a point at (x,y) */ void gfx_point( int x, int y ); /* Draw a line from (x1,y1) to (x2,y2) */ void gfx_line( int x1, int y1, int x2, int y2 ); /* R. Ansari - December 2024 , rectangle, circle and text drawing functions */ void gfx_rect( int x, int y, unsigned int w, unsigned int h); void gfx_fillrect( int x, int y, unsigned int w, unsigned int h); void gfx_circle( int xc, int yc, unsigned int r); void gfx_fillcircle( int xc, int yc, unsigned int r); void gfx_string( int x, int y, const char * str); /* Change the current drawing color. */ void gfx_color( int red, int green, int blue ); /* R. Ansari - December 2024 , color selection from pre-defined colors */ void gfx_color_p(enum gfx_colors col); /* Clear the graphics window to the background color. */ void gfx_clear(); /* Change the current background color. */ void gfx_clear_color( int red, int green, int blue ); /* R. Ansari - December 2024 ,Change the current background color, selection from pre-defined colors */ void gfx_clear_color_p(enum gfx_colors col); /* Wait for the user to press a key or mouse button. */ char gfx_wait(); /* Return the X and Y coordinates of the last event. */ int gfx_xpos(); int gfx_ypos(); /* Return the X and Y dimensions of the window. */ int gfx_xsize(); int gfx_ysize(); /* Check to see if an event is waiting. */ int gfx_event_waiting(); /* Flush all previous output to the window. */ void gfx_flush(); #ifdef __cplusplus } // extern "C" #endif #endif