Actual source code: drawopenx.c
1: /*
2: Defines the operations for the X PetscDraw implementation.
3: */
5: #include <../src/sys/classes/draw/impls/x/ximpl.h>
7: /*@
8: PetscDrawOpenX - Opens an X-window for use with the `PetscDraw` routines.
10: Collective
12: Input Parameters:
13: + comm - the communicator that will share X-window
14: . display - the X display on which to open, or `NULL` for the local machine
15: . title - the title to put in the title bar, or `NULL` for no title
16: . x - the x screen coordinates of the upper left corner of window (or `PETSC_DECIDE`)
17: . y - the y screen coordinates of the upper left corner of window (or `PETSC_DECIDE`)
18: . w - the screen width in pixels of (or `PETSC_DRAW_HALF_SIZE`, `PETSC_DRAW_FULL_SIZE`, or `PETSC_DRAW_THIRD_SIZE` or `PETSC_DRAW_QUARTER_SIZE`)
19: - h - the screen height in pixels of (or `PETSC_DRAW_HALF_SIZE`, `PETSC_DRAW_FULL_SIZE`, or `PETSC_DRAW_THIRD_SIZE` or `PETSC_DRAW_QUARTER_SIZE`)
21: Output Parameter:
22: . draw - the drawing context.
24: Options Database Keys:
25: + -nox - Disables all x-windows output
26: . -display <name> - Sets name of machine for the X display
27: . -draw_pause <pause> - Sets time (in seconds) that the program pauses after `PetscDrawPause()` has been called
28: (0 is default, -1 implies until user input).
29: . -draw_cmap <name> - Sets the colormap to use.
30: . -draw_cmap_reverse - Reverses the colormap.
31: . -draw_cmap_brighten - Brighten (0 < beta < 1) or darken (-1 < beta < 0) the colormap.
32: . -draw_x_shared_colormap - Causes PETSc to use a shared colormap. By default PETSc creates a separate color
33: for its windows, you must put the mouse into the graphics
34: window to see the correct colors. This options forces
35: PETSc to use the default colormap which will usually result
36: in bad contour plots.
37: . -draw_fast - Does not create colormap for contour plots.
38: . -draw_double_buffer - Uses double buffering for smooth animation.
39: - -geometry - Indicates location and size of window.
41: Level: beginner
43: Notes:
44: If `x` and `y` are both `PETSC_DECIDE` then PETSc places the window automatically.
46: When finished with the drawing context, it should be destroyed
47: with `PetscDrawDestroy()`.
49: Fortran Note:
50: Whenever indicating null character data in a Fortran code,
51: `PETSC_NULL_CHARACTER` must be employed. Thus, `PETSC_NULL_CHARACTER` can be
52: used for the `display` and `title` input parameters.
54: .seealso: `PetscDrawFlush()`, `PetscDrawDestroy()`, `PetscDrawCreate()`, `PetscDrawOpnOpenGL()`
55: @*/
56: PetscErrorCode PetscDrawOpenX(MPI_Comm comm, const char display[], const char title[], int x, int y, int w, int h, PetscDraw *draw)
57: {
58: PetscFunctionBegin;
59: PetscCall(PetscDrawCreate(comm, display, title, x, y, w, h, draw));
60: PetscCall(PetscDrawSetType(*draw, PETSC_DRAW_X));
61: PetscFunctionReturn(PETSC_SUCCESS);
62: }