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