[关闭]
@cxm-2016 2017-02-04T14:29:38.000000Z 字数 293 阅读 3066

Android:判断一个点是否在Path内部

Android



  1. val bounds = RectF()
  2. path.computeBounds(bounds,true)
  3. val region = Region()
  4. region.setPath(path,Region(bounds.left.toInt
  5. (),bounds.top.toInt(),bounds.right.toInt
  6. (),bounds.bottom.toInt()))
  7. if(region.contains(x,y)){
  8. // to do some thing
  9. }

Region 表示一个范围,它由一个或多个矩形组成。

添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注