Actual source code: ex10.c


  2: static char help[] = "Tests repeatedly setting a window type.\n";

  4: #include <petscsys.h>
  5: #include <petscdraw.h>

  7: int main(int argc,char **argv)
  8: {
  9:   PetscDraw draw;
 10:   int       x = 0,y = 0,width = 300,height = 300;

 12:   PetscInitialize(&argc,&argv,NULL,help);
 13:   PetscDrawCreate(PETSC_COMM_WORLD,0,"Title",x,y,width,height,&draw);
 14: #if defined(PETSC_HAVE_X)
 15:   PetscDrawSetType(draw,"x");
 16:   PetscDrawSetType(draw,"null");
 17:   PetscDrawSetType(draw,"x");
 18: #else
 19:   PetscDrawSetType(draw,"null");
 20: #endif
 21:   PetscDrawSetFromOptions(draw);
 22:   PetscDrawSetViewPort(draw,.25,.25,.75,.75);
 23:   PetscDrawClear(draw);
 24:   PetscDrawLine(draw,0.0,0.0,1.0,1.0,PETSC_DRAW_BLACK);
 25:   PetscDrawString(draw,.2,.2,PETSC_DRAW_RED,"Some Text");
 26:   PetscDrawStringSetSize(draw,.5,.5);
 27:   PetscDrawString(draw,.2,.2,PETSC_DRAW_BLUE,"Some Text");
 28:   PetscDrawFlush(draw);
 29:   PetscSleep(2);
 30:   PetscDrawResizeWindow(draw,600,600);
 31:   PetscDrawClear(draw);
 32:   PetscSleep(2);
 33:   PetscDrawLine(draw,0.0,1.0,1.0,0.0,PETSC_DRAW_BLUE);
 34:   PetscDrawFlush(draw);
 35:   PetscSleep(2);
 36:   PetscDrawDestroy(&draw);
 37:   PetscFinalize();
 38:   return 0;
 39: }

 41: /*TEST

 43:    build:
 44:      requires: x

 46:    test:
 47:      output_file: output/ex1_1.out

 49: TEST*/