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