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 PetscFunctionBegin; 26 PetscValidHeaderSpecific(draw,PETSC_DRAW_CLASSID,1); 27 PetscCheck(draw->ops->point,PETSC_COMM_SELF,PETSC_ERR_SUP,"This draw type %s does not support drawing points",((PetscObject)draw)->type_name); 28 PetscCall((*draw->ops->point)(draw,xl,yl,cl)); 29 PetscFunctionReturn(0); 30 } 31 32 /*@ 33 PetscDrawPointPixel - PetscDraws a point onto a drawable, in pixel coordinates 34 35 Not collective 36 37 Input Parameters: 38 + draw - the drawing context 39 . x,y - the pixel coordinates of the point 40 - c - the color of the point 41 42 Level: beginner 43 44 .seealso: `PetscDrawPoint()`, `PetscDrawPointSetSize()` 45 46 @*/ 47 PetscErrorCode PetscDrawPointPixel(PetscDraw draw,int x,int y,int c) 48 { 49 PetscFunctionBegin; 50 PetscValidHeaderSpecific(draw,PETSC_DRAW_CLASSID,1); 51 PetscCheck(draw->ops->pointpixel,PETSC_COMM_SELF,PETSC_ERR_SUP,"This draw type %s does not support drawing point pixels",((PetscObject)draw)->type_name); 52 PetscCall((*draw->ops->pointpixel)(draw,x,y,c)); 53 PetscFunctionReturn(0); 54 } 55 56 /*@ 57 PetscDrawPointSetSize - Sets the point size for future draws. The size is 58 relative to the user coordinates of the window; 0.0 denotes the natural 59 width, 1.0 denotes the entire viewport. 60 61 Not collective 62 63 Input Parameters: 64 + draw - the drawing context 65 - width - the width in user coordinates 66 67 Level: advanced 68 69 Note: 70 Even a size of zero insures that a single pixel is colored. 71 72 .seealso: `PetscDrawPoint()`, `PetscDrawMarker()` 73 @*/ 74 PetscErrorCode PetscDrawPointSetSize(PetscDraw draw,PetscReal width) 75 { 76 PetscFunctionBegin; 77 PetscValidHeaderSpecific(draw,PETSC_DRAW_CLASSID,1); 78 PetscCheck(width >= 0.0 && width <= 1.0,PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Bad size %g, should be between 0 and 1",(double)width); 79 if (draw->ops->pointsetsize) PetscCall((*draw->ops->pointsetsize)(draw,width)); 80 PetscFunctionReturn(0); 81 } 82