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