当前位置: 首页>>代码示例>>Java>>正文


Java Path.addArc方法代码示例

本文整理汇总了Java中android.graphics.Path.addArc方法的典型用法代码示例。如果您正苦于以下问题:Java Path.addArc方法的具体用法?Java Path.addArc怎么用?Java Path.addArc使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.graphics.Path的用法示例。


在下文中一共展示了Path.addArc方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createRightEyeCircle

import android.graphics.Path; //导入方法依赖的package包/类
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;
}
 
开发者ID:ZhuoKeTeam,项目名称:JueDiQiuSheng,代码行数:17,代码来源:GhostsEyeLoadingRenderer.java

示例2: createLeftEyeCircle

import android.graphics.Path; //导入方法依赖的package包/类
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;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:17,代码来源:GhostsEyeLoadingRenderer.java

示例3: initPath

import android.graphics.Path; //导入方法依赖的package包/类
private void initPath() {
    Path mPath = new Path();
    RectF rectF = new RectF(mWidth / 2f - dip2px(1.5f), mHeight / 2f - dip2px(1.5f)
            , mWidth / 2f + dip2px(1.5f), mHeight / 2f + dip2px(1.5f));
    mPath.addArc(rectF, 180f, 180f);
    rectF.set(rectF.left - dip2px(3), rectF.top - dip2px(1.5f), rectF.right, rectF.bottom + dip2px(1.5f));
    mPath.addArc(rectF, 0f, 180f);
    rectF.set(rectF.left, rectF.top - dip2px(1.5f), rectF.right + dip2px(3), rectF.bottom + dip2px(1.5f));
    mPath.addArc(rectF, 180f, 180f);
    rectF.set(rectF.left - dip2px(3), rectF.top - dip2px(1.5f), rectF.right, rectF.bottom + dip2px(1.5f));
    mPath.addArc(rectF, 0f, 180f);

    eye = Bitmap.createBitmap((int) mWidth, (int) mHeight, Bitmap.Config.ARGB_8888);
    Canvas c = new Canvas(eye);
    mPaint.setStrokeWidth(dip2px(1.7f));
    c.drawPath(mPath, mPaint);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:18,代码来源:ConfusingToastView.java

示例4: init

import android.graphics.Path; //导入方法依赖的package包/类
private void init() {
    mPaint = new Paint();
    mPaint.setStyle(Paint.Style.STROKE); // 设置为空心
    mPaint.setStrokeWidth(15); // 宽度
    mPaint.setColor(Color.RED); // 颜色
    mPaint.setStrokeCap(Paint.Cap.ROUND); // 设置画笔为园笔
    mPaint.setAntiAlias(true); // 抗锯齿
    mPath = new Path(); // 路径
    RectF rect = new RectF(-100, -100, 100, 100); // 测定圆弧的范围
    mPath.addArc(rect, -90, 359.9f); // 设置路径范围,起始角度,终止角度
    mPathMeasure = new PathMeasure(mPath, false); // 初始化要截取的路径

    valueAnimator = ValueAnimator.ofFloat(0f, 1f).setDuration(2500);
    valueAnimator.setRepeatCount(ValueAnimator.INFINITE); // 设置动画播放模式
    valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            animationValue = (float) animation.getAnimatedValue();
            invalidate();
        }
    });
    valueAnimator.start();
}
 
开发者ID:wuhighway,项目名称:DailyStudy,代码行数:24,代码来源:Win8Search.java

示例5: makeBorderPath

import android.graphics.Path; //导入方法依赖的package包/类
private static void makeBorderPath(Path borderPath, int w, int h, float inset) {
	w -= inset;
	h -= inset;
	borderPath.reset();
	borderPath.moveTo(w, inset);
	borderPath.lineTo(w, h);
	borderPath.lineTo(inset, h);
	borderPath.addArc(new RectF(inset, inset, 2 * w, 2 * h), 180, 270);
	borderPath.close();
}
 
