-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgraphics.h
93 lines (82 loc) · 2.45 KB
/
graphics.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
/*
* File: graphics.h
* ----------------
* Contains definitions for the public graphing functions.
*
* CME212 Assignment 5
* Oliver Fringer
* Stanford University
*
*/
#ifndef _graphics_h
#define _graphics_h
#include <X11/Xlib.h>
#include <X11/keysym.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
void FlushDisplay(void);
void CloseDisplay(void);
/*
* Function: CheckForQuit
* Usage: while(!CheckForQuite()) {...
* -----------------------------------
* Closes the window when the users hits the q key.
*
*/
int CheckForQuit(void);
/*
* Function: Refresh
* Usage: Refresh();
* -----------------
* Copy the pixel buffer to the window and flush the display. Graphics objects
* plotted to the window will not appear on the display unless this function is
* used.
*
*/
void Refresh(void);
/*
* Function: ClearScreen
* Usage: ClearScreen();
* ---------------------
* Fills the plotting window with black and effectively clears the
* plotting screen.
*
*/
void ClearScreen(void);
void DrawRectangle(float x, float y, float W, float H, float dx, float dy, float color, int iicolor );
void DrawText( int x, int y, const char* text );
/*
* Function: DrawCircle
* Usage: DrawCircle(x,y,W,H,r,fillcolor);
* ---------------------------------------
* Draws the circle with radius r centered about x,y in the window
* of width W and height H. The circle is filled with the grayscale color defined
* in the range specified in the SetCAxes command. Since there are 256 colors,
* if the grayscale axes are set with SetCAxes(.1,.5), then a value of fillcolor
* of .25 will given grayscale color number (.25-.1)/.5*NUMCOLORS. a fillcolor of
* 0 is white, while 1 is black.
*
*/
void DrawCircle(float x, float y, float W, float H, float radius, float color, int iicolor);
/*
* Function: InitializeGraphics
* Usage: InitializeGraphics(argv[0],800,800);
* -------------------------------------------
* Opens up a graphics window with the specified dimensions in pixels for plotting
* with the upper left hand corner of the graphics window appearing in the
* upper left hand corner of the display.
*
* The command argument argv[0] or equivalent is used to return errors.
*
*/
void InitializeGraphics(char *command, int windowWidth, int windowHeight);
/*
* Function: SetCAxes
* Usage: SetCAxes(0,1);
* ---------------------
* Sets the grayscale color axes. See DrawCircle for details.
*
*/
void SetCAxes(float cmin, float cmax);
#endif