Actual source code: drawimpl.h
petsc-3.13.6 2020-09-29
1: /*
2: Abstract data structure and functions for graphics.
3: */
5: #if !defined(_DRAWIMPL_H)
6: #define _DRAWIMPL_H
8: #include <petscdraw.h>
9: #include <petsc/private/petscimpl.h>
11: PETSC_EXTERN PetscBool PetscDrawRegisterAllCalled;
12: PETSC_EXTERN PetscErrorCode PetscDrawRegisterAll(void);
14: struct _PetscDrawOps {
15: PetscErrorCode (*setdoublebuffer)(PetscDraw);
16: PetscErrorCode (*flush)(PetscDraw);
17: PetscErrorCode (*line)(PetscDraw,PetscReal,PetscReal,PetscReal,PetscReal,int);
18: PetscErrorCode (*linesetwidth)(PetscDraw,PetscReal);
19: PetscErrorCode (*linegetwidth)(PetscDraw,PetscReal*);
20: PetscErrorCode (*point)(PetscDraw,PetscReal,PetscReal,int);
21: PetscErrorCode (*pointsetsize)(PetscDraw,PetscReal);
22: PetscErrorCode (*string)(PetscDraw,PetscReal,PetscReal,int,const char[]);
23: PetscErrorCode (*stringvertical)(PetscDraw,PetscReal,PetscReal,int,const char[]);
24: PetscErrorCode (*stringsetsize)(PetscDraw,PetscReal,PetscReal);
25: PetscErrorCode (*stringgetsize)(PetscDraw,PetscReal*,PetscReal*);
26: PetscErrorCode (*setviewport)(PetscDraw,PetscReal,PetscReal,PetscReal,PetscReal);
27: PetscErrorCode (*clear)(PetscDraw);
28: PetscErrorCode (*rectangle)(PetscDraw,PetscReal,PetscReal,PetscReal,PetscReal,int,int,int,int);
29: PetscErrorCode (*triangle)(PetscDraw,PetscReal,PetscReal,PetscReal,PetscReal,PetscReal,PetscReal,int,int,int);
30: PetscErrorCode (*ellipse)(PetscDraw,PetscReal,PetscReal,PetscReal,PetscReal,int);
31: PetscErrorCode (*getmousebutton)(PetscDraw,PetscDrawButton*,PetscReal *,PetscReal *,PetscReal*,PetscReal*);
32: PetscErrorCode (*pause)(PetscDraw);
33: PetscErrorCode (*beginpage)(PetscDraw);
34: PetscErrorCode (*endpage)(PetscDraw);
35: PetscErrorCode (*getpopup)(PetscDraw,PetscDraw*);
36: PetscErrorCode (*settitle)(PetscDraw,const char[]);
37: PetscErrorCode (*checkresizedwindow)(PetscDraw);
38: PetscErrorCode (*resizewindow)(PetscDraw,int,int);
39: PetscErrorCode (*destroy)(PetscDraw);
40: PetscErrorCode (*view)(PetscDraw,PetscViewer);
41: PetscErrorCode (*getsingleton)(PetscDraw,PetscDraw*);
42: PetscErrorCode (*restoresingleton)(PetscDraw,PetscDraw*);
43: PetscErrorCode (*save)(PetscDraw);
44: PetscErrorCode (*getimage)(PetscDraw,unsigned char[][3],unsigned int*,unsigned int*,unsigned char*[]);
45: PetscErrorCode (*setcoordinates)(PetscDraw,PetscReal,PetscReal,PetscReal,PetscReal);
46: PetscErrorCode (*arrow)(PetscDraw,PetscReal,PetscReal,PetscReal,PetscReal,int);
47: PetscErrorCode (*coordinatetopixel)(PetscDraw,PetscReal,PetscReal,int*,int*);
48: PetscErrorCode (*pixeltocoordinate)(PetscDraw,int,int,PetscReal*,PetscReal*);
49: PetscErrorCode (*pointpixel)(PetscDraw,int,int,int);
50: PetscErrorCode (*boxedstring)(PetscDraw,PetscReal,PetscReal,int,int,const char[],PetscReal*,PetscReal*);
51: };
53: struct _p_PetscDraw {
54: PETSCHEADER(struct _PetscDrawOps);
55: PetscReal pause; /* sleep time after a synchronized flush */
56: PetscReal port_xl,port_yl,port_xr,port_yr;
57: PetscReal coor_xl,coor_yl,coor_xr,coor_yr;
58: PetscReal currentpoint_x[20],currentpoint_y[20];
59: PetscReal boundbox_xl,boundbox_yl,boundbox_xr,boundbox_yr; /* need to have this for each current point? */
60: PetscInt currentpoint;
61: PetscDrawMarkerType markertype;
62: char *title;
63: char *display;
64: PetscDraw popup;
65: int x,y,h,w;
66: char *savefilename;
67: char *saveimageext;
68: char *savemovieext;
69: PetscInt savefilecount;
70: PetscBool savesinglefile;
71: PetscInt savemoviefps;
72: char *savefinalfilename;
73: PetscBool saveonclear; /* save a new image for every PetscDrawClear() called */
74: PetscBool saveonflush; /* save a new image for every PetscDrawFlush() called */
75: void *data;
76: };
78: #endif