开发者ID:salim3dd,项目名称:hsv-alpha-color-picker,代码行数:11,代码来源:HueSatView.java

示例6: createBottlePath

import android.graphics.Path; //导入方法依赖的package包/类
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;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:35,代码来源:WaterBottleLoadingRenderer.java

示例7: initPaths

import android.graphics.Path; //导入方法依赖的package包/类
protected void initPaths() {
    mCirclePath = new Path();
    mCirclePath.addArc(mCircleRectF, mStartAngle, mTotalCircleDegrees);

    mCircleProgressPath = new Path();
    mCircleProgressPath.addArc(mCircleRectF, mStartAngle, mProgressDegrees);
}
 
开发者ID:RajneeshSingh007,项目名称:MusicX-music-player,代码行数:8,代码来源:CircularSeekBar.java

示例8: initPaths

import android.graphics.Path; //导入方法依赖的package包/类
/**
 * Initialize the {@code Path} objects with the appropriate values.
 */
protected void initPaths() {
	mCirclePath = new Path();
	mCirclePath.addArc(mCircleRectF, mStartAngle, mTotalCircleDegrees);

	mCircleProgressPath = new Path();
	mCircleProgressPath.addArc(mCircleRectF, mStartAngle, mProgressDegrees);
}
 
开发者ID:sanjaysingh1990,项目名称:Exoplayer2Radio,代码行数:11,代码来源:CircularSeekBar.java

示例9: onDraw

import android.graphics.Path; //导入方法依赖的package包/类
@Override
    protected void onDraw(Canvas canvas) {
        super.onDraw(canvas);
        canvas.translate(mWidth / 2, mHeight / 2);

        Path path = new Path();
/*      // path close test
        path.lineTo(100, 100);
        path.moveTo(200, 200);
        path.lineTo(200, 0);

        path.close();*/
/*
        // Clockwise and Counter-Clockwise test
        path.addRect(-200,-200,200,200, Path.Direction.CW);

        path.setLastPoint(-300,300);                // <-- 重置最后一个点的位置
*/

       /*
        // add path test
        canvas.scale(1, -1);
        Path src = new Path();

        path.addRect(-200, -200, 200, 200, Path.Direction.CW);
        src.addCircle(0, 0, 100, Path.Direction.CW);

        path.addPath(src, 0, 200);
        mPaint.setColor(Color.BLACK);
*/

        canvas.scale(1, -1);
        path.lineTo(100, 100);
        RectF oval = new RectF(0, 0, 300, 300);
        path.addArc(oval, 0, 270);

        canvas.drawPath(path, mPaint);
    }
 
开发者ID:InnoFang,项目名称:Android-Code-Demos,代码行数:39,代码来源:Sketch.java

示例10: createMoonPath

import android.graphics.Path; //导入方法依赖的package包/类
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;
}
 
开发者ID:ZhuoKeTeam,项目名称:JueDiQiuSheng,代码行数:9,代码来源:DayNightLoadingRenderer.java

示例11: initPaths

import android.graphics.Path; //导入方法依赖的package包/类
/**
 * 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);
}
 
开发者ID:vpaliyX,项目名称:Melophile,代码行数:11,代码来源:CircularSeekBar.java

示例12: calculateItemPositions

import android.graphics.Path; //导入方法依赖的package包/类
/**
 * Calculates the desired positions of all items.
 *
 * @return getActionViewCenter()
 */
