Java tutorial
//package com.java2s; //License from project: Apache License import android.graphics.Path; import android.graphics.RectF; import android.graphics.Region; public class Main { /** * Creates a simple region from the given path. * * @param path given path * @return region object */ public static Region createRegionFromPath(Path path) { Region region = new Region(); if (path != null) { RectF box = new RectF(); path.computeBounds(box, true); region.setPath(path, new Region((int) box.left, (int) box.top, (int) box.right, (int) box.bottom)); } return region; } }