1 /* $Id: draw.h,v 1.46 1997/08/06 22:13:42 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 #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 extern int DrawSyncGetMouseButton(Draw,DrawButton *,double*,double *,double *,double *); 86 87 /* 88 Routines for drawing X-Y axises in a Draw object 89 */ 90 typedef struct _p_DrawAxis* DrawAxis; 91 #define DRAWAXIS_COOKIE PETSC_COOKIE+16 92 extern int DrawAxisCreate(Draw,DrawAxis *); 93 extern int DrawAxisDestroy(DrawAxis); 94 extern int DrawAxisDraw(DrawAxis); 95 extern int DrawAxisSetLimits(DrawAxis,double,double,double,double); 96 extern int DrawAxisSetColors(DrawAxis,int,int,int); 97 extern int DrawAxisSetLabels(DrawAxis,char*,char*,char*); 98 99 /* 100 Routines to draw line curves in X-Y space 101 */ 102 typedef struct _p_DrawLG* DrawLG; 103 #define DRAWLG_COOKIE PETSC_COOKIE+7 104 extern int DrawLGCreate(Draw,int,DrawLG *); 105 extern int DrawLGDestroy(DrawLG); 106 extern int DrawLGAddPoint(DrawLG,double*,double*); 107 extern int DrawLGAddPoints(DrawLG,int,double**,double**); 108 extern int DrawLGDraw(DrawLG); 109 extern int DrawLGReset(DrawLG); 110 extern int DrawLGSetDimension(DrawLG,int); 111 extern int DrawLGGetAxis(DrawLG,DrawAxis *); 112 extern int DrawLGGetDraw(DrawLG,Draw *); 113 extern int DrawLGIndicateDataPoints(DrawLG); 114 extern int DrawLGSetLimits(DrawLG,double,double,double,double); 115 116 /* 117 Routines to draw scatter plots in complex space 118 */ 119 typedef struct _p_DrawSP* DrawSP; 120 #define DRAWSP_COOKIE PETSC_COOKIE+27 121 extern int DrawSPCreate(Draw,int,DrawSP *); 122 extern int DrawSPDestroy(DrawSP); 123 extern int DrawSPAddPoint(DrawSP,double*,double*); 124 extern int DrawSPAddPoints(DrawSP,int,double**,double**); 125 extern int DrawSPDraw(DrawSP); 126 extern int DrawSPReset(DrawSP); 127 extern int DrawSPSetDimension(DrawSP,int); 128 extern int DrawSPGetAxis(DrawSP,DrawAxis *); 129 extern int DrawSPGetDraw(DrawSP,Draw *); 130 extern int DrawSPSetLimits(DrawSP,double,double,double,double); 131 132 /* 133 Viewer routines that allow you to access underlying Draw objects 134 */ 135 extern int ViewerDrawGetDraw(Viewer, Draw*); 136 extern int ViewerDrawGetDrawLG(Viewer, DrawLG*); 137 138 /* Mesh management routines */ 139 typedef struct _p_DrawMesh* DrawMesh; 140 int DrawMeshCreate( DrawMesh *, 141 double *, double *, double *, 142 int, int, int, int, int, int, int, int, int, 143 int, int, int, int, double *, int ); 144 int DrawMeshCreateSimple( DrawMesh *, double *, double *, double *, 145 int, int, int, int, double *, int ); 146 int DrawMeshDestroy( DrawMesh * ); 147 148 /* Color spectrum managment */ 149 typedef void (*VRMLGetHue_fcn)( double, void *, int, double *, double *, 150 double * ); 151 152 void *VRMLFindHue_setup( DrawMesh, int ); 153 void VRMLFindHue( double, void *, int, double *, double *, double * ); 154 void VRMLFindHue_destroy( void * ); 155 void *VRMLGetHue_setup( DrawMesh, int ); 156 void VRMLGetHue( double, void *, int, double *, double *, double * ); 157 void VRMLGetHue_destroy( void * ); 158 159 160 int DrawTensorSurfaceContour(Draw,DrawMesh,VRMLGetHue_fcn, void *, int ); 161 int DrawTensorMapMesh( Draw, DrawMesh, double, double, double, int, int ); 162 int DrawTensorMapSurfaceContour(Draw,DrawMesh,double,double,double, 163 int,int, VRMLGetHue_fcn, void *, int,double); 164 int DrawTensorSurface(Draw, DrawMesh, int); 165 /*int DrawTensorMapSurfaceContourAndMesh_VRML(Draw,DrawMesh,int); */ 166 167 #endif 168