Path addArc - 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 addArc method.

This code example shows how to use the following methods:addArc
        final Rect cropRect = new Rect((width - square) / 2, (height - square) / 2, square, square);
        final RectF circleRect = new RectF(0f, 0f, mSize, mSize);
        circleRect.inset(mStrokeWidth / 2f, mStrokeWidth / 2f);
        circleRect.inset(mShadowRadius, mShadowRadius);
 
        final Path fillPath = new Path();
        fillPath.addArc(circleRect, 0f, 360f);
 
        canvas.drawColor(0, PorterDuff.Mode.CLEAR);
 
        // opaque circle matte 
        mPaint = new Paint();
        mPaint.setAntiAlias(true);
        mPaint.setColor(Color.BLACK);
        mPaint.setStyle(Paint.Style.FILL);
        canvas.drawPath(fillPath, mPaint);
 
        // mask in the icon where the bitmap is opaque 
        mPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_ATOP));
        canvas.drawBitmap(bitmap, cropRect, circleRect, mPaint);
8
CodeRank
This code example shows how to use the following methods:addArc
        final Rect cropRect = new Rect((width - square) / 2, (height - square) / 2, square, square);
        final RectF circleRect = new RectF(0f, 0f, mSize, mSize);
        circleRect.inset(mStrokeWidth / 2f, mStrokeWidth / 2f);
        circleRect.inset(mShadowRadius, mShadowRadius);
 
        final Path fillPath = new Path();
        fillPath.addArc(circleRect, 0f, 360f);
 
        canvas.drawColor(0, PorterDuff.Mode.CLEAR);
 
        // opaque circle matte 
        mPaint = new Paint();
        mPaint.setAntiAlias(true);
        mPaint.setColor(Color.BLACK);
        mPaint.setStyle(Paint.Style.FILL);
        canvas.drawPath(fillPath, mPaint);
 
        // mask in the icon where the bitmap is opaque 
        mPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_ATOP));
        canvas.drawBitmap(icon, cropRect, circleRect, mPaint);
7
CodeRank
This code example shows how to use the following methods:addArc, lineTo, moveTo, setFillType
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:addArc, close, lineTo, moveTo
	private int height;
	private int offsetX;
	private int offsetY;
 
	public Pawn() { 
		Path path = new Path();
		path.moveTo(10.0f, 30.0f);
		path.lineTo(5.0f, 10.0f);
		path.addArc(new RectF(4, 0, 16, 15), -180, 180);
		path.lineTo(10.0f, 30.0f);
		path.close();
 
		Shape s = new PathShape(path, 20, 30);
		setShape(s);
 
		Paint p = getPaint();
		p.setColor(Color.RED);
		p.setStyle(Paint.Style.FILL_AND_STROKE);
		p.setStrokeWidth(1);
 
6
CodeRank
This code example shows how to use the following methods:addArc
        final Rect cropRect = new Rect((width - square) / 2, (height - square) / 2, square, square);
        final RectF circleRect = new RectF(0f, 0f, mSize, mSize);
        circleRect.inset(mStrokeWidth / 2f, mStrokeWidth / 2f);
        circleRect.inset(mShadowRadius, mShadowRadius);
 
        final Path fillPath = new Path();
        fillPath.addArc(circleRect, 0f, 360f);
 
        canvas.drawColor(0, PorterDuff.Mode.CLEAR);
 
        // opaque circle matte 
        mPaint = new Paint();
        mPaint.setAntiAlias(true);
        mPaint.setColor(Color.BLACK);
        mPaint.setStyle(Paint.Style.FILL);
        canvas.drawPath(fillPath, mPaint);
 
        // mask in the icon where the bitmap is opaque 
        mPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_ATOP));
        canvas.drawBitmap(bitmap, cropRect, circleRect, mPaint);
6
CodeRank
This code example shows how to use the following methods:addArc, computeBounds, lineTo, moveTo
	public boolean InArea(float x, float y) {
		RectF rectF = new RectF();
		if (currentPath == null) {
			getCurrentPath(); 
		} 
		currentPath.computeBounds(rectF, true);
		Region region = new Region();
		region.setPath(currentPath, new Region((int) rectF.left,
				(int) rectF.top, (int) rectF.right, (int) rectF.bottom));
		if (region.contains((int) x, (int) y)) {
			return true; 
		} else { 
			return false; 
		} 
	} 
 
	/** 
	 * 计算当前半小时段的角度 
	 *  
	 * @param iHour 

6
CodeRank
This code example shows how to use the following methods:addArc, close, moveTo
		 
		dpPos = new PointF(x,y);
		dpVel = new PointF(0,0.01f);
		 
		// Create the shapes to draw 
		drawable = new Path();
		if(!isLine){
			if(isSemi) {
				drawable.moveTo(x, y);
				drawRect = new RectF(dpPos.x-radius, dpPos.y-radius, dpPos.x+radius, dpPos.y);
				drawable.addArc(new RectF(dpPos.x-radius, dpPos.y-radius, dpPos.x+radius, dpPos.y+radius), 180, 180);
				drawable.close();
			} else { 
				drawable.moveTo(x, y);
				drawRect = new RectF(dpPos.x-r, dpPos.y-r, dpPos.x+r, dpPos.y+r);
				drawable.addCircle(dpPos.x, dpPos.y, r, Path.Direction.CW);
			} 
		} else { 
			// make line 
			drawable.moveTo(0,0);
6
CodeRank
This code example shows how to use the following methods:addArc, moveTo
		float widths[] = new float[1];
		mScalePaint.getTextWidths("...", 0, 1, widths);
		mLetterWidth = widths[0];
 
		// create a curved path for drawing the text scale on 
		mScalePath = new Path();
 
		float h = inth;
		float w = intw;
 
		float middle = h*0.47f;
		float sidePadding = w*0.02f;
		float ovalHeight = h*0.14f;
 
		mScalePath.moveTo(sidePadding, middle);
		mScalePath.addArc(new RectF(sidePadding,
				middle-ovalHeight,
				w-sidePadding,
				middle+ovalHeight),
				150, -120); 
 
6
CodeRank
This code example shows how to use the following methods:addArc, lineTo, moveTo
		RectF rectArc = new RectF(mCenter.x - fLen/2,
					mCenter.y - fLen/2,
					mCenter.x + fLen/2,
					mCenter.y + fLen/2);
		// build path for marker 
		Path tempPath = new Path();
		// at angle measurement arc to path 
		tempPath.addArc(rectArc, (float) 0, (float) - dTemp);
		// prep path for drawing measurement line 
		tempPath.moveTo(mCenter.x, mCenter.y);
		 
		float offsetx = fLen*2 * (float) Math.cos(dAngle);
		float offsety = fLen*2 * (float) Math.sin(dAngle);
		 
		// set endpoint for measurement line		   
		tempPath.lineTo(mCenter.x + offsetx, 
				mCenter.y + offsety);
		// set the marker 
		mMarker.set(new Path(tempPath));
 
		//Log.v(TAG, CLASS + "f: " + finalAngle); 
5
CodeRank

Related Path addArc Questions & Answers:

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