VPR-6.0
|
00001 #define SCREEN 0 00002 #define POSTSCRIPT 1 00003 00004 enum color_types 00005 { WHITE, BLACK, DARKGREY, LIGHTGREY, BLUE, GREEN, YELLOW, 00006 CYAN, RED, DARKGREEN, MAGENTA, BISQUE, LIGHTBLUE, THISTLE, PLUM, KHAKI, 00007 CORAL, TURQUOISE, MEDIUMPURPLE, DARKSLATEBLUE, DARKKHAKI, NUM_COLOR 00008 }; 00009 00010 enum line_types 00011 { SOLID, DASHED }; 00012 00013 #define MAXPTS 100 /**< Maximum number of points drawable by fillpoly */ 00014 /** Used in calls to fillpoly */ 00015 typedef struct 00016 { 00017 float x; 00018 float y; 00019 } 00020 t_point; 00021 00022 /** Routine for X Windows Input. act_on_button responds to buttons 00023 * being pressed in the graphics area. drawscreen is the user's 00024 * routine that can redraw all the graphics. 00025 */ 00026 void event_loop(void (*act_on_button) (float x, 00027 float y), 00028 void (*drawscreen) (void)); 00029 00030 void init_graphics(char *window_name); /**< Initializes X display */ 00031 void close_graphics(void); /**< Closes X display */ 00032 00033 /** Changes message in text area. */ 00034 void update_message(char *msg); 00035 00036 /** Normal users shouldn't have to use draw_message. Should only be 00037 * useful if using non-interactive graphics and you want to redraw 00038 * yourself because of an expose. 00039 */ 00040 void draw_message(void); 00041 00042 /** Sets world coordinates */ 00043 void init_world(float xl, 00044 float yt, 00045 float xr, 00046 float yb); 00047 00048 void flushinput(void); /**< Empties event queue */ 00049 00050 /**@{*/ 00051 /* Following routines draw to SCREEN if disp_type = SCREEN * 00052 * and to a PostScript file if disp_type = POSTSCRIPT. */ 00053 00054 void setcolor(int cindex); /**< Use a constant from clist */ 00055 int getcolor(); 00056 void setlinestyle(int linestyle); 00057 void setlinewidth(int linewidth); 00058 void setfontsize(int pointsize); 00059 void drawline(float x1, 00060 float y1, 00061 float x2, 00062 float y2); 00063 void drawrect(float x1, 00064 float y1, 00065 float x2, 00066 float y2); 00067 void fillrect(float x1, 00068 float y1, 00069 float x2, 00070 float y2); 00071 void fillpoly(t_point * points, 00072 int npoints); 00073 /**@}*/ 00074 00075 /**@{*/ 00076 /* Draw or fill a circular arc, respectively. Angles in degrees. startang 00077 * measured from positive x-axis of Window. Positive angextent means 00078 * counterclockwise arc. 00079 */ 00080 00081 void drawarc(float xcen, 00082 float ycen, 00083 float rad, 00084 float startang, 00085 float angextent); 00086 void fillarc(float xcen, 00087 float ycen, 00088 float rad, 00089 float startang, 00090 float angextent); 00091 /**@}*/ 00092 00093 /** boundx specifies horizontal bounding box. If text won't fit in 00094 * the space specified by boundx (world coordinates) text isn't drawn 00095 */ 00096 00097 void drawtext(float xc, 00098 float yc, 00099 const char *text, 00100 float boundx); 00101 void clearscreen(void); /**< Erases the screen */ 00102 00103 00104 /**@{*/ 00105 /* Functions for creating and destroying extra menu buttons. */ 00106 00107 void create_button(char *prev_button_text, 00108 char *button_text, 00109 void (*button_func) (void (*drawscreen) (void))); 00110 void destroy_button(char *button_text); 00111 /**@}*/ 00112 00113 00114 /** Opens file for postscript commands and initializes it. All subsequent 00115 * drawing commands go to this file until close_postscript is called. 00116 */ 00117 00118 int init_postscript(char *fname); /**< Returns 1 if successful */ 00119 00120 /** Closes file and directs output to screen again. */ 00121 00122 void close_postscript(void);