android.graphics.Path.isConvex()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(4.5k)|赞(0)|评价(0)|浏览(216)

本文整理了Java中android.graphics.Path.isConvex()方法的一些代码示例,展示了Path.isConvex()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Path.isConvex()方法的具体详情如下:
包路径:android.graphics.Path
类名称:Path
方法名:isConvex

Path.isConvex介绍

暂无

代码示例

代码示例来源:origin: ogaclejapan/ArcLayout

@TargetApi(Build.VERSION_CODES.LOLLIPOP)
@Override
public void getOutline(Outline outline) {
 if (arcPath == null || !arcPath.isConvex()) {
  super.getOutline(outline);
 } else {
  outline.setConvexPath(arcPath);
 }
}

代码示例来源:origin: imallan/JellyRefreshLayout

@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
  @Override
  public void getOutline(View view, Outline outline) {
    if (mPath.isConvex()) outline.setConvexPath(mPath);
  }
};

代码示例来源:origin: rom4ek/ArcNavigationView

@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
  @Override
  public void getOutline(View view, Outline outline) {
    if (clipPath.isConvex()) {
      outline.setConvexPath(clipPath);
    }
  }
});

代码示例来源:origin: JustinRoom/JSCKit

@Override
  public void getOutline(View view, Outline outline) {
    switch (shape){
      case CIRCULAR:
        outline.setOval(0, 0, view.getWidth(), view.getHeight());
        break;
      case SQUARE:
        outline.setRect(0, 0, view.getWidth(), view.getHeight());
        break;
      case ROUND_CORNER_SQUARE:
        outline.setRoundRect(0, 0, view.getWidth(), view.getHeight(), radius);
        break;
      case TRIANGLE:
        Path path = new Path();
        path.moveTo(view.getWidth() / 2.0f, 0);
        path.lineTo(0, view.getHeight());
        path.lineTo(view.getWidth(), view.getHeight());
        path.close();
        Log.i("DotView", "getOutline: isConvex =" + path.isConvex());
        outline.setConvexPath(path);
        break;
    }
  }
});

代码示例来源:origin: JustinRoom/CameraMaskDemo

@Override
  public void getOutline(View view, Outline outline) {
    switch (shape){
      case CIRCULAR:
        outline.setOval(0, 0, view.getWidth(), view.getHeight());
        break;
      case SQUARE:
        outline.setRect(0, 0, view.getWidth(), view.getHeight());
        break;
      case ROUND_CORNER_SQUARE:
        outline.setRoundRect(0, 0, view.getWidth(), view.getHeight(), radius);
        break;
      case TRIANGLE:
        Path path = new Path();
        path.moveTo(view.getWidth() / 2.0f, 0);
        path.lineTo(0, view.getHeight());
        path.lineTo(view.getWidth(), view.getHeight());
        path.close();
        Log.i("DotView", "getOutline: isConvex =" + path.isConvex());
        outline.setConvexPath(path);
        break;
    }
  }
});

代码示例来源:origin: JustinRoom/WheelViewDemo

@Override
  public void getOutline(View view, Outline outline) {
    switch (shape){
      case CIRCULAR:
        outline.setOval(0, 0, view.getWidth(), view.getHeight());
        break;
      case SQUARE:
        outline.setRect(0, 0, view.getWidth(), view.getHeight());
        break;
      case ROUND_CORNER_SQUARE:
        outline.setRoundRect(0, 0, view.getWidth(), view.getHeight(), radius);
        break;
      case TRIANGLE:
        Path path = new Path();
        path.moveTo(view.getWidth() / 2.0f, 0);
        path.lineTo(0, view.getHeight());
        path.lineTo(view.getWidth(), view.getHeight());
        path.close();
        Log.i("DotView", "getOutline: isConvex =" + path.isConvex());
        outline.setConvexPath(path);
        break;
    }
  }
});

代码示例来源:origin: AlexMofer/ProjectX

@TargetApi(Build.VERSION_CODES.LOLLIPOP)
@Override
public void getOutline(@SuppressWarnings("NullableProblems") Outline outline) {
  if (mProvider == null || mOutlinePath.isEmpty() || !mOutlinePath.isConvex()) {
    super.getOutline(outline);
    return;
  }
  outline.setConvexPath(mOutlinePath);
  outline.setAlpha(1);
}

代码示例来源:origin: AlexMofer/ProjectX

@TargetApi(Build.VERSION_CODES.LOLLIPOP)
@Override
public void getOutline(Outline outline) {
  if (mPath.isEmpty() || !mPath.isConvex()) {
    super.getOutline(outline);
    return;
  }
  final int[] state = getState();
  final int fillColor = DrawableHelper.getColor(mFillColor, state, mAlpha);
  final int strokeColor = DrawableHelper.getColor(mStrokeColor, state, mAlpha);
  final int alpha = Math.max(Color.alpha(fillColor), Color.alpha(strokeColor));
  outline.setConvexPath(mPath);
  outline.setAlpha(alpha / 255f);
}

代码示例来源:origin: captain-miao/OptionRoundCardview

@Override
public void getOutline(Outline outline) {
  if (buildConvexPath().isConvex()) {
    outline.setConvexPath(buildConvexPath());
  } else {
    super.getOutline(outline);
  }
}

代码示例来源:origin: AlexMofer/ProjectX

@TargetApi(Build.VERSION_CODES.LOLLIPOP)
@Override
public void getOutline(Outline outline) {
  if (mDrawPath.isEmpty() || !mDrawPath.isConvex()) {
    super.getOutline(outline);
    return;
  }
  final int[] state = getState();
  final int backgroundColor = DrawableHelper.getColor(mBackgroundColor, state, mAlpha);
  final int backgroundAlpha = Color.alpha(backgroundColor);
  if (backgroundAlpha != 0) {
    outline.setRect(getBounds());
    outline.setAlpha(backgroundAlpha / 255f);
    return;
  }
  final int fillColor = DrawableHelper.getColor(mFillColor, state, mAlpha);
  final int strokeColor = DrawableHelper.getColor(mStrokeColor, state, mAlpha);
  final int alpha = Math.max(Color.alpha(fillColor), Color.alpha(strokeColor));
  outline.setConvexPath(mDrawPath);
  outline.setAlpha(alpha / 255f);
}

相关文章