Actual source code: ex10.c
petsc-3.6.1 2015-08-06
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,(char*)0,help);
17: PetscDrawCreate(PETSC_COMM_WORLD,0,"Title",x,y,width,height,&draw);
18: #if defined(PETSC_HAVE_X)
19: PetscDrawSetType(draw,"x");
20: PetscDrawSetType(draw,"null");
21: PetscDrawSetType(draw,"x");
22: #else
23: PetscDrawSetType(draw,"null");
24: #endif
25: PetscDrawSetFromOptions(draw);
26: PetscDrawSetViewPort(draw,.25,.25,.75,.75);
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: PetscDrawClear(draw); PetscDrawFlush(draw);
34: PetscDrawResizeWindow(draw,600,600);
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: }