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;

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

 42: /*TEST

 44:    build:
 45:      requires: x

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

 50: TEST*/