xref: /petsc/include/petscdraw.h (revision c2ea1186303e6ad186d8293edcc4dffdc3bb3ffe)
1 /* $Id: draw.h,v 1.49 1997/10/03 17:17:14 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 DrawCreatePopUp(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 
84 extern int DrawString(Draw,double,double,int,char*);
85 extern int DrawStringVertical(Draw,double,double,int,char*);
86 extern int DrawStringSetSize(Draw,double,double);
87 extern int DrawStringGetSize(Draw,double*,double*);
88 
89 extern int DrawSetViewPort(Draw,double,double,double,double);
90 extern int DrawSplitViewPort(Draw);
91 
92 extern int DrawSetCoordinates(Draw,double,double,double,double);
93 extern int DrawGetCoordinates(Draw,double*,double*,double*,double*);
94 
95 extern int DrawSetTitle(Draw,char *);
96 extern int DrawAppendTitle(Draw,char *);
97 extern int DrawGetTitle(Draw,char **);
98 
99 extern int DrawSetPause(Draw,int);
100 extern int DrawGetPause(Draw,int*);
101 extern int DrawPause(Draw);
102 extern int DrawSetDoubleBuffer(Draw);
103 extern int DrawFlush(Draw);
104 extern int DrawSynchronizedFlush(Draw);
105 extern int DrawClear(Draw);
106 extern int DrawSynchronizedClear(Draw);
107 extern int DrawBOP(Draw);
108 extern int DrawEOP(Draw);
109 
110 typedef enum {BUTTON_NONE, BUTTON_LEFT, BUTTON_CENTER, BUTTON_RIGHT } DrawButton;
111 extern int DrawGetMouseButton(Draw,DrawButton *,double*,double *,double *,double *);
112 extern int DrawSynchronizedGetMouseButton(Draw,DrawButton *,double*,double *,double *,double *);
113 
114 /*
115     Routines for drawing X-Y axises in a Draw object
116 */
117 typedef struct _p_DrawAxis* DrawAxis;
118 #define DRAWAXIS_COOKIE PETSC_COOKIE+16
119 extern int DrawAxisCreate(Draw,DrawAxis *);
120 extern int DrawAxisDestroy(DrawAxis);
121 extern int DrawAxisDraw(DrawAxis);
122 extern int DrawAxisSetLimits(DrawAxis,double,double,double,double);
123 extern int DrawAxisSetColors(DrawAxis,int,int,int);
124 extern int DrawAxisSetLabels(DrawAxis,char*,char*,char*);
125 
126 /*
127     Routines to draw line curves in X-Y space
128 */
129 typedef struct _p_DrawLG*   DrawLG;
130 #define DRAWLG_COOKIE PETSC_COOKIE+7
131 extern int DrawLGCreate(Draw,int,DrawLG *);
132 extern int DrawLGDestroy(DrawLG);
133 extern int DrawLGAddPoint(DrawLG,double*,double*);
134 extern int DrawLGAddPoints(DrawLG,int,double**,double**);
135 extern int DrawLGDraw(DrawLG);
136 extern int DrawLGReset(DrawLG);
137 extern int DrawLGSetDimension(DrawLG,int);
138 extern int DrawLGGetAxis(DrawLG,DrawAxis *);
139 extern int DrawLGGetDraw(DrawLG,Draw *);
140 extern int DrawLGIndicateDataPoints(DrawLG);
141 extern int DrawLGSetLimits(DrawLG,double,double,double,double);
142 
143 /*
144     Routines to draw scatter plots in complex space
145 */
146 typedef struct _p_DrawSP*   DrawSP;
147 #define DRAWSP_COOKIE PETSC_COOKIE+27
148 extern int DrawSPCreate(Draw,int,DrawSP *);
149 extern int DrawSPDestroy(DrawSP);
150 extern int DrawSPAddPoint(DrawSP,double*,double*);
151 extern int DrawSPAddPoints(DrawSP,int,double**,double**);
152 extern int DrawSPDraw(DrawSP);
153 extern int DrawSPReset(DrawSP);
154 extern int DrawSPSetDimension(DrawSP,int);
155 extern int DrawSPGetAxis(DrawSP,DrawAxis *);
156 extern int DrawSPGetDraw(DrawSP,Draw *);
157 extern int DrawSPSetLimits(DrawSP,double,double,double,double);
158 
159 /*
160     Routines to draw histograms
161 */
162 typedef struct _p_DrawHist*   DrawHist;
163 
164 extern int DrawHistCreate(Draw, int, DrawHist *);
165 extern int DrawHistDestroy(DrawHist);
166 extern int DrawHistAddValue(DrawHist, double);
167 extern int DrawHistDraw(DrawHist);
168 extern int DrawHistReset(DrawHist);
169 extern int DrawHistGetAxis(DrawHist, DrawAxis *);
170 extern int DrawHistGetDraw(DrawHist, Draw *);
171 extern int DrawHistSetLimits(DrawHist, double, double, int, int);
172 extern int DrawHistSetNumberBins(DrawHist, int);
173 extern int DrawHistSetColor(DrawHist,int);
174 
175 /*
176     Viewer routines that allow you to access underlying Draw objects
177 */
178 extern int ViewerDrawGetDraw(Viewer, Draw*);
179 extern int ViewerDrawGetDrawLG(Viewer, DrawLG*);
180 
181 /* Mesh management routines */
182 typedef struct _p_DrawMesh* DrawMesh;
183 int DrawMeshCreate( DrawMesh *,
184 		    double *, double *, double *,
185 		    int, int, int, int, int, int, int, int, int,
186 		    int, int, int, int, double *, int );
187 int DrawMeshCreateSimple( DrawMesh *, double *, double *, double *,
188 			  int, int, int, int, double *, int );
189 int DrawMeshDestroy( DrawMesh * );
190 
191 /* Color spectrum managment */
192 typedef void (*VRMLGetHue_fcn)( double, void *, int, double *, double *,
193 				double * );
194 
195 void *VRMLFindHue_setup( DrawMesh, int );
196 void VRMLFindHue( double, void *, int, double *, double *, double * );
197 void VRMLFindHue_destroy( void * );
198 void *VRMLGetHue_setup( DrawMesh, int );
199 void VRMLGetHue( double, void *, int, double *, double *, double * );
200 void VRMLGetHue_destroy( void * );
201 
202 
203 int DrawTensorSurfaceContour(Draw,DrawMesh,VRMLGetHue_fcn, void *, int );
204 int DrawTensorMapMesh( Draw, DrawMesh, double, double, double, int, int );
205 int DrawTensorMapSurfaceContour(Draw,DrawMesh,double,double,double,
206 				int,int, VRMLGetHue_fcn, void *, int,double);
207 int DrawTensorSurface(Draw, DrawMesh, int);
208 /*int DrawTensorMapSurfaceContourAndMesh_VRML(Draw,DrawMesh,int); */
209 
210 #endif
211