xref: /petsc/src/sys/classes/draw/interface/dpoint.c (revision 8fd105b637c659b5723a6c3ba83a32bc84aa12fb)
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    PetscDrawPoint - PetscDraws a point onto a drawable.
9 
10    Not collective
11 
12    Input Parameters:
13 +  draw - the drawing context
14 .  xl,yl - the coordinates of the point
15 -  cl - the color of the point
16 
17    Level: beginner
18 
19 .seealso: `PetscDrawPointPixel()`, `PetscDrawPointSetSize()`, `PetscDrawLine()`, `PetscDrawRectangle()`, `PetscDrawTriangle()`, `PetscDrawEllipse()`,
20           `PetscDrawMarker()`, `PetscDrawString()`, `PetscDrawArrow()`
21 
22 @*/
23 PetscErrorCode  PetscDrawPoint(PetscDraw draw,PetscReal xl,PetscReal yl,int cl)
24 {
25   PetscFunctionBegin;
26   PetscValidHeaderSpecific(draw,PETSC_DRAW_CLASSID,1);
27   PetscUseTypeMethod(draw,point ,xl,yl,cl);
28   PetscFunctionReturn(0);
29 }
30 
31 /*@
32    PetscDrawPointPixel - PetscDraws a point onto a drawable, in pixel coordinates
33 
34    Not collective
35 
36    Input Parameters:
37 +  draw - the drawing context
38 .  x,y - the pixel coordinates of the point
39 -  c - the color of the point
40 
41    Level: beginner
42 
43 .seealso: `PetscDrawPoint()`, `PetscDrawPointSetSize()`
44 
45 @*/
46 PetscErrorCode  PetscDrawPointPixel(PetscDraw draw,int x,int y,int c)
47 {
48   PetscFunctionBegin;
49   PetscValidHeaderSpecific(draw,PETSC_DRAW_CLASSID,1);
50   PetscUseTypeMethod(draw,pointpixel ,x,y,c);
51   PetscFunctionReturn(0);
52 }
53 
54 /*@
55    PetscDrawPointSetSize - Sets the point size for future draws.  The size is
56    relative to the user coordinates of the window; 0.0 denotes the natural
57    width, 1.0 denotes the entire viewport.
58 
59    Not collective
60 
61    Input Parameters:
62 +  draw - the drawing context
63 -  width - the width in user coordinates
64 
65    Level: advanced
66 
67    Note:
68    Even a size of zero insures that a single pixel is colored.
69 
70 .seealso: `PetscDrawPoint()`, `PetscDrawMarker()`
71 @*/
72 PetscErrorCode  PetscDrawPointSetSize(PetscDraw draw,PetscReal width)
73 {
74   PetscFunctionBegin;
75   PetscValidHeaderSpecific(draw,PETSC_DRAW_CLASSID,1);
76   PetscCheck(width >= 0.0 && width <= 1.0,PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Bad size %g, should be between 0 and 1",(double)width);
77   PetscTryTypeMethod(draw,pointsetsize,width);
78   PetscFunctionReturn(0);
79 }
80