Path arcTo - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Path arcTo method.

This code example shows how to use the following methods:arcTo, close, lineTo, reset
     */ 
    public ArcShape(float x, float y, float width, float height, float startAngle, float angleExtent, boolean useCenter) {
        this.mOval = new RectF(x, y, x + width, y + height);
        this.mStartAngle = startAngle;
        this.mAngleExtent = angleExtent;
        this.mPath = new Path();
        this.mStartPoint = new PointF();
        this.mEndPoint = new PointF();
        this.mUseCenter = useCenter;
        this.mRegion = new Region();
        update(); 
    } 
 
    /** 
     * Creates a new arc shap from specified location, size, double angles, and useCenter values. 
     * @param x The x-coordinate of upper-left corner of the arc 
     * @param y The y-coordinate of upper-left corner of the arc 
     * @param width The overall width of the full oval of which this arc is a partial section 
     * @param height The overall height of the full oval of which this arc is a partial section 
     * @param startAngle The starting angle of the arc in degrees 

7
CodeRank
This code example shows how to use the following methods:arcTo, close, moveTo, reset
 
		super.onSizeChanged(w, h, oldw, oldh);
	} 
 
	private void updatePath(final int w, final int h) {
		path.reset();
 
		if (progress == 0) {
			path.close();
		} else if (progress < maxProgress) {
			final float angle = progress * 360 / maxProgress;
 
			path.moveTo(w / 2f, h / 2f);
			path.arcTo(new RectF(1, 1, w - 1, h - 1), 270, angle);
			path.close();
		} else { 
			path.addCircle(w / 2f, h / 2f, (w / 2f) - 1, Direction.CW);
		} 
	} 
 
7
CodeRank
This code example shows how to use the following methods:arcTo
    private class GraphView extends View implements SensorEventListener
    { 
        private Bitmap  mBitmap;
        private Paint   mPaint = new Paint();
        private Canvas  mCanvas = new Canvas();
        private Path    mPath = new Path();
        private RectF   mRect = new RectF();
        private float   mLastValues[] = new float[3*2];
        private float   mOrientationValues[] = new float[3];
        private int     mColors[] = new int[3*2];
        private float   mLastX;
        private float   mScale[] = new float[2];
        private float   mYOffset;
        private float   mMaxX;
        private float   mSpeed = 1.0f;
        private float   mWidth;
        private float   mHeight;
         
        public GraphView(Context context) {
            super(context);

6
CodeRank
This code example shows how to use the following methods:arcTo
    private class GraphView extends View implements SensorEventListener
    { 
        private Bitmap  mBitmap;
        private Paint   mPaint = new Paint();
        private Canvas  mCanvas = new Canvas();
        private Path    mPath = new Path();
        private RectF   mRect = new RectF();
        private float   mLastValues[] = new float[3*2];
        private float   mOrientationValues[] = new float[3];
        private int     mColors[] = new int[3*2];
        private float   mLastX;
        private float   mScale[] = new float[2];
        private float   mYOffset;
        private float   mMaxX;
        private float   mSpeed = 1.0f;
        private float   mWidth;
        private float   mHeight;
         
        public GraphView(Context context) {
            super(context);

6
CodeRank
This code example shows how to use the following methods:addArc, addCircle, addOval, addRect, addRoundRect
        } 
    } 
 
    private void drawPath(Canvas canvas) {
 
        Path path = new Path();
 
        // 弧を追加 
        RectF oval = new RectF(10, 10, 60, 60);
        path.addArc(oval, 180, 90);
 
        // 円を追加 
        path.addCircle(95, 35, 25, Path.Direction.CW);
 
        // 楕円を追加 
        RectF oval2 = new RectF(130, 10, 230, 60);
        path.addOval(oval2, Path.Direction.CW);
 
        // 四角形を追加 
        RectF rect = new RectF(10, 70, 60, 120);

6
CodeRank
This code example shows how to use the following methods:arcTo, close, lineTo, moveTo
		canvas.drawBitmap(bitmap, 0, 0, paint2);
		// bitmap.recycle(); 
	} 
 
	private void drawLiftUp(Canvas canvas) {
		Path path = new Path();
		path.moveTo(0, roundHeight);
		path.lineTo(0, 0);
		path.lineTo(roundWidth, 0);
		path.arcTo(new RectF(0, 0, roundWidth * 2, roundHeight * 2), -90, -90);
		path.close();
		canvas.drawPath(path, paint);
	} 
 
	private void drawLiftDown(Canvas canvas) {
		Path path = new Path();
		path.moveTo(0, getHeight() - roundHeight);
		path.lineTo(0, getHeight());
		path.lineTo(roundWidth, getHeight());
		path.arcTo(new RectF(0, getHeight() - roundHeight * 2,
6
CodeRank
This code example shows how to use the following methods:arcTo, close, lineTo, moveTo, rewind
        w.arc2.inset(-w.r2, -w.r2);
        return true; 
    } 
 
    private static void createPath(final Path path, final WorkingSet w) {
        path.rewind();
        // Trail cap at P1. 
        path.moveTo(w.p1x, w.p1y);
        path.arcTo(w.arc1, w.aa, w.a1);
        // Trail cap at P2. 
        path.moveTo(w.p2x, w.p2y);
        path.arcTo(w.arc2, w.aa, w.a2);
        // Two trapezoids connecting P1 and P2. 
        path.moveTo(w.p1ax, w.p1ay);
        path.lineTo(w.p1x, w.p1y);
        path.lineTo(w.p1bx, w.p1by);
        path.lineTo(w.p2bx, w.p2by);
        path.lineTo(w.p2x, w.p2y);
        path.lineTo(w.p2ax, w.p2ay);
        path.close();

6
CodeRank
This code example shows how to use the following methods:arcTo, reset
 
    private Path updatePath(Path path, float radius, float start, float sweep) {
        if (path == null) {
            path = new Path();
        } else { 
            path.reset();
        } 
 
        final RectF bB = new RectF(-radius, -radius, radius, radius);
        path.arcTo(bB, start, sweep, true);
        return path;
    } 
 
    private void updateData() { 
        mDateText = DateFormat.getMediumDateFormat(mContext).format(new Date()).toUpperCase();
        mNetworkState = mController.getOperatorState();
        if (mNetworkState != null) {
            mNetworkState = mNetworkState.toUpperCase();
        } 
        mWifiSsid = getWifiSsid().toUpperCase();
6
CodeRank
This code example shows how to use the following methods:arcTo, close, lineTo, moveTo
        paint.setAntiAlias(true);
        paint.setStrokeWidth(2);
        paint.setColor(Color.WHITE);
        paint.setAlpha(75);
 
        Path path = new Path();
 
        if(zone == 1) {
            path.moveTo(150,150);
            path.lineTo(150,0);
            path.arcTo(rectf, 270, 120);
            path.close();
        } else if(zone == 2) {
            path.moveTo(150,150);
            path.arcTo(rectf, 30, 120);
            path.lineTo(150,150);
            path.close();
        } else if(zone == 3) {
            path.moveTo(150,0);
            path.lineTo(150,150);

6
CodeRank
This code example shows how to use the following methods:arcTo, close, lineTo, moveTo, rewind
        mArc1.set(p1x, p1y, p1x, p1y);
        mArc1.inset(-r1, -r1);
        mArc2.set(p2x, p2y, p2x, p2y);
        mArc2.inset(-r2, -r2);
 
        mPath.rewind();
        // Trail cap at P1. 
        mPath.moveTo(p1x, p1y);
        mPath.arcTo(mArc1, angle, a1);
        // Trail cap at P2. 
        mPath.moveTo(p2x, p2y);
        mPath.arcTo(mArc2, angle, a2);
        // Two trapezoids connecting P1 and P2. 
        mPath.moveTo(p1ax, p1ay);
        mPath.lineTo(p1x, p1y);
        mPath.lineTo(p1bx, p1by);
        mPath.lineTo(p2bx, p2by);
        mPath.lineTo(p2x, p2y);
        mPath.lineTo(p2ax, p2ay);
        mPath.close();

6
CodeRank

Related Path arcTo Questions & Answers:

arcTo Method Overview
Append the specified arc to the path as a new contour.
See Code Examples for other Android Path Methods: