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

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

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

Path.op介绍

暂无

代码示例

代码示例来源:origin: airbnb/lottie-android

path.op(firstPath, remainderPath, op);

代码示例来源:origin: florent37/DiagonalLayout

final boolean success = rectView.op(clipPath, Path.Op.DIFFERENCE);

代码示例来源:origin: florent37/ShapeOfView

final boolean success = rectView.op(clipPath, Path.Op.DIFFERENCE);

代码示例来源:origin: Solartisan/WaveSideBar

private void drawBallPath(Canvas canvas) {
  //x轴的移动路径
  mBallCentreX = (mWidth + mBallRadius) - (2.0f * mRadius + 2.0f * mBallRadius) * mRatio;
  mBallPath.reset();
  mBallPath.addCircle(mBallCentreX, mCenterY, mBallRadius, Path.Direction.CW);
  if(Build.VERSION.SDK_INT>=Build.VERSION_CODES.KITKAT) {
    mBallPath.op(mWavePath, Path.Op.DIFFERENCE);
  }
  mBallPath.close();
  canvas.drawPath(mBallPath, mWavePaint);
}

代码示例来源:origin: heinrichreimer/material-intro

private void drawUnselected(Canvas canvas) {
  combinedUnselectedPath.rewind();
  // draw any settled, revealing or joining dots
  for (int page = 0; page < pageCount; page++) {
    int nextXIndex = page == pageCount - 1 ? page : page + 1;
    Path unselectedPath = getUnselectedPath(page,
        dotCenterX[page],
        dotCenterX[nextXIndex],
        page == pageCount - 1 ? INVALID_FRACTION : joiningFractions[page],
        dotRevealFractions[page]);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
      combinedUnselectedPath.op(unselectedPath, Path.Op.UNION);
    } else {
      combinedUnselectedPath.addPath(unselectedPath);
    }
  }
  // draw any retreating joins
  if (retreatingJoinX1 != INVALID_FRACTION) {
    Path retreatingJoinPath = getRetreatingJoinPath();
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
      combinedUnselectedPath.op(retreatingJoinPath, Path.Op.UNION);
    } else {
      combinedUnselectedPath.addPath(retreatingJoinPath);
    }
  }
  canvas.drawPath(combinedUnselectedPath, unselectedPaint);
}

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

final boolean success = rectView.op(clipPath, Path.Op.DIFFERENCE);

代码示例来源:origin: rakshakhegde/Diffre

@Override
  public void computeCroppedTextPath() {
    croppedTextPath.op(textPath, progressPath, Path.Op.DIFFERENCE);
  }
}

代码示例来源:origin: heinrichreimer/material-intro

unselectedDotPath.op(unselectedDotLeftPath, Path.Op.UNION);
} else {
  unselectedDotPath.addPath(unselectedDotLeftPath);
    endX2, endY2);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
  unselectedDotPath.op(unselectedDotRightPath, Path.Op.UNION);
} else {
  unselectedDotPath.addPath(unselectedDotRightPath);

代码示例来源:origin: rakshakhegde/Diffre

@Override
public void computeCroppedProgressPath() {
  setRectPath(progressPath, 0, 0, width * percent, height);
  croppedProgressPath.op(progressPath, textPath, Path.Op.DIFFERENCE);
  croppedProgressPath.op(progressStrokePath, Path.Op.INTERSECT);
}

代码示例来源:origin: xupeng92/SortRecyclerviewList

/**
 * 绘制左边提示的圆
 *
 * @param canvas
 */
private void drawCirclePath(Canvas canvas) {
  //x轴的移动路径
  mCircleCenterX = (mWidth + mCircleRadius) - (2.0f * mRadius + 2.0f * mCircleRadius) * mRatio;
  mCirclePath.reset();
  mCirclePath.addCircle(mCircleCenterX, mCenterY, mCircleRadius, Path.Direction.CW);
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
    mCirclePath.op(mWavePath, Path.Op.DIFFERENCE);
  }
  mCirclePath.close();
  canvas.drawPath(mCirclePath, mWavePaint);
}

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

/**
 * Set this path to the result of applying the Op to this path and the specified path.
 * The resulting path will be constructed from non-overlapping contours.
 * The curve order is reduced where possible so that cubics may be turned
 * into quadratics, and quadratics maybe turned into lines.
 *
 * @param path The second operand (for difference, the subtrahend)
 * @return True if operation succeeded, false otherwise and this path remains unmodified.
 * @see Path.Op
 * @see #op(Path, Path, Path.Op)
 */
public boolean op(Path path, Path.Op op) {
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT && mPath.op(path, op)) {
    invalidatePath();
    return true;
  }
  return false;
}

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

/**
 * Set this path to the result of applying the Op to the two specified paths.
 * The resulting path will be constructed from non-overlapping contours.
 * The curve order is reduced where possible so that cubics may be turned
 * into quadratics, and quadratics maybe turned into lines.
 *
 * @param path1 The first operand (for difference, the minuend)
 * @param path2 The second operand (for difference, the subtrahend)
 * @return True if operation succeeded, false otherwise and this path remains unmodified.
 * @see Path.Op
 * @see #op(Path, Path.Op)
 */
