xref: /petsc/include/petscdraw.h (revision 7d207646e9b2b9d1fc54cf73ea60d8c45e97e1b0)
1 /* $Id: draw.h,v 1.54 1998/05/13 17:57:51 bsmith Exp bsmith $ */
2 /*
3   Interface to the graphics
4 */
5 #if !defined(__DRAW_PACKAGE)
6 #define __DRAW_PACKAGE
7 #include "petsc.h"
8 
9 #define DRAW_COOKIE PETSC_COOKIE+6
10 
11 /* types of draw contexts */
12 #define DRAW_XWINDOW    0
13 #define DRAW_NULLWINDOW 1
14 #define DRAW_VRML       2
15 
16 typedef struct _p_Draw* Draw;
17 
18 /*
19    Number of basic colors in the draw routines, the others are used
20    for a uniform colormap.
21 */
22 #define DRAW_BASIC_COLORS 32
23 
24 #define DRAW_ROTATE          -1         /* will rotate through the colors, start with 2 */
25 #define DRAW_WHITE            0
26 #define DRAW_BLACK            1
27 #define DRAW_RED              2
28 #define DRAW_GREEN            3
29 #define DRAW_CYAN             4
30 #define DRAW_BLUE             5
31 #define DRAW_MAGENTA          6
32 #define DRAW_AQUAMARINE       7
33 #define DRAW_FORESTGREEN      8
34 #define DRAW_ORANGE           9
35 #define DRAW_VIOLET          10
36 #define DRAW_BROWN           11
37 #define DRAW_PINK            12
38 #define DRAW_CORAL           13
39 #define DRAW_GRAY            14
40 #define DRAW_YELLOW          15
41 
42 #define DRAW_GOLD            16
43 #define DRAW_LIGHTPINK       17
44 #define DRAW_MEDIUMTURQUOISE 18
45 #define DRAW_KHAKI           19
46 #define DRAW_DIMGRAY         20
47 #define DRAW_YELLOWGREEN     21
48 #define DRAW_SKYBLUE         22
49 #define DRAW_DARKGREEN       23
50 #define DRAW_NAVYBLUE        24
51 #define DRAW_SANDYBROWN      25
52 #define DRAW_CADETBLUE       26
53 #define DRAW_POWDERBLUE      27
54 #define DRAW_DEEPPINK        28
55 #define DRAW_THISTLE         29
56 #define DRAW_LIMEGREEN       30
57 #define DRAW_LAVENDERBLUSH   31
58 
59 
60 extern int DrawOpenX(MPI_Comm,char *,char *,int,int,int,int,Draw*);
61 extern int DrawOpenVRML( MPI_Comm, char *, char *, Draw * );
62 
63 extern int DrawOpenNull(MPI_Comm,Draw *);
64 extern int DrawDestroy(Draw);
65 extern int DrawIsNull(Draw,PetscTruth*);
66 
67 extern int DrawGetPopup(Draw,Draw*);
68 extern int DrawCheckResizedWindow(Draw);
69 extern int DrawResizeWindow(Draw,int,int);
70 
71 extern int DrawScalePopup(Draw,double min,double max);
72 
73 extern int DrawLine(Draw,double,double,double,double,int);
74 extern int DrawLineSetWidth(Draw,double);
75 extern int DrawLineGetWidth(Draw,double*);
76 
77 extern int DrawPoint(Draw,double,double,int);
78 extern int DrawPointSetSize(Draw,double);
79 
80 extern int DrawRectangle(Draw,double,double,double,double,int,int,int,int);
81 extern int DrawTriangle(Draw,double,double,double,double,double,double,int,int,int);
82 extern int DrawTensorContourPatch(Draw,int,int,double*,double*,double,double,Scalar*);
83 #define DrawContourScale(c)  ((int) ((double) c + (245.-DRAW_BASIC_COLORS)/9.))
84 
85 extern int DrawString(Draw,double,double,int,char*);
86 extern int DrawStringVertical(Draw,double,double,int,char*);
87 extern int DrawStringSetSize(Draw,double,double);
88 extern int DrawStringGetSize(Draw,double*,double*);
89 
90 extern int DrawSetViewPort(Draw,double,double,double,double);
91 extern int DrawSplitViewPort(Draw);
92 
93 extern int DrawSetCoordinates(Draw,double,double,double,double);
94 extern int DrawGetCoordinates(Draw,double*,double*,double*,double*);
95 
96 extern int DrawSetTitle(Draw,char *);
97 extern int DrawAppendTitle(Draw,char *);
98 extern int DrawGetTitle(Draw,char **);
99 
100 extern int DrawSetPause(Draw,int);
101 extern int DrawGetPause(Draw,int*);
102 extern int DrawPause(Draw);
103 extern int DrawSetDoubleBuffer(Draw);
104 extern int DrawFlush(Draw);
105 extern int DrawSynchronizedFlush(Draw);
106 extern int DrawClear(Draw);
107 extern int DrawSynchronizedClear(Draw);
108 extern int DrawBOP(Draw);
109 extern int DrawEOP(Draw);
110 
111 typedef enum {BUTTON_NONE, BUTTON_LEFT, BUTTON_CENTER, BUTTON_RIGHT } DrawButton;
112 extern int DrawGetMouseButton(Draw,DrawButton *,double*,double *,double *,double *);
113 extern int DrawSynchronizedGetMouseButton(Draw,DrawButton *,double*,double *,double *,double *);
114 
115 extern int DrawZoom(Draw,int (*)(Draw,void *),void *);
116 /*
117     Routines for drawing X-Y axises in a Draw object
118 */
119 typedef struct _p_DrawAxis* DrawAxis;
120 #define DRAWAXIS_COOKIE PETSC_COOKIE+16
121 extern int DrawAxisCreate(Draw,DrawAxis *);
122 extern int DrawAxisDestroy(DrawAxis);
123 extern int DrawAxisDraw(DrawAxis);
124 extern int DrawAxisSetLimits(DrawAxis,double,double,double,double);
125 extern int DrawAxisSetColors(DrawAxis,int,int,int);
126 extern int DrawAxisSetLabels(DrawAxis,char*,char*,char*);
127 
128 /*
129     Routines to draw line curves in X-Y space
130 */
131 typedef struct _p_DrawLG*   DrawLG;
132 #define DRAWLG_COOKIE PETSC_COOKIE+7
133 extern int DrawLGCreate(Draw,int,DrawLG *);
134 extern int DrawLGDestroy(DrawLG);
135 extern int DrawLGAddPoint(DrawLG,double*,double*);
136 extern int DrawLGAddPoints(DrawLG,int,double**,double**);
137 extern int DrawLGDraw(DrawLG);
138 extern int DrawLGReset(DrawLG);
139 extern int DrawLGSetDimension(DrawLG,int);
140 extern int DrawLGGetAxis(DrawLG,DrawAxis *);
141 extern int DrawLGGetDraw(DrawLG,Draw *);
142 extern int DrawLGIndicateDataPoints(DrawLG);
143 extern int DrawLGSetLimits(DrawLG,double,double,double,double);
144 
145 /*
146     Routines to draw scatter plots in complex space
147 */
148 typedef struct _p_DrawSP*   DrawSP;
149 #define DRAWSP_COOKIE PETSC_COOKIE+27
150 extern int DrawSPCreate(Draw,int,DrawSP *);
151 extern int DrawSPDestroy(DrawSP);
152 extern int DrawSPAddPoint(DrawSP,double*,double*);
153 extern int DrawSPAddPoints(DrawSP,int,double**,double**);
154 extern int DrawSPDraw(DrawSP);
155 extern int DrawSPReset(DrawSP);
156 extern int DrawSPSetDimension(DrawSP,int);
157 extern int DrawSPGetAxis(DrawSP,DrawAxis *);
158 extern int DrawSPGetDraw(DrawSP,Draw *);
159 extern int DrawSPSetLimits(DrawSP,double,double,double,double);
160 
161 /*
162     Routines to draw histograms
163 */
164 typedef struct _p_DrawHist*   DrawHist;
165 
166 extern int DrawHistCreate(Draw, int, DrawHist *);
167 extern int DrawHistDestroy(DrawHist);
168 extern int DrawHistAddValue(DrawHist, double);
169 extern int DrawHistDraw(DrawHist);
170 extern int DrawHistReset(DrawHist);
171 extern int DrawHistGetAxis(DrawHist, DrawAxis *);
172 extern int DrawHistGetDraw(DrawHist, Draw *);
173 extern int DrawHistSetLimits(DrawHist, double, double, int, int);
174 extern int DrawHistSetNumberBins(DrawHist, int);
175 extern int DrawHistSetColor(DrawHist,int);
176 
177 /*
178     Viewer routines that allow you to access underlying Draw objects
179 */
180 extern int ViewerDrawGetDraw(Viewer, Draw*);
181 extern int ViewerDrawGetDrawLG(Viewer, DrawLG*);
182 extern int ViewerDrawGetDrawAxis(Viewer, DrawAxis*);
183 
184 /* Mesh management routines */
185 typedef struct _p_DrawMesh* DrawMesh;
186 int DrawMeshCreate( DrawMesh *,
187 		    double *, double *, double *,
188 		    int, int, int, int, int, int, int, int, int,
189 		    int, int, int, int, double *, int );
190 int DrawMeshCreateSimple( DrawMesh *, double *, double *, double *,
191 			  int, int, int, int, double *, int );
192 int DrawMeshDestroy( DrawMesh * );
193 
194 /* Color spectrum managment */
195 typedef void (*VRMLGetHue_fcn)( double, void *, int, double *, double *,
196 				double * );
197 
198 void *VRMLFindHue_setup( DrawMesh, int );
199 void VRMLFindHue( double, void *, int, double *, double *, double * );
200 void VRMLFindHue_destroy( void * );
201 void *VRMLGetHue_setup( DrawMesh, int );
202 void VRMLGetHue( double, void *, int, double *, double *, double * );
203 void VRMLGetHue_destroy( void * );
204 
205 
206 int DrawTensorSurfaceContour(Draw,DrawMesh,VRMLGetHue_fcn, void *, int );
207 int DrawTensorMapMesh( Draw, DrawMesh, double, double, double, int, int );
208 int DrawTensorMapSurfaceContour(Draw,DrawMesh,double,double,double,
209 				int,int, VRMLGetHue_fcn, void *, int,double);
210 int DrawTensorSurface(Draw, DrawMesh, int);
211 /*int DrawTensorMapSurfaceContourAndMesh_VRML(Draw,DrawMesh,int); */
212 
213 #endif
214