Code example for Path

Methods: addRoundRectsetFillType

     * @param height height of the canvas 
    public static void roundCorners(Canvas canvas, float width, float height) {
        // Construct a path from a round rect. This will allow drawing with 
        // an inverse fill so we can punch a hole using the round rect. 
        Path path = new Path();
        RectF rect = new RectF(0, 0, width, height);
        rect.inset(1, 1);
        path.addRoundRect(rect, 8f, 8f, Path.Direction.CW);
        // Construct a paint that clears the outside of the rectangle and 
        // draw. 
        Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
        paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.CLEAR));
        canvas.drawPath(path, paint);
     * Constructs an intent for picking an image from Gallery 
Experience pair programming with AI  Get Codota for Java