title: Android canvas clip Mask using path
body: <p>I need to draw this:</p>
  
  <p><a href="https://i.stack.imgur.com/B5VdL.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/B5VdL.png" alt="result"></a></p>
  
  <p>and this:
  <a href="https://i.stack.imgur.com/lD6U7.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/lD6U7.png" alt="enter image description here"></a></p>
  
  <p>Can i make object and rotate it from point with x y cord and length + angle (vector)?</p>
  
  <p>But i can't understand how to make a clip mask for canvas using Path.</p>
  
  <pre><code>red.setColor(0xff033cd0);
          red.setStyle(Paint.Style.FILL);
          path.reset();
          path = new Path();
          path.reset();
          path.moveTo(boxWTstopX, boxWTstartY);
          path.lineTo(boxWTstartX, boxWTstartY);
         // path.moveTo(point2_returned.x, point2_returned.y);
          path.lineTo(boxWTstartX, boxWTstopY);
          path.lineTo(boxWTstopX, boxWTstartY);
          //path.moveTo(point3_returned.x, point3_returned.y);
         // path.lineTo(point1_returned.x, point1_returned.y);
          path.close();
  
          //canvas.drawPath(path, red);
          canvas.clipPath(path);
  </code></pre>
  
  <p>But after that i drawing on Retrangle region... How i do that? i have no idea.</p>
  
  <p><strong>P.S</strong>:</p>
  
  <p>I have no idea why i cant make object retrangle with lenght 100 and width 200 and than print it from cords! It will be more "friendly" than 2 points... is it posible?</p>
  
  <p>Maybe there is a way to make object (contains: paths + rects + etc) and than print it from x y cords?</p>