public boolean op(Path path1, Path path2, Path.Op op) {
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT && mPath.op(path1, path2, op)) {
    invalidatePath();
    return true;
  }
  return false;
}

代码示例来源:origin: wangxp423/ViewExercise

private void drawTest(Canvas canvas, Paint paint) {
    Path path = new Path();
    path.moveTo(200, 200);
    path.quadTo(300, 400, 600, 200);
    path.moveTo(200, 700);
    path.cubicTo(300, 400, 500, 0, 700, 700);
    canvas.drawPath(path, paint);

//        paint.setStyle(Paint.Style.FILL);
    path.addCircle(300, 1000, 100, Path.Direction.CW);
    Path path1 = new Path();
    paint.setColor(Color.BLUE);
    path1.addCircle(300, 1100, 100, Path.Direction.CW);
    path.op(path1, Path.Op.UNION); //两个path交叉的几种情况
    canvas.drawPath(path, paint);

  }

代码示例来源:origin: Idtk/SmallChart

private void drawArc(Canvas canvas, float currentStartAngle, float drawAngle, IPieData pie,
           RectF outRectF, RectF midRectF, RectF inRectF, Paint paint){
  outPath.moveTo(0,0);
  outPath.arcTo(outRectF,currentStartAngle,drawAngle);
  midPath.moveTo(0,0);
  midPath.arcTo(midRectF,currentStartAngle,drawAngle);
  inPath.moveTo(0,0);
  inPath.arcTo(inRectF,currentStartAngle,drawAngle);
  outMidPath.op(outPath,midPath, Path.Op.DIFFERENCE);
  midInPath.op(midPath,inPath, Path.Op.DIFFERENCE);
  paint.setColor(pie.getColor());
  canvas.drawPath(outMidPath,paint);
  paint.setAlpha(0x80);//设置透明度
  canvas.drawPath(midInPath,paint);
  outPath.reset();
  midPath.reset();
  inPath.reset();
  outMidPath.reset();
  midInPath.reset();
}

代码示例来源:origin: yugai/DouYu-Android

private void drawUnselected(Canvas canvas) {
  combinedUnselectedPath.rewind();
  // draw any settled, revealing or joining dots
  for (int page = 0; page < pageCount; page++) {
    int nextXIndex = page == pageCount - 1 ? page : page + 1;
    combinedUnselectedPath.op(getUnselectedPath(page,
        dotCenterX[page],
        dotCenterX[nextXIndex],
        page == pageCount - 1 ? INVALID_FRACTION : joiningFractions[page],
        dotRevealFractions[page]), Path.Op.UNION);
  }
  // draw any retreating joins
  if (retreatingJoinX1 != INVALID_FRACTION) {
    combinedUnselectedPath.op(getRetreatingJoinPath(), Path.Op.UNION);
  }
  canvas.drawPath(combinedUnselectedPath, unselectedPaint);
}

代码示例来源:origin: zlc921022/CustomView

private void drawPieChartRing(Canvas canvas, int color, float drawAngle) {
  mOutPaint.setColor(color);
  mOutPath.lineTo(mOutRadius*(float) Math.cos(Math.toRadians(mStartAngle)),
      mOutRadius*(float) Math.sin(Math.toRadians(mStartAngle)));
  mOutPath.arcTo(mOutRectF, mStartAngle, drawAngle);
  // op(a,b,Path.Op.REVERSE_DIFFERENCE)  b-a的交集
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
    mPath.op(mInPath,mOutPath, Path.Op.REVERSE_DIFFERENCE);
  }
  canvas.drawPath(mPath,mOutPaint);
  //画透明度圆环
  drawInRing(canvas,mStartAngle,drawAngle);
  //画完一段圆弧再画百分比文字
  if(drawAngle % mDrawAngle== 0) {
    drawPercentText(canvas, mStartAngle);
  }
}

代码示例来源:origin: SheHuan/NiceImageView

srcPath.addRect(srcRectF, Path.Direction.CCW);
srcPath.op(path, Path.Op.DIFFERENCE);
canvas.drawPath(srcPath, paint);

代码示例来源:origin: TomRoush/PdfBox-Android

path.op(base.getPath(), Path.Op.UNION);
  leftSideBearing.y + ady.floatValue());
path.op(accent.getPath(), Path.Op.UNION);

代码示例来源:origin: mkulesh/microMathematics

Path part = objectToPath((SvgElement) child, true);
if (part != null)
 combinedPath.op(part, Path.Op.UNION);
Path clipClipPath = calculateClipPath(clipPath, clipPath.boundingBox);
if (clipClipPath != null)
 combinedPath.op(clipClipPath, Path.Op.INTERSECT);

代码示例来源:origin: com.caverock/androidsvg

Path part = objectToPath((SvgElement) child, true);
if (part != null)
 combinedPath.op(part, Path.Op.UNION);
Path clipClipPath = calculateClipPath(clipPath, clipPath.boundingBox);
if (clipClipPath != null)
 combinedPath.op(clipClipPath, Path.Op.INTERSECT);

相关文章