xref: /petsc/src/sys/classes/draw/interface/dcoor.c (revision 0e6b6b5985dd9b1172860d21fb88bd3966bf7c54)
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   PetscFunctionBegin;
24   PetscValidHeaderSpecific(draw, PETSC_DRAW_CLASSID, 1);
25   draw->coor_xl = xl;
26   draw->coor_yl = yl;
27   draw->coor_xr = xr;
28   draw->coor_yr = yr;
29   PetscTryTypeMethod(draw, setcoordinates, xl, yl, xr, yr);
30   PetscFunctionReturn(0);
31 }
32 
33 /*@
34    PetscDrawGetCoordinates - Gets the application coordinates of the corners of
35    the window (or page).
36 
37    Not Collective
38 
39    Input Parameter:
40 .  draw - the drawing object
41 
42    Level: advanced
43 
44    Output Parameters:
45 +  xl - the horizontal coordinate of the lower left corner of the drawing region.
46 .  yl - the vertical coordinate of the lower left corner of the drawing region.
47 .  xr - the horizontal coordinate of the upper right corner of the drawing region.
48 -  yr - the vertical coordinate of the upper right corner of the drawing region.
49 
50 .seealso: `PetscDraw`, `PetscDrawSetCoordinates()`
51 @*/
52 PetscErrorCode PetscDrawGetCoordinates(PetscDraw draw, PetscReal *xl, PetscReal *yl, PetscReal *xr, PetscReal *yr) {
53   PetscFunctionBegin;
54   PetscValidHeaderSpecific(draw, PETSC_DRAW_CLASSID, 1);
55   PetscValidRealPointer(xl, 2);
56   PetscValidRealPointer(yl, 3);
57   PetscValidRealPointer(xr, 4);
58   PetscValidRealPointer(yr, 5);
59   *xl = draw->coor_xl;
60   *yl = draw->coor_yl;
61   *xr = draw->coor_xr;
62   *yr = draw->coor_yr;
63   PetscFunctionReturn(0);
64 }
65