code: public void restrict(float x, float y, float extraX, float extraY, PointF out) {
          tmpPointArr[0] = x;
          tmpPointArr[1] = y;
  
          if (boundsRotation != 0f) {
              // Rotating given point so we can apply rectangular bounds.
              tmpMatrix.setRotate(-boundsRotation, boundsPivotX, boundsPivotY);
              tmpMatrix.mapPoints(tmpPointArr);
          }
  
          // Applying restrictions
          tmpPointArr[0] = MathUtils.restrict(tmpPointArr[0],
                  bounds.left - extraX, bounds.right + extraX);
          tmpPointArr[1] = MathUtils.restrict(tmpPointArr[1],
                  bounds.top - extraY, bounds.bottom + extraY);
  
          if (boundsRotation != 0f) {
              // Rotating restricted point back to original coordinates
              tmpMatrix.setRotate(boundsRotation, boundsPivotX, boundsPivotY);
              tmpMatrix.mapPoints(tmpPointArr);
          }
  
          out.set(tmpPointArr[0], tmpPointArr[1]);
      }
docs: Restricts x &amp; y coordinates to current bounds (as calculated in {@link #set(State)}).
  
  @param x X coordinate
  @param y Y coordinate
  @param extraX Extra area bounds (horizontal)
  @param extraY Extra area bounds (vertical)
  @param out Output rectangle