/* * File: xdisplay.h * Last modified on Fri Jul 22 12:24:59 1994 by eroberts * ----------------------------------------------------- * This interface is responsible for the actual display operations * of the X manager phase of the graphics.c implementation. In many * cases, the functions in this interface are similar to those in * the client interface to the graphics library. The graphics.h * interface, for example, contains DrawLine and DrawArc; this * interface exports DisplayLine and DisplayArc. The difference * is that the graphics.h functions simply send commands down a * communication channel, while the xdisplay.h functions actually * perform the rendering operations for the X window manager. */ #ifndef _xdisplay_h #define _xdisplay_h #include "genlib.h" /* * Function: OpenDisplay * Usage: OpenDisplay(title); * -------------------------- * This function creates a display window and performs all the * necessary initialization for the X system. The title string * is displayed in the title bar. */ void OpenDisplay(string title); /* * Function: CloseDisplay * Usage: CloseDisplay(); * ---------------------- * This function closes the graphics window and frees all of the * X storage. */ void CloseDisplay(void); /* * Function: DisplayFD * Usage: fd = DisplayFD(); * ------------------------ * This function returns the Unix file descriptor of the X * connection to the graphics window display. */ int DisplayFD(void); /* * Function: ProcessXEvent * Usage: if (ProcessXEvent()) . . . * --------------------------------- * This function checks to see if there is a pending X event * and, if so, processes that event. The function returns * TRUE if an event was detected and FALSE if no events were * pending so that the client can set a timeout before testing * again for another event. */ bool ProcessXEvent(void); /* * Function: CheckForRedraw * Usage: CheckForRedraw(); * ------------------------ * This function checks to see if the window needs redrawing and, * if so, issues the X commands to update the screen. */ void CheckForRedraw(void); /* * Function: SetRedrawFlag * Usage: SetRedrawFlag(); * ----------------------- * This function informs the X display module that the screen needs * to be redrawn. */ void SetRedrawFlag(void); /* * Function: ClearDisplay * Usage: ClearDisplay(); * ---------------------- * ClearDisplay erases the entire contents of the graphics window. */ void ClearDisplay(void); /* * Function: DisplayLine * Usage: DisplayLine(x, y, dx, dy); * --------------------------------- * This function draws a line from (x, y) to (x+dx, y+dy). */ void DisplayLine(double x, double y, double dx, double dy); /* * Function: DisplayArc * Usage: DisplayArc(x, y, rx, ry, start, sweep); * ---------------------------------------------- * This function draws an elliptical arc segment centered at * (x, y) with cartesian radii rx and ry. Note that the * interpretation of (x, y) is not the current point as * it is in the DrawArc call. The start and sweep parameters * are interpreted as they are in DrawArc. */ void DisplayArc(double x, double y, double rx, double ry, double start, double sweep); /* * Function: DisplayText * Usage: DisplayText(x, y, text); * ------------------------------- * This function displays the string text at (x, y) using the * current font and size. */ void DisplayText(double x, double y, string text); /* * Function: DisplayTextWidth * Usage: width = DisplayTextWidth(text); * -------------------------------------- * This function returns the width of the text string at the * current font and size. */ double DisplayTextWidth(string text); /* * Function: DisplaySetFont * Usage: str = DisplaySetFont(font, size); * ---------------------------------------- * This function finds the appropriate font and size to use based * on the users request and returns a string consisting of the size * and font name separated by a space. */ string DisplaySetFont(string font, int size); /* * Function: DisplaySetTitle * Usage: DisplaySetTitle(title); * ------------------------------ * This function sets the title bar for the window. */ void DisplaySetTitle(string title); /* * Function: DisplaySetEraseMode * Usage: DisplaySetEraseMode(flag); * --------------------------------- * This function sets the erase mode setting according to the * Boolean flag. */ void DisplaySetEraseMode(bool flag); /* * Function: DisplayStartRegion * Usage: DisplayStartRegion(grayScale); * ------------------------------------- * The DisplayStartRegion function sets the internal state so * that subsequent calls to DisplayLine and DisplayArc (which * have already been checked by the client to ensure that they * form a connected path) are used to create a fillable polygon. * The region is displayed by the corresponding DisplayEndRegion. */ void DisplayStartRegion(double grayScale); /* * Function: DisplayEndRegion * Usage: DisplayEndRegion(); * -------------------------- * This function closes the region opened by DisplayStartRegion. */ void DisplayEndRegion(void); /* * Functions: DisplayGetWidth, DisplayGetHeight * Usage: width = DisplayGetWidth(); * height = DisplayGetHeight(); * ----------------------------------- * These functions return the width and height of the X display. */ double DisplayGetWidth(void); double DisplayGetHeight(void); #endif