1 /* $Id: draw.h,v 1.45 1997/05/23 16:41:17 balay 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 #define DRAW_WHITE 0 19 #define DRAW_BLACK 1 20 #define DRAW_RED 2 21 #define DRAW_GREEN 3 22 #define DRAW_CYAN 4 23 #define DRAW_BLUE 5 24 #define DRAW_MAGENTA 6 25 #define DRAW_AQUAMARINE 7 26 #define DRAW_FORESTGREEN 8 27 #define DRAW_ORANGE 9 28 #define DRAW_VIOLET 10 29 #define DRAW_BROWN 11 30 #define DRAW_PINK 12 31 #define DRAW_CORAL 13 32 #define DRAW_GRAY 14 33 #define DRAW_YELLOW 15 34 35 extern int DrawOpenX(MPI_Comm,char *,char *,int,int,int,int,Draw*); 36 extern int DrawOpenVRML( MPI_Comm, char *, char *, Draw * ); 37 38 extern int DrawOpenNull(MPI_Comm,Draw *); 39 extern int DrawDestroy(Draw); 40 extern int DrawIsNull(Draw,PetscTruth*); 41 42 extern int DrawCreatePopUp(Draw,Draw*); 43 extern int DrawCheckResizedWindow(Draw); 44 extern int DrawResizeWindow(Draw,int,int); 45 46 extern int DrawScalePopup(Draw,double min,double max); 47 48 extern int DrawLine(Draw,double,double,double,double,int); 49 extern int DrawLineSetWidth(Draw,double); 50 extern int DrawLineGetWidth(Draw,double*); 51 52 extern int DrawPoint(Draw,double,double,int); 53 extern int DrawPointSetSize(Draw,double); 54 55 extern int DrawRectangle(Draw,double,double,double,double,int,int,int,int); 56 extern int DrawTriangle(Draw,double,double,double,double,double,double,int,int,int); 57 extern int DrawTensorContourPatch(Draw,int,int,double*,double*,double,double,Scalar*); 58 59 extern int DrawString(Draw,double,double,int,char*); 60 extern int DrawStringVertical(Draw,double,double,int,char*); 61 extern int DrawStringSetSize(Draw,double,double); 62 extern int DrawStringGetSize(Draw,double*,double*); 63 64 extern int DrawSetViewPort(Draw,double,double,double,double); 65 extern int DrawSetCoordinates(Draw,double,double,double,double); 66 extern int DrawGetCoordinates(Draw,double*,double*,double*,double*); 67 68 extern int DrawSetTitle(Draw,char *); 69 extern int DrawAppendTitle(Draw,char *); 70 extern int DrawGetTitle(Draw,char **); 71 72 extern int DrawSetPause(Draw,int); 73 extern int DrawGetPause(Draw,int*); 74 extern int DrawPause(Draw); 75 extern int DrawSetDoubleBuffer(Draw); 76 extern int DrawFlush(Draw); 77 extern int DrawSyncFlush(Draw); 78 extern int DrawClear(Draw); 79 extern int DrawSyncClear(Draw); 80 extern int DrawBOP(Draw); 81 extern int DrawEOP(Draw); 82 83 typedef enum {BUTTON_NONE, BUTTON_LEFT, BUTTON_CENTER, BUTTON_RIGHT } DrawButton; 84 extern int DrawGetMouseButton(Draw,DrawButton *,double*,double *,double *,double *); 85 86 /* 87 Routines for drawing X-Y axises in a Draw object 88 */ 89 typedef struct _p_DrawAxis* DrawAxis; 90 #define DRAWAXIS_COOKIE PETSC_COOKIE+16 91 extern int DrawAxisCreate(Draw,DrawAxis *); 92 extern int DrawAxisDestroy(DrawAxis); 93 extern int DrawAxisDraw(DrawAxis); 94 extern int DrawAxisSetLimits(DrawAxis,double,double,double,double); 95 extern int DrawAxisSetColors(DrawAxis,int,int,int); 96 extern int DrawAxisSetLabels(DrawAxis,char*,char*,char*); 97 98 /* 99 Routines to draw line curves in X-Y space 100 */ 101 typedef struct _p_DrawLG* DrawLG; 102 #define DRAWLG_COOKIE PETSC_COOKIE+7 103 extern int DrawLGCreate(Draw,int,DrawLG *); 104 extern int DrawLGDestroy(DrawLG); 105 extern int DrawLGAddPoint(DrawLG,double*,double*); 106 extern int DrawLGAddPoints(DrawLG,int,double**,double**); 107 extern int DrawLGDraw(DrawLG); 108 extern int DrawLGReset(DrawLG); 109 extern int DrawLGSetDimension(DrawLG,int); 110 extern int DrawLGGetAxis(DrawLG,DrawAxis *); 111 extern int DrawLGGetDraw(DrawLG,Draw *); 112 extern int DrawLGIndicateDataPoints(DrawLG); 113 extern int DrawLGSetLimits(DrawLG,double,double,double,double); 114 115 /* 116 Routines to draw scatter plots in complex space 117 */ 118 typedef struct _p_DrawSP* DrawSP; 119 #define DRAWSP_COOKIE PETSC_COOKIE+27 120 extern int DrawSPCreate(Draw,int,DrawSP *); 121 extern int DrawSPDestroy(DrawSP); 122 extern int DrawSPAddPoint(DrawSP,double*,double*); 123 extern int DrawSPAddPoints(DrawSP,int,double**,double**); 124 extern int DrawSPDraw(DrawSP); 125 extern int DrawSPReset(DrawSP); 126 extern int DrawSPSetDimension(DrawSP,int); 127 extern int DrawSPGetAxis(DrawSP,DrawAxis *); 128 extern int DrawSPGetDraw(DrawSP,Draw *); 129 extern int DrawSPSetLimits(DrawSP,double,double,double,double); 130 131 /* 132 Viewer routines that allow you to access underlying Draw objects 133 */ 134 extern int ViewerDrawGetDraw(Viewer, Draw*); 135 extern int ViewerDrawGetDrawLG(Viewer, DrawLG*); 136 137 /* Mesh management routines */ 138 typedef struct _p_DrawMesh* DrawMesh; 139 int DrawMeshCreate( DrawMesh *, 140 double *, double *, double *, 141 int, int, int, int, int, int, int, int, int, 142 int, int, int, int, double *, int ); 143 int DrawMeshCreateSimple( DrawMesh *, double *, double *, double *, 144 int, int, int, int, double *, int ); 145 int DrawMeshDestroy( DrawMesh * ); 146 147 /* Color spectrum managment */ 148 typedef void (*VRMLGetHue_fcn)( double, void *, int, double *, double *, 149 double * ); 150 151 void *VRMLFindHue_setup( DrawMesh, int ); 152 void VRMLFindHue( double, void *, int, double *, double *, double * ); 153 void VRMLFindHue_destroy( void * ); 154 void *VRMLGetHue_setup( DrawMesh, int ); 155 void VRMLGetHue( double, void *, int, double *, double *, double * ); 156 void VRMLGetHue_destroy( void * ); 157 158 159 int DrawTensorSurfaceContour(Draw,DrawMesh,VRMLGetHue_fcn, void *, int ); 160 int DrawTensorMapMesh( Draw, DrawMesh, double, double, double, int, int ); 161 int DrawTensorMapSurfaceContour(Draw,DrawMesh,double,double,double, 162 int,int, VRMLGetHue_fcn, void *, int,double); 163 int DrawTensorSurface(Draw, DrawMesh, int); 164 /*int DrawTensorMapSurfaceContourAndMesh_VRML(Draw,DrawMesh,int); */ 165 166 #endif 167