Actual source code: dpoint.c


  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

 19: .seealso: PetscDrawPointPixel(), PetscDrawPointSetSize(), PetscDrawLine(), PetscDrawRectangle(), PetscDrawTriangle(), PetscDrawEllipse(),
 20:           PetscDrawMarker(), PetscDrawString(), PetscDrawArrow()

 22: @*/
 23: PetscErrorCode  PetscDrawPoint(PetscDraw draw,PetscReal xl,PetscReal yl,int cl)
 24: {

 29:   if (!draw->ops->point) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_SUP,"This draw type %s does not support drawing points",((PetscObject)draw)->type_name);
 30:   (*draw->ops->point)(draw,xl,yl,cl);
 31:   return(0);
 32: }

 34: /*@
 35:    PetscDrawPointPixel - PetscDraws a point onto a drawable, in pixel coordinates

 37:    Not collective

 39:    Input Parameters:
 40: +  draw - the drawing context
 41: .  x,y - the pixel coordinates of the point
 42: -  c - the color of the point

 44:    Level: beginner

 46: .seealso: PetscDrawPoint(), PetscDrawPointSetSize()

 48: @*/
 49: PetscErrorCode  PetscDrawPointPixel(PetscDraw draw,int x,int y,int c)
 50: {

 55:   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);
 56:   (*draw->ops->pointpixel)(draw,x,y,c);
 57:   return(0);
 58: }

 60: /*@
 61:    PetscDrawPointSetSize - Sets the point size for future draws.  The size is
 62:    relative to the user coordinates of the window; 0.0 denotes the natural
 63:    width, 1.0 denotes the entire viewport.

 65:    Not collective

 67:    Input Parameters:
 68: +  draw - the drawing context
 69: -  width - the width in user coordinates

 71:    Level: advanced

 73:    Note:
 74:    Even a size of zero insures that a single pixel is colored.

 76: .seealso: PetscDrawPoint(), PetscDrawMarker()
 77: @*/
 78: PetscErrorCode  PetscDrawPointSetSize(PetscDraw draw,PetscReal width)
 79: {

 84:   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);
 85:   if (draw->ops->pointsetsize) {
 86:     (*draw->ops->pointsetsize)(draw,width);
 87:   }
 88:   return(0);
 89: }