xref: /petsc/src/sys/classes/draw/interface/dcoor.c (revision 4e278199b78715991f5c71ebbd945c1489263e6c)
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   PetscErrorCode ierr;
26 
27   PetscFunctionBegin;
28   PetscValidHeaderSpecific(draw,PETSC_DRAW_CLASSID,1);
29   draw->coor_xl = xl; draw->coor_yl = yl;
30   draw->coor_xr = xr; draw->coor_yr = yr;
31   if (draw->ops->setcoordinates) {
32     ierr = (*draw->ops->setcoordinates)(draw,xl,yl,xr,yr);CHKERRQ(ierr);
33   }
34   PetscFunctionReturn(0);
35 }
36 
37 /*@
38    PetscDrawGetCoordinates - Gets the application coordinates of the corners of
39    the window (or page).
40 
41    Not Collective
42 
43    Input Parameter:
44 .  draw - the drawing object
45 
46    Level: advanced
47 
48    Ouput Parameters:
49 .  xl,yl,xr,yr - the coordinates of the lower left corner and upper
50                  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