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