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 - PetscDraws 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: PetscDrawPointPixel(), PetscDrawPointSetSize(), PetscDrawLine(), PetscDrawRectangle(), PetscDrawTriangle(), PetscDrawEllipse(), 20 PetscDrawMarker(), PetscDrawString(), PetscDrawArrow() 21 22 @*/ 23 PetscErrorCode PetscDrawPoint(PetscDraw draw,PetscReal xl,PetscReal yl,int cl) 24 { 25 PetscErrorCode ierr; 26 27 PetscFunctionBegin; 28 PetscValidHeaderSpecific(draw,PETSC_DRAW_CLASSID,1); 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 ierr = (*draw->ops->point)(draw,xl,yl,cl);CHKERRQ(ierr); 31 PetscFunctionReturn(0); 32 } 33 34 /*@ 35 PetscDrawPointPixel - PetscDraws a point onto a drawable, in pixel coordinates 36 37 Not collective 38 39 Input Parameters: 40 + draw - the drawing context 41 . x,y - the pixel coordinates of the point 42 - c - the color of the point 43 44 Level: beginner 45 46 .seealso: PetscDrawPoint(), PetscDrawPointSetSize() 47 48 @*/ 49 PetscErrorCode PetscDrawPointPixel(PetscDraw draw,int x,int y,int c) 50 { 51 PetscErrorCode ierr; 52 53 PetscFunctionBegin; 54 PetscValidHeaderSpecific(draw,PETSC_DRAW_CLASSID,1); 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 ierr = (*draw->ops->pointpixel)(draw,x,y,c);CHKERRQ(ierr); 57 PetscFunctionReturn(0); 58 } 59 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. 64 65 Not collective 66 67 Input Parameters: 68 + draw - the drawing context 69 - width - the width in user coordinates 70 71 Level: advanced 72 73 Note: 74 Even a size of zero insures that a single pixel is colored. 75 76 .seealso: PetscDrawPoint(), PetscDrawMarker() 77 @*/ 78 PetscErrorCode PetscDrawPointSetSize(PetscDraw draw,PetscReal width) 79 { 80 PetscErrorCode ierr; 81 82 PetscFunctionBegin; 83 PetscValidHeaderSpecific(draw,PETSC_DRAW_CLASSID,1); 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 ierr = (*draw->ops->pointsetsize)(draw,width);CHKERRQ(ierr); 87 } 88 PetscFunctionReturn(0); 89 } 90