xref: /petsc/src/sys/classes/draw/interface/dcoor.c (revision 27f49a208b01d2e827ab9db411a2d16003fe9262)
1 
2 /*
3        Provides the calling sequences for all the basic PetscDraw routines.
4 */
5 #include <petsc/private/drawimpl.h> /*I "petscdraw.h" I*/
6 
7 /*@
8    PetscDrawSetCoordinates - Sets the application coordinates of the corners of
9    the window (or page).
10 
11    Not Collective
12 
13    Input Parameters:
14 +  draw - the drawing object
15 -  xl,yl,xr,yr - the coordinates of the lower left corner and upper
16                  right corner of the drawing region.
17 
18    Level: advanced
19 
20 .seealso: `PetscDraw`, `PetscDrawGetCoordinates()`
21 @*/
22 PetscErrorCode PetscDrawSetCoordinates(PetscDraw draw, PetscReal xl, PetscReal yl, PetscReal xr, PetscReal yr)
23 {
24   PetscFunctionBegin;
25   PetscValidHeaderSpecific(draw, PETSC_DRAW_CLASSID, 1);
26   draw->coor_xl = xl;
27   draw->coor_yl = yl;
28   draw->coor_xr = xr;
29   draw->coor_yr = yr;
30   PetscTryTypeMethod(draw, setcoordinates, xl, yl, xr, yr);
31   PetscFunctionReturn(PETSC_SUCCESS);
32 }
33 
34 /*@
35    PetscDrawGetCoordinates - Gets the application coordinates of the corners of
36    the window (or page).
37 
38    Not Collective
39 
40    Input Parameter:
41 .  draw - the drawing object
42 
43    Output Parameters:
44 +  xl - the horizontal coordinate of the lower left corner of the drawing region.
45 .  yl - the vertical coordinate of the lower left corner of the drawing region.
46 .  xr - the horizontal coordinate of the upper right corner of the drawing region.
47 -  yr - the vertical coordinate of the upper right corner of the drawing region.
48 
49    Level: advanced
50 
51 .seealso: `PetscDraw`, `PetscDrawSetCoordinates()`
52 @*/
53 PetscErrorCode PetscDrawGetCoordinates(PetscDraw draw, PetscReal *xl, PetscReal *yl, PetscReal *xr, PetscReal *yr)
54 {
55   PetscFunctionBegin;
56   PetscValidHeaderSpecific(draw, PETSC_DRAW_CLASSID, 1);
57   PetscValidRealPointer(xl, 2);
58   PetscValidRealPointer(yl, 3);
59   PetscValidRealPointer(xr, 4);
60   PetscValidRealPointer(yr, 5);
61   *xl = draw->coor_xl;
62   *yl = draw->coor_yl;
63   *xr = draw->coor_xr;
64   *yr = draw->coor_yr;
65   PetscFunctionReturn(PETSC_SUCCESS);
66 }
67