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