xref: /petsc/src/sys/classes/draw/interface/dpoint.c (revision bfc4c25e64040512a7cdc7bcb995f785926f51e6)
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 #undef __FUNCT__
8 #define __FUNCT__ "PetscDrawPoint"
9 /*@
10    PetscDrawPoint - PetscDraws a point onto a drawable.
11 
12    Not collective
13 
14    Input Parameters:
15 +  draw - the drawing context
16 .  xl,yl - the coordinates of the point
17 -  cl - the color of the point
18 
19    Level: beginner
20 
21    Concepts: point^drawing
22    Concepts: drawing^point
23 
24 .seealso: PetscDrawPointPixel(), PetscDrawPointSetSize(), PetscDrawLine(), PetscDrawRectangle(), PetscDrawTriangle(), PetscDrawEllipse(),
25           PetscDrawMarker(), PetscDrawString(), PetscDrawArrow()
26 
27 @*/
28 PetscErrorCode  PetscDrawPoint(PetscDraw draw,PetscReal xl,PetscReal yl,int cl)
29 {
30   PetscErrorCode ierr;
31 
32   PetscFunctionBegin;
33   PetscValidHeaderSpecific(draw,PETSC_DRAW_CLASSID,1);
34   if (!draw->ops->point) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_SUP,"This draw type %s does not support drawing points",((PetscObject)draw)->type_name);
35   ierr = (*draw->ops->point)(draw,xl,yl,cl);CHKERRQ(ierr);
36   PetscFunctionReturn(0);
37 }
38 
39 #undef __FUNCT__
40 #define __FUNCT__ "PetscDrawPointPixel"
41 /*@
42    PetscDrawPointPixel - PetscDraws a point onto a drawable, in pixel coordinates
43 
44    Not collective
45 
46    Input Parameters:
47 +  draw - the drawing context
48 .  x,y - the pixel coordinates of the point
49 -  c - the color of the point
50 
51    Level: beginner
52 
53    Concepts: point^drawing
54    Concepts: drawing^point
55 
56 .seealso: PetscDrawPoint(), PetscDrawPointSetSize()
57 
58 @*/
59 PetscErrorCode  PetscDrawPointPixel(PetscDraw draw,int x,int y,int c)
60 {
61   PetscErrorCode ierr;
62 
63   PetscFunctionBegin;
64   PetscValidHeaderSpecific(draw,PETSC_DRAW_CLASSID,1);
65   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);
66   ierr = (*draw->ops->pointpixel)(draw,x,y,c);CHKERRQ(ierr);
67   PetscFunctionReturn(0);
68 }
69 
70 #undef __FUNCT__
71 #define __FUNCT__ "PetscDrawPointSetSize"
72 /*@
73    PetscDrawPointSetSize - Sets the point size for future draws.  The size is
74    relative to the user coordinates of the window; 0.0 denotes the natural
75    width, 1.0 denotes the entire viewport.
76 
77    Not collective
78 
79    Input Parameters:
80 +  draw - the drawing context
81 -  width - the width in user coordinates
82 
83    Level: advanced
84 
85    Note:
86    Even a size of zero insures that a single pixel is colored.
87 
88    Concepts: point^drawing size
89 
90 .seealso: PetscDrawPoint(), PetscDrawMarker()
91 @*/
92 PetscErrorCode  PetscDrawPointSetSize(PetscDraw draw,PetscReal width)
93 {
94   PetscErrorCode ierr;
95 
96   PetscFunctionBegin;
97   PetscValidHeaderSpecific(draw,PETSC_DRAW_CLASSID,1);
98   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);
99   if (draw->ops->pointsetsize) {
100     ierr = (*draw->ops->pointsetsize)(draw,width);CHKERRQ(ierr);
101   }
102   PetscFunctionReturn(0);
103 }
104