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