本文整理了Java中android.graphics.Path.addArc()
方法的一些代码示例,展示了Path.addArc()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Path.addArc()
方法的具体详情如下:
包路径:android.graphics.Path
类名称:Path
方法名:addArc
暂无
代码示例来源:origin: naman14/Timber
/**
* Initialize the {@code Path} objects with the appropriate values.
*/
private void initPaths() {
mCirclePath = new Path();
mCirclePath.addArc(mCircleRectF, mStartAngle, mTotalCircleDegrees);
mCircleProgressPath = new Path();
mCircleProgressPath.addArc(mCircleRectF, mStartAngle, mProgressDegrees);
}
代码示例来源:origin: dinuscxj/LoadingDrawable
private Path createMoonPath(float moonCenterX, float moonCenterY) {
RectF moonRectF = new RectF(moonCenterX - mSun$MoonRadius, moonCenterY - mSun$MoonRadius,
moonCenterX + mSun$MoonRadius, moonCenterY + mSun$MoonRadius);
Path path = new Path();
path.addArc(moonRectF, -90, 180);
path.quadTo(moonCenterX + mSun$MoonRadius / 2.0f, moonCenterY, moonCenterX, moonCenterY - mSun$MoonRadius);
return path;
}
代码示例来源:origin: dinuscxj/LoadingDrawable
private Path createLeftEyeCircle(RectF arcBounds, float offsetY) {
Path path = new Path();
//the center of the left eye
float leftEyeCenterX = arcBounds.centerX() - mEyeInterval / 2.0f - mEyeCircleRadius;
float leftEyeCenterY = arcBounds.centerY() + offsetY;
//the bounds of left eye
RectF leftEyeBounds = new RectF(leftEyeCenterX - mEyeCircleRadius, leftEyeCenterY - mEyeCircleRadius,
leftEyeCenterX + mEyeCircleRadius, leftEyeCenterY + mEyeCircleRadius);
path.addArc(leftEyeBounds, 0, DEGREE_180 + 15);
//the above radian of of the eye
path.quadTo(leftEyeBounds.left + mAboveRadianEyeOffsetX, leftEyeBounds.top + mEyeCircleRadius * 0.2f,
leftEyeBounds.left + mAboveRadianEyeOffsetX / 4.0f, leftEyeBounds.top - mEyeCircleRadius * 0.15f);
return path;
}
代码示例来源:origin: dinuscxj/LoadingDrawable
private Path createRightEyeCircle(RectF arcBounds, float offsetY) {
Path path = new Path();
//the center of the right eye
float rightEyeCenterX = arcBounds.centerX() + mEyeInterval / 2.0f + mEyeCircleRadius;
float rightEyeCenterY = arcBounds.centerY() + offsetY;
//the bounds of left eye
RectF leftEyeBounds = new RectF(rightEyeCenterX - mEyeCircleRadius, rightEyeCenterY - mEyeCircleRadius,
rightEyeCenterX + mEyeCircleRadius, rightEyeCenterY + mEyeCircleRadius);
path.addArc(leftEyeBounds, 180, -(DEGREE_180 + 15));
//the above radian of of the eye
path.quadTo(leftEyeBounds.right - mAboveRadianEyeOffsetX, leftEyeBounds.top + mEyeCircleRadius * 0.2f,
leftEyeBounds.right - mAboveRadianEyeOffsetX / 4.0f, leftEyeBounds.top - mEyeCircleRadius * 0.15f);
return path;
}
代码示例来源:origin: dinuscxj/LoadingDrawable
private Path createWaterPath(RectF waterRect, float progress) {
Path path = new Path();
path.moveTo(waterRect.left, waterRect.top);
//Similar to the way draw the bottle's bottom sides
float radius = (waterRect.width() - mStrokeWidth) / 2.0f;
float centerY = waterRect.bottom - 0.86f * radius;
float bottleBottomWidth = waterRect.width() / 2.0f;
RectF bodyRect = new RectF(waterRect.left, centerY - radius, waterRect.right, centerY + radius);
path.addArc(bodyRect, 187.5f, -67.5f);
path.lineTo(waterRect.centerX() - bottleBottomWidth / 2.0f, waterRect.bottom);
path.lineTo(waterRect.centerX() + bottleBottomWidth / 2.0f, waterRect.bottom);
path.addArc(bodyRect, 60, -67.5f);
//draw the water waves
float cubicXChangeSize = waterRect.width() * 0.35f * progress;
float cubicYChangeSize = waterRect.height() * 1.2f * progress;
path.cubicTo(waterRect.left + waterRect.width() * 0.80f - cubicXChangeSize, waterRect.top - waterRect.height() * 1.2f + cubicYChangeSize,
waterRect.left + waterRect.width() * 0.55f - cubicXChangeSize, waterRect.top - cubicYChangeSize,
waterRect.left, waterRect.top - mStrokeWidth / 2.0f);
path.lineTo(waterRect.left, waterRect.top);
return path;
}
代码示例来源:origin: dinuscxj/LoadingDrawable
private Path createBottlePath(RectF bottleRect) {
float bottleneckWidth = bottleRect.width() * 0.3f;
float bottleneckHeight = bottleRect.height() * 0.415f;
float bottleneckDecorationWidth = bottleneckWidth * 1.1f;
float bottleneckDecorationHeight = bottleneckHeight * 0.167f;
Path path = new Path();
//draw the left side of the bottleneck decoration
path.moveTo(bottleRect.centerX() - bottleneckDecorationWidth * 0.5f, bottleRect.top);
path.quadTo(bottleRect.centerX() - bottleneckDecorationWidth * 0.5f - bottleneckWidth * 0.15f, bottleRect.top + bottleneckDecorationHeight * 0.5f,
bottleRect.centerX() - bottleneckWidth * 0.5f, bottleRect.top + bottleneckDecorationHeight);
path.lineTo(bottleRect.centerX() - bottleneckWidth * 0.5f, bottleRect.top + bottleneckHeight);
//draw the left side of the bottle's body
float radius = (bottleRect.width() - mStrokeWidth) / 2.0f;
float centerY = bottleRect.bottom - 0.86f * radius;
RectF bodyRect = new RectF(bottleRect.left, centerY - radius, bottleRect.right, centerY + radius);
path.addArc(bodyRect, 255, -135);
//draw the bottom of the bottle
float bottleBottomWidth = bottleRect.width() / 2.0f;
path.lineTo(bottleRect.centerX() - bottleBottomWidth / 2.0f, bottleRect.bottom);
path.lineTo(bottleRect.centerX() + bottleBottomWidth / 2.0f, bottleRect.bottom);
//draw the right side of the bottle's body
path.addArc(bodyRect, 60, -135);
//draw the right side of the bottleneck decoration
path.lineTo(bottleRect.centerX() + bottleneckWidth * 0.5f, bottleRect.top + bottleneckDecorationHeight);
path.quadTo(bottleRect.centerX() + bottleneckDecorationWidth * 0.5f + bottleneckWidth * 0.15f, bottleRect.top + bottleneckDecorationHeight * 0.5f,
bottleRect.centerX() + bottleneckDecorationWidth * 0.5f, bottleRect.top);
return path;
}
代码示例来源:origin: scwang90/SmartRefreshLayout
mBranch.addArc(new RectF(xx[min] - branchSize, yy[min] - branchSize, xx[min] + branchSize, yy[min] + branchSize), 0f, 180f);
for (int i = min; i <= N; i++) {
float f = (i - min) / diff;
代码示例来源:origin: facebook/facebook-android-sdk
borderPath.addArc(new RectF(left, top, left + ovalSize, top + ovalSize), -180, 90);
borderPath.addArc(new RectF(right - ovalSize, top, right, top + ovalSize), -90, 90);
borderPath.addArc(new RectF(right - ovalSize, bottom - ovalSize, right, bottom), 0, 90);
borderPath.addArc(new RectF(left, bottom - ovalSize, left + ovalSize, bottom), 90, 90);
代码示例来源:origin: dinuscxj/LoadingDrawable
path.addArc(arcProgressRect, DEGREE_180 - swipeAngle / 2, swipeAngle);
代码示例来源:origin: siyamed/android-shape-imageview
path.addArc(oval, (float) angleStart, (float) angleExtent);
代码示例来源:origin: huxq17/XRefreshView
@Override
protected void onDraw(Canvas canvas) {
if (mRunning) {
if (mShowLeftEye) {
canvas.drawCircle(mLeftEyePos[0], mLeftEyePos[1], mEyeCircleRadius, mCirclePaint);
}
if (mShowRightEye) {
canvas.drawCircle(mRightEyePos[0], mRightEyePos[1], mEyeCircleRadius, mCirclePaint);
}
if (mFirstStep) {
mArcPath.reset();
mArcPath.addArc(mRectF, mStartAngle, mSweepAngle);
canvas.drawPath(mArcPath, mArcPaint);
} else {
mArcPath.reset();
mArcPath.addArc(mRectF, mStartAngle, mSweepAngle);
canvas.drawPath(mArcPath, mArcPaint);
}
} else {
canvas.drawCircle(mLeftEyePos[0], mLeftEyePos[1], mEyeCircleRadius, mCirclePaint);
canvas.drawCircle(mRightEyePos[0], mRightEyePos[1], mEyeCircleRadius, mCirclePaint);
mArcPath.reset();
mArcPath.addArc(mRectF, mStartAngle, mSweepAngle);
canvas.drawPath(mArcPath, mArcPaint);
}
}
代码示例来源:origin: HotBitmapGG/CreditSesameRingView
/**
* 绘制外层圆环进度和小圆点
*/
private void drawRingProgress(Canvas canvas) {
Path path = new Path();
path.addArc(mMiddleProgressRect, mStartAngle, mCurrentAngle);
PathMeasure pathMeasure = new PathMeasure(path, false);
pathMeasure.getPosTan(pathMeasure.getLength() * 1, pos, tan);
matrix.reset();
matrix.postTranslate(pos[0] - bitmap.getWidth() / 2, pos[1] - bitmap.getHeight() / 2);
canvas.drawPath(path, mArcProgressPaint);
//起始角度不为0时候才进行绘制小圆点
if (mCurrentAngle == 0) {
return;
}
canvas.drawBitmap(bitmap, matrix, mBitmapPaint);
mBitmapPaint.setColor(Color.WHITE);
canvas.drawCircle(pos[0], pos[1], 8, mBitmapPaint);
}
代码示例来源:origin: weexteam/weex-hackernews
path = new Path();
if (mPreCorner.hasInnerCorner()) {
path.addArc(mPreCorner.getOvalIfInnerCornerExist(),
mPreCorner.getAngleBisectorDegree(),
BorderCorner.SWEEP_ANGLE);
} else {
paint.setStrokeWidth(mPreCorner.getOuterCornerRadius());
path.addArc(mPreCorner.getOvalIfInnerCornerNotExist(),
mPreCorner.getAngleBisectorDegree(),
BorderCorner.SWEEP_ANGLE);
path = new Path();
if (mPostCorner.hasInnerCorner()) {
path.addArc(mPostCorner.getOvalIfInnerCornerExist(),
mPostCorner.getAngleBisectorDegree() - BorderCorner.SWEEP_ANGLE,
BorderCorner.SWEEP_ANGLE);
} else {
paint.setStrokeWidth(mPostCorner.getOuterCornerRadius());
path.addArc(mPostCorner.getOvalIfInnerCornerNotExist(),
mPostCorner.getAngleBisectorDegree() - BorderCorner.SWEEP_ANGLE,
BorderCorner.SWEEP_ANGLE);
代码示例来源:origin: AlexMofer/ProjectX
@Override
public void addArc(Path path, float left, float top, float right, float bottom,
float startAngle, float sweepAngle) {
path.addArc(left, top, right, bottom, startAngle, sweepAngle);
}
代码示例来源:origin: bilthon/Android-Speedometer
private void drawScale(Canvas canvas){
onPath.reset();
for(int i = -180; i < (mCurrentSpeed/mMaxSpeed)*180 - 180; i+=4){
onPath.addArc(oval, i, 2f);
}
canvas.drawPath(onPath, onMarkPaint);
}
代码示例来源:origin: CoXier/CheckBox
@Override
public void onAnimationUpdate(ValueAnimator animation) {
float value = (float) animation.getAnimatedValue();
mArcPath.reset();
mArcPath.addArc(mRectF, -159, 360 * value);
postInvalidate();
}
});
代码示例来源:origin: CoXier/CheckBox
@Override
public void onAnimationUpdate(ValueAnimator animation) {
float value = (float) animation.getAnimatedValue();
mArcPath.reset();
mArcPath.addArc(mRectF, -159, 360 * value);
postInvalidate();
}
});
代码示例来源:origin: AlexMofer/ProjectX
@Override
public void addArc(Path path, float left, float top, float right, float bottom,
float startAngle, float sweepAngle) {
final RectF oval = get();
oval.set(left, top, right, bottom);
path.addArc(oval, startAngle, sweepAngle);
put(oval);
}
代码示例来源:origin: 0xZhangKe/ShiZhong
/**
* 绘制外层圆环进度和小圆点
*/
private void drawRingProgress(Canvas canvas) {
Path path = new Path();
path.addArc(mMiddleProgressRect, mStartAngle, mCurrentAngle);
PathMeasure pathMeasure = new PathMeasure(path, false);
pathMeasure.getPosTan(pathMeasure.getLength() * 1, pos, tan);
matrix.reset();
// matrix.postTranslate(pos[0] - bitmap.getWidth() / 2, pos[1] - bitmap.getHeight() / 2);
canvas.drawPath(path, mArcProgressPaint);
}
代码示例来源:origin: florent37/MyLittleCanvas
@Override
protected void update() {
super.update();
path.reset();
path.addArc(new RectF(0, 0, getWidth(), getHeight()), startAngle + addedAngle, endAngle + addedAngle);
}
内容来源于网络,如有侵权,请联系作者删除!