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