File: mpe_graphics.h

package info (click to toggle)
mpich 1.1.0-3
  • links: PTS
  • area: main
  • in suites: hamm
  • size: 22,116 kB
  • ctags: 27,349
  • sloc: ansic: 193,435; sh: 11,172; fortran: 6,545; makefile: 5,801; cpp: 5,020; tcl: 3,548; asm: 3,536; csh: 1,079; java: 614; perl: 183; awk: 168; sed: 70; f90: 62
file content (181 lines) | stat: -rw-r--r-- 6,122 bytes parent folder | download | duplicates (3)
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
#ifndef _MPE_GRAPHICS_
#define _MPE_GRAPHICS_

#ifdef MPE_NOMPI
typedef int MPI_Comm;
#else
#include "mpi.h"
#endif

#if defined(NEEDS_STDLIB_PROTOTYPES)
#include "protofix.h"
#endif

#ifndef ANSI_ARGS
#if defined(__STDC__) || defined(__cplusplus) || defined(HAVE_PROTOTYPES)
#define ANSI_ARGS(a) a
#else
#define ANSI_ARGS(a) ()
#endif
#endif

/* See colornames in baseclr.h */
typedef enum { MPE_WHITE = 0, MPE_BLACK = 1, MPE_RED = 2, MPE_YELLOW = 3, 
	       MPE_GREEN = 4, MPE_CYAN = 5, MPE_BLUE = 6, MPE_MAGENTA = 7,
               MPE_AQUAMARINE = 8, MPE_FORESTGREEN = 9, MPE_ORANGE = 10, 
	       MPE_MAROON = 11, MPE_BROWN = 12, MPE_PINK = 13, MPE_CORAL = 14, 
               MPE_GRAY = 15} MPE_Color;

extern int MPE_buttonArray[];
extern int MPE_logicArray[];

  /* given existing pixel 'dst' and new, overlapping pixel 'src' */
#define MPE_LOGIC_CLEAR        (MPE_logicArray[0])
#define MPE_LOGIC_AND          (MPE_logicArray[1])
#define MPE_LOGIC_ANDREVERSE   (MPE_logicArray[2])
#define MPE_LOGIC_COPY         (MPE_logicArray[3])
#define MPE_LOGIC_ANDINVERTED  (MPE_logicArray[4])
#define MPE_LOGIC_NOOP         (MPE_logicArray[5])
#define MPE_LOGIC_XOR          (MPE_logicArray[6])
#define MPE_LOGIC_OR           (MPE_logicArray[7])
#define MPE_LOGIC_NOR          (MPE_logicArray[8])
#define MPE_LOGIC_EQUIV        (MPE_logicArray[9])
#define MPE_LOGIC_INVERT       (MPE_logicArray[10])
#define MPE_LOGIC_ORREVERSE    (MPE_logicArray[11])
#define MPE_LOGIC_COPYINVERTED (MPE_logicArray[12])
#define MPE_LOGIC_ORINVERTED   (MPE_logicArray[13])
#define MPE_LOGIC_NAND         (MPE_logicArray[14])
#define MPE_LOGIC_SET          (MPE_logicArray[15])

#define MPE_BUTTON1 (MPE_buttonArray[0])
#define MPE_BUTTON2 (MPE_buttonArray[1])
#define MPE_BUTTON3 (MPE_buttonArray[2])
#define MPE_BUTTON4 (MPE_buttonArray[3])
#define MPE_BUTTON5 (MPE_buttonArray[4])


/* types of visuals for Get_drag_region */
#define MPE_DRAG_NONE 0		     /* no visual */
#define MPE_DRAG_RECT 1		     /* rubber band box */
#define MPE_DRAG_LINE 2		     /* rubber band line */
#define MPE_DRAG_CIRCLE_RADIUS 3     /* rubber band circle, */
    /* one point is the center of the circle, other point is on the circle */
#define MPE_DRAG_CIRCLE_DIAMETER 4
    /* each point is on opposite sides of the circle */
#define MPE_DRAG_CIRCLE_BBOX 5
    /* the two points define a bounding box inside which is drawn a circle */
#define MPE_DRAG_OVAL_BBOX 6
    /* the two points define a bounding box inside which is drawn an oval */
#define MPE_DRAG_SQUARE 7


#ifdef MPE_INTERNAL
#include "mpetools.h"
#include "basex11.h"

