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