Actual source code: ex10.c
petsc-3.7.3 2016-08-01
2: static char help[] = "Tests repeatedly setting a window type.\n";
4: #include <petscsys.h>
5: #include <petscdraw.h>
9: int main(int argc,char **argv)
10: {
11: PetscDraw draw;
13: int x = 0,y = 0,width = 300,height = 300;
15: PetscInitialize(&argc,&argv,NULL,help);
16: PetscDrawCreate(PETSC_COMM_WORLD,0,"Title",x,y,width,height,&draw);
17: #if defined(PETSC_HAVE_X)
18: PetscDrawSetType(draw,"x");
19: PetscDrawSetType(draw,"null");
20: PetscDrawSetType(draw,"x");
21: #else
22: PetscDrawSetType(draw,"null");
23: #endif
24: PetscDrawSetFromOptions(draw);
25: PetscDrawSetViewPort(draw,.25,.25,.75,.75);
26: PetscDrawClear(draw);
27: PetscDrawLine(draw,0.0,0.0,1.0,1.0,PETSC_DRAW_BLACK);
28: PetscDrawString(draw,.2,.2,PETSC_DRAW_RED,"Some Text");
29: PetscDrawStringSetSize(draw,.5,.5);
30: PetscDrawString(draw,.2,.2,PETSC_DRAW_BLUE,"Some Text");
31: PetscDrawFlush(draw);
32: PetscSleep(2);
33: PetscDrawResizeWindow(draw,600,600);
34: PetscDrawClear(draw);
35: PetscSleep(2);
36: PetscDrawLine(draw,0.0,1.0,1.0,0.0,PETSC_DRAW_BLUE);
37: PetscDrawFlush(draw);
38: PetscSleep(2);
39: PetscDrawDestroy(&draw);
40: PetscFinalize();
41: return 0;
42: }