Actual source code: dpoint.c
petsc-3.12.5 2020-03-29
2: /*
3: Provides the calling sequences for all the basic PetscDraw routines.
4: */
5: #include <petsc/private/drawimpl.h>
7: /*@
8: PetscDrawPoint - PetscDraws a point onto a drawable.
10: Not collective
12: Input Parameters:
13: + draw - the drawing context
14: . xl,yl - the coordinates of the point
15: - cl - the color of the point
17: Level: beginner
20: .seealso: PetscDrawPointPixel(), PetscDrawPointSetSize(), PetscDrawLine(), PetscDrawRectangle(), PetscDrawTriangle(), PetscDrawEllipse(),
21: PetscDrawMarker(), PetscDrawString(), PetscDrawArrow()
23: @*/
24: PetscErrorCode PetscDrawPoint(PetscDraw draw,PetscReal xl,PetscReal yl,int cl)
25: {
30: if (!draw->ops->point) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_SUP,"This draw type %s does not support drawing points",((PetscObject)draw)->type_name);
31: (*draw->ops->point)(draw,xl,yl,cl);
32: return(0);
33: }
35: /*@
36: PetscDrawPointPixel - PetscDraws a point onto a drawable, in pixel coordinates
38: Not collective
40: Input Parameters:
41: + draw - the drawing context
42: . x,y - the pixel coordinates of the point
43: - c - the color of the point
45: Level: beginner
48: .seealso: PetscDrawPoint(), PetscDrawPointSetSize()
50: @*/
51: PetscErrorCode PetscDrawPointPixel(PetscDraw draw,int x,int y,int c)
52: {
57: if (!draw->ops->pointpixel) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_SUP,"This draw type %s does not support drawing point pixels",((PetscObject)draw)->type_name);
58: (*draw->ops->pointpixel)(draw,x,y,c);
59: return(0);
60: }
62: /*@
63: PetscDrawPointSetSize - Sets the point size for future draws. The size is
64: relative to the user coordinates of the window; 0.0 denotes the natural
65: width, 1.0 denotes the entire viewport.
67: Not collective
69: Input Parameters:
70: + draw - the drawing context
71: - width - the width in user coordinates
73: Level: advanced
75: Note:
76: Even a size of zero insures that a single pixel is colored.
78: .seealso: PetscDrawPoint(), PetscDrawMarker()
79: @*/
80: PetscErrorCode PetscDrawPointSetSize(PetscDraw draw,PetscReal width)
81: {
86: if (width < 0.0 || width > 1.0) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Bad size %g, should be between 0 and 1",(double)width);
87: if (draw->ops->pointsetsize) {
88: (*draw->ops->pointsetsize)(draw,width);
89: }
90: return(0);
91: }