Date: 2025-03-29T05:58:42+00:00

Actual source code: dpoint.c

      1: #include <petsc/private/drawimpl.h>

      3: /*@
      4:   PetscDrawPoint - draws a point onto a drawable.

      6:   Not Collective

      8:   Input Parameters:
      9: + draw - the drawing context
     10: . xl   - horizatonal coordinate of the point
     11: . yl   - vertical coordinate of the point
     12: - cl   - the color of the point

     14:   Level: beginner

     16: .seealso: `PetscDraw`, `PetscDrawPointPixel()`, `PetscDrawPointSetSize()`, `PetscDrawLine()`, `PetscDrawRectangle()`, `PetscDrawTriangle()`, `PetscDrawEllipse()`,
     17:           `PetscDrawMarker()`, `PetscDrawString()`, `PetscDrawArrow()`
     18: @*/
     19: PetscErrorCode PetscDrawPoint(PetscDraw draw, PetscReal xl, PetscReal yl, int cl)
     20: {
     21:   PetscFunctionBegin;
     23:   PetscUseTypeMethod(draw, point, xl, yl, cl);
     24:   PetscFunctionReturn(PETSC_SUCCESS);
     25: }

     27: /*@
     28:   PetscDrawPointPixel - draws a point onto a drawable, in pixel coordinates

     30:   Not Collective

     32:   Input Parameters:
     33: + draw - the drawing context
     34: . x    - horizontal pixel coordinates of the point
     35: . y    - vertical pixel coordinates of the point
     36: - c    - the color of the point

     38:   Level: beginner

     40: .seealso: `PetscDraw`, `PetscDrawPoint()`, `PetscDrawPointSetSize()`
     41: @*/
     42: PetscErrorCode PetscDrawPointPixel(PetscDraw draw, int x, int y, int c)
     43: {
     44:   PetscFunctionBegin;
     46:   PetscUseTypeMethod(draw, pointpixel, x, y, c);
     47:   PetscFunctionReturn(PETSC_SUCCESS);
     48: }

     50: /*@
     51:   PetscDrawPointSetSize - Sets the point size for future draws.  The size is
     52:   relative to the user coordinates of the window; 0.0 denotes the natural
     53:   width, 1.0 denotes the entire viewport.

     55:   Not Collective

     57:   Input Parameters:
     58: + draw  - the drawing context
     59: - width - the width in user coordinates

     61:   Level: advanced

     63:   Note:
     64:   Even a size of zero insures that a single pixel is colored.

     66: .seealso: `PetscDraw`, `PetscDrawPoint()`, `PetscDrawMarker()`
     67: @*/
     68: PetscErrorCode PetscDrawPointSetSize(PetscDraw draw, PetscReal width)
     69: {
     70:   PetscFunctionBegin;
     72:   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);
     73:   PetscTryTypeMethod(draw, pointsetsize, width);
     74:   PetscFunctionReturn(PETSC_SUCCESS);
     75: }