private Point calculateItemPositions() {
    // Create an arc that starts from startAngle and ends at endAngle
    // in an area that is as large as 4*radius^2
    final Point center = getActionViewCenter();
    RectF area = new RectF(center.x - radius, center.y - radius, center.x + radius, center.y + radius);

    Path orbit = new Path();
    orbit.addArc(area, startAngle, endAngle - startAngle);

    PathMeasure measure = new PathMeasure(orbit, false);

    // Prevent overlapping when it is a full circle
    int divisor;
    if (Math.abs(endAngle - startAngle) >= 360 || subActionItems.size() <= 1) {
        divisor = subActionItems.size();
    } else {
        divisor = subActionItems.size() - 1;
    }

    // Measure this path, in order to find points that have the same distance between each other
    for (int i = 0; i < subActionItems.size(); i++) {
        float[] coords = new float[]{0f, 0f};
        measure.getPosTan((i) * measure.getLength() / divisor, coords, null);
        // get the x and y values of these points and set them to each of sub action items.
        subActionItems.get(i).x = (int) coords[0] - subActionItems.get(i).width / 2;
        subActionItems.get(i).y = (int) coords[1] - subActionItems.get(i).height / 2;
    }
    return center;
}
 
开发者ID:HitRoxxx,项目名称:FloatingNew,代码行数:35,代码来源:FloatingActionMenu.java

示例13: onDraw

import android.graphics.Path; //导入方法依赖的package包/类
@Override
protected void onDraw(Canvas canvas) {
    //super.onDraw(canvas);
    canvas.save();
    canvas.translate(0,-Ui.cd.getHt(10));

    canvas.save();
    bass.draw(canvas);
    float radius = 10;
    final RectF oval = new RectF();
    oval.set(0, 0, bass.width, bass.height);
    Path ph = new Path();
    ph.setFillType(Path.FillType.WINDING);
    ph.moveTo(bass.width/2, bass.width/2);
    if(angle > 110 - 1){
        ph.addArc(oval,-(200) + 110,angle - 110);
    }else{
        ph.addArc(oval,-(90) - (110 - angle),(110 - angle));
    }
    ph.lineTo(bass.width/2,bass.width/2);

    canvas.clipPath(ph);
    basstop.draw(canvas);
    canvas.restore();

    canvas.save();
    canvas.rotate(-(90+20),XX,YY);
    canvas.rotate(angle,XX,YY);
    bassdot.draw(canvas);
    canvas.restore();

    int val = (angle - 110);
    val = (int) ((100f / 110) * val);
    levelText.setText(val+"",true);
    levelText.draw(canvas);
    canvas.restore();
    super.drawShape(canvas);
    //canvas.drawPath(ph,bass.img.maskPaint);
}
 
开发者ID:KishanV,项目名称:Android-Music-Player,代码行数:40,代码来源:WheelItem.java

示例14: genPath

import android.graphics.Path; //导入方法依赖的package包/类
/**
 * 获得一个指定角度的path
 */
public static Path genPath(RectF mArcRange, Context context, EnumOverScreen overScreen) {
    Path path = new Path();
    int start = 180;
    int overDis = Math.abs(overScreen.getOverScreenDistance());
    overDis = px2dip(context,overDis);
    int startDegree = 0;

    switch (overScreen) {
        case LEFT:
            if (start + overDis > 270) {
                startDegree = 270;
            } else {
                startDegree = start + overDis;
            }

            break;
        case RIGHT:
            if (start - overDis < 90) {
                startDegree = 90;
            } else {
                startDegree = start - overDis;
            }
            break;
        case TOP:
            startDegree = 180;
            break;
    }

    path.addArc(mArcRange, startDegree, 180);
    return path;
}
 
开发者ID:panshen,项目名称:PopupCircleMenu,代码行数:35,代码来源:PathUtil.java

示例15: genDriectPath

import android.graphics.Path; //导入方法依赖的package包/类
/**
 * 根据View的配置产生对应角度的path
 */
public static Path genDriectPath(RectF mArcRange,int mOpenDriction) {
    Path path = new Path();
    int startDegree = 0;
    if (mOpenDriction == PopupCircleView.LEFT) {
        startDegree = 225;
    } else if (mOpenDriction == PopupCircleView.RIGHT) {
        startDegree = 135;
    }
    path.addArc(mArcRange, startDegree, 180);
    return path;
}
 
开发者ID:panshen,项目名称:PopupCircleMenu,代码行数:15,代码来源:PathUtil.java


注:本文中的android.graphics.Path.addArc方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。