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