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