typedef struct MPE_XGraph_s *MPE_XGraph;
struct MPE_XGraph_s {
  int      Cookie;
  XBWindow *xwin;
  int      backingStore;	/* NotUseful, WhenMapped, or Always */
  MPI_Comm comm;
  int      is_collective;
  char     *display_name;       /* Used to allow us to run other tools ... */
  char     *capture_file;       /* Used to capture output at update */
  int      capture_num, 
           capture_cnt, 
           capture_freq;
  /* 
     The following are for event-driven input.
     This simple interface allows an advanced user to always watch for
     certain events (like keypress) without requiring all code 
     We also need to define a wait-for-user-event routine 

     The alternative is to have a chain of event handlers; adding one
     creates a new entry in the chain.  For this, there needs to be
     an event_routine structure, that has (user routine) and (next).
   */
  long     input_mask;          /* Input mask of enabled events */
    /* Routine to call for events */
  int      (*event_routine) ANSI_ARGS(( MPE_XGraph, XEvent * ));  
};
#define MPE_G_COOKIE 0xfeeddada

#define MPE_XEVT_IDLE_MASK 0
/* normal XEvent mask; what it should be set to during normal processing */
/* Eventually, this should be ExposureMask or more */

#else

typedef void *MPE_XGraph;

#endif

typedef struct MPE_Point_ {
  int x, y;
  MPE_Color c;
} MPE_Point;

#define MPE_GRAPH_INDEPDENT  0
#define MPE_GRAPH_COLLECTIVE 1

extern int MPE_Open_graphics ANSI_ARGS(( MPE_XGraph *handle, MPI_Comm comm, 
	   char *display, int x, int y, int w, int h, int is_collective ));

extern int MPE_Get_mouse_press ANSI_ARGS(( MPE_XGraph graph,
           int *x, int *y, int *button ));

extern int MPE_Draw_point ANSI_ARGS(( MPE_XGraph handle, int x, int y,
	   MPE_Color color ));

extern int MPE_Draw_line ANSI_ARGS(( MPE_XGraph handle, int x1, int y1,
	   int x2, int y2, MPE_Color color ));

extern int MPE_Draw_circle ANSI_ARGS(( MPE_XGraph, int, int, int, MPE_Color ));

extern int MPE_Draw_string ANSI_ARGS(( MPE_XGraph, int, int, MPE_Color,
				       char * ));

extern int MPE_Fill_rectangle ANSI_ARGS(( MPE_XGraph handle, int x, int y,
	   int w, int h, MPE_Color color ));

extern int MPE_Update ANSI_ARGS(( MPE_XGraph handle ));

extern int MPE_Num_colors ANSI_ARGS(( MPE_XGraph handle, int *nc ));

extern int MPE_Make_color_array ANSI_ARGS(( MPE_XGraph handle, int ncolors, 
	   MPE_Color array[] ));

extern int MPE_Close_graphics ANSI_ARGS(( MPE_XGraph *handle ));

extern int MPE_CaptureFile ANSI_ARGS(( MPE_XGraph, char *, int ));

extern int MPE_Draw_points ANSI_ARGS(( MPE_XGraph, MPE_Point *, int ));

extern int MPE_Fill_circle ANSI_ARGS(( MPE_XGraph, int, int, int, MPE_Color ));

extern int MPE_Draw_logic  ANSI_ARGS(( MPE_XGraph, int ));

extern int MPE_Line_thickness ANSI_ARGS(( MPE_XGraph, int ));

extern int MPE_Draw_dashes ANSI_ARGS(( MPE_XGraph, int ));

extern int MPE_Dash_offset ANSI_ARGS(( MPE_XGraph, int ));

extern int MPE_Add_RGB_color ANSI_ARGS(( MPE_XGraph, int, int, int, 
					 MPE_Color * ));

extern int MPE_Xerror ANSI_ARGS(( int, char * ));

/* xmouse */
extern int MPE_Get_mouse_press ANSI_ARGS(( MPE_XGraph, int *, int *, int * ));
extern int MPE_Iget_mouse_press ANSI_ARGS(( MPE_XGraph, int *, int *, int *,
					    int * ));
extern int MPE_Get_drag_region ANSI_ARGS(( MPE_XGraph, int, int, 
					   int *, int *, int *, int * ));
extern int MPE_Get_drag_region_fixratio ANSI_ARGS(( MPE_XGraph, int, double, 
						    int *, int *, 
						    int *, int * ));

#endif