Example usage for android.graphics Region setPath

List of usage examples for android.graphics Region setPath

Introduction

In this page you can find the example usage for android.graphics Region setPath.

Prototype

public boolean setPath(Path path, Region clip) 

Source Link

Document

Set the region to the area described by the path and clip.

Usage

From source file:Main.java

/**
 * Creates a simple region from the given path.
 *
 * @param path given path/*from ww w  . j  a  v a 2s  .co  m*/
 * @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;
}