xref: /petsc/src/sys/classes/draw/interface/dmarker.c (revision 78e9f83e6b1c70a59a15f63ee2a1607a8a5b1046)
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__ "PetscDrawMarker"
9 /*@
10    PetscDrawMarker - PetscDraws a marker onto a drawable.
11 
12    Not collective
13 
14    Input Parameters:
15 +  draw - the drawing context
16 .  xl,yl - the coordinates of the marker
17 -  cl - the color of the marker
18 
19    Level: beginner
20 
21    Concepts: marker^drawing
22    Concepts: drawing^marker
23 
24 .seealso: PetscDrawPoint()
25 
26 @*/
27 PetscErrorCode  PetscDrawMarker(PetscDraw draw,PetscReal xl,PetscReal yl,int cl)
28 {
29   PetscErrorCode ierr;
30   PetscBool      isnull;
31 
32   PetscFunctionBegin;
33   PetscValidHeaderSpecific(draw,PETSC_DRAW_CLASSID,1);
34   ierr = PetscDrawIsNull(draw,&isnull);CHKERRQ(ierr);
35   if (isnull) PetscFunctionReturn(0);
36   if (draw->ops->coordinatetopixel && draw->ops->pointpixel) {
37     PetscInt i,j,k;
38     ierr = (*draw->ops->coordinatetopixel)(draw,xl,yl,&i,&j);
39     for (k=-2; k<=2; k++) {
40       ierr = (*draw->ops->pointpixel)(draw,i+k,j+k,cl);
41       ierr = (*draw->ops->pointpixel)(draw,i+k,j-k,cl);
42     }
43   } else if (draw->ops->string) {
44     ierr = (*draw->ops->string)(draw,xl,yl,cl,"x");CHKERRQ(ierr);
45   } else SETERRQ(PetscObjectComm((PetscObject)draw),PETSC_ERR_SUP,"No support for drawing marker");
46   PetscFunctionReturn(0);
47 }
48