simplewin(3) SIMPLEWIN MANUAL simplewin(3) NAME simplewin_init, simplewin_run, simplewin_display, sim­ plewin_join, simplewin_set_colormodel, simplewin_set_rgb­ formulae, simplewin_draw_point, simplewin_draw_point_3 - Library providing a simple X11/GL interface to C, Fortran and Assembler SYNOPSIS C bindings: #include int simplewin_init(int argc, char **argv, unsigned width, unsigned height); void simplewin_run(); void simplewin_set_colormodel(int cm); void simplewin_set_rgbformulae(double r, double g, double b); void simplewin_draw_point(int x, int y, double color); void simplewin_draw_point_3(int x, int y, double r, double g, double b); void simplewin_display(); int simplewin_join(); Fortran bindings: include integer x,y,width,height,cm real*8 color,r,g,b call simplewin_init(width, height) call simplewin_run call simplewin_set_colormodel(cm) call simplewin_set_rgbformulae(r,g,b) call simplewin_draw_point(x,y,color) call simplewin_draw_point_3(x,y,r,g,b) call simplewin_display call simplewin_join DESCRIPTION This library provides a very simple interface to the X window system, so that beginners are able to write pro­ grams which draw points into a window. There are provided C and Fortran bindings as well as an .inc file for the NASM assembler. The simplewin_init function is used to initialize the library. Its arguments are the standard C argc and argv arguments, as well as the window width and height. This function does not yet create a window or any other visual effect. The simplewin_run function then creates the a thread which will create and show the window, as well as handle the events the window will receive. With the simplewin_set_colormodel function you can set the colormodel for all subsequent calls. If a function takes three arguments, they are interpreted as (r,g,b), if the current model is SIMPLEWIN_CM_RGB, and as (h,s,v), if the current model is SIMPLEWIN_CM_HSV. The simplewin_set_rgbformulae function sets the formulae for calculating red, green and blue values from the single color argument of the simplewin_draw_point function. The simplewin_draw_point function draws a point into the window at the coordinates x and y with the color color which should be in the range [0,1]. The simplewin_draw_point_rgb function draws a point into the window at the coordinates x and y with the color (r,g,b) which should all be in the range [0,1], bypassing the rgbformulae. The points drawn are not shown until either the window receives an expose event from the X window server or the application calls simplewin_display which will cause all points drawn so far to be shown. Finally, the simplewin_join function may be called when the application has finished its computations, when the programmer does not want the application to exit immedi­ ately, but to wait instead for the user to close the win­ dow. RETURN VALUES Upon successful return, the integer-returning functions return 0. EXAMPLES You should have received the source of the sim­ plewindemo(1) programs with the package. If not, contact the author. For online viewing, a shortened version of the C++ demo program simplewindemo_cc(1) is given below. #include #include int main(int argc, char **argv) { int width=1024,height=768; int maxiter=1000; simplewin_init(argc, argv, width, height); simplewin_run(); for(int i=0; i c((i-width/2)*4.0/width, (j-height/2)*4.0/height); std::complex z(0,0); int k; for(k=0; k4) break; } simplewin_draw_point(i,j,double(k)/maxiter); } } simplewin_display(); simplewin_join(); return 0; } Assuming you have installed this package to the directory , you can compile this program using the follow­ ing commands. The -I and -L options can be omitted if you installed this package to the standard location /usr/local. g++ -c -I/include simplewindemo_cc.cc g++ -o simplewindemo_cc simplewindemo_cc.o \ -L/lib -lsimplewin \ `pkg-config --libs gtkglext-1.0 gthread-2.0` In the source distribution you will find the source code of the above example as well as source codes for the for­ tran and NASM assembler examples simplewindemo_f and sim­ plewindemo_asm. HISTORY February 07, 2005 Release 0.2.1: Added new functions sim­ plewin_draw_point_rgb and simplewin_set_rgbformu­ lae. January 10, 2005 Release 0.2: Fortran API Name Changes. December 2004 Initial release 0.1. AUTHOR Dominik Epple, epple@tphys.physik.uni-tuebingen.de http://www.dominik-epple.de SEE ALSO simplewindemo(1), X(7), OpenGL, GTK+, GtkGlExt version 0.3.0 February 10, 2005 simplewin(3)