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

This code example shows how to use the following methods:addOval, addRect, lineTo, moveTo, setFillType
		super.dispatchDraw(canvas);
	} 
	 
	public static Path createArrow(Point left, Point right, int width, int line_width, int direction)
	{ 
		Path path = new Path();
		if (direction == DIRECTION_LEFT){
			Point tmp = right;
			right = left;
			left = tmp;
		}else{ 
			 
		} 
		float radius = (float) (width * 0.45);
		double angle = Math.atan2(right.y - left.y, right.x - left.x);
		path.setFillType(Path.FillType.WINDING);
		RectF oval = new RectF(left.x-radius, left.y - radius, left.x + radius, left.y + radius);
		path.addOval(oval, Path.Direction.CCW);
		if (direction == DIRECTION_LEFT){
			RectF line = new RectF(left.x, left.y - line_width, right.x+width/2, right.y + line_width);

7
CodeRank
This code example shows how to use the following methods:addRoundRect, close, lineTo, moveTo, reset
		float lineWidth = 2 * mScaledDensity;
		 
		//背景塗りは線の太さを考慮して少し小さくする 
		rect.inset(lineWidth / 2.5f, lineWidth / 2.5f);
		 
		Path path = new Path();
		path.addRoundRect(rect, 20, 20, Direction.CW);
		path.moveTo(startArrowPosX, rect.bottom);
		path.lineTo(arrowTipPosX, rect.bottom + paddingBottom);
		path.lineTo(endArrowPosX, rect.bottom);
		 
		canvas.save(Canvas.CLIP_SAVE_FLAG);
		canvas.clipPath(path);
		 
		//背景色描画 
		canvas.drawColor(0xffffffff);
		 
		//矢印を接続する部分は縁取りを塗らない 
		rect.inset(-lineWidth / 2.5f, -lineWidth / 2.5f);
		path.reset();

6
CodeRank
This code example shows how to use the following methods:addRect, addRoundRect, setFillType
		innerRect.set(bounds.left + padding, bounds.top + padding, bounds.right - padding, bounds.bottom - padding);
 
		if (radius > 0) {
			float outerRadii[] = new float[8];
			Arrays.fill(outerRadii, radius);
			borderPath = new Path();
			borderPath.addRoundRect(outerRect, outerRadii, Direction.CW);
			borderPath.setFillType(FillType.EVEN_ODD);
			innerPath = new Path();
			innerPath.setFillType(FillType.EVEN_ODD);
			if (radius - padding > 0) {
				float innerRadii[] = new float[8];
				Arrays.fill(innerRadii, radius - padding);
				borderPath.addRoundRect(innerRect, innerRadii, Direction.CW);
				innerPath.addRoundRect(innerRect, innerRadii, Direction.CW);
			} else { 
				borderPath.addRect(innerRect, Direction.CW);
				innerPath.addRect(innerRect, Direction.CW);
			} 
		} else { 

6
CodeRank
This code example shows how to use the following methods:close, lineTo, moveTo, setFillType
		int height = getHeight();		
		int width = height;
		 
		float offset =  height * 0.3f;
 
	    Path path = new Path();
	    path.setFillType(Path.FillType.EVEN_ODD);
	    path.moveTo(offset,offset);
	    path.lineTo(offset,height - offset);
	    path.lineTo(width - offset, height/2);
	    path.lineTo(offset,offset);
	    path.close();
 
	    canvas.drawLine((width)/2, 0, (width)/2, height, mPaint);
	    canvas.drawPath(path, mPaint);
	    //invalidate(); 
	} 
	 
	@Override 
	protected void onMeasure(int widthMS, int heightMS) {
6
CodeRank
This code example shows how to use the following methods:addPath, addRect, reset, setFillType
This code example shows how to use the following methods:addArc, lineTo, moveTo, setFillType
This code example shows how to use the following methods:close, lineTo, moveTo, setFillType
This code example shows how to use the following methods:close, lineTo, moveTo, setFillType
        mDisplay = mWindowManager.getDefaultDisplay();
        mPaint = new Paint();
        mFilteredSensorX = 0;
        mFilteredSensorY = 0;
         
        mPath = new Path();
        mPath.setFillType(Path.FillType.EVEN_ODD);
        mPath.moveTo(-50, -50);
        mPath.lineTo(-50, 50);
        mPath.lineTo(50, 0);
        mPath.close();        
    } 
     
    public void setRemote(RoseWheelApp r) {
    	mRemote = r;
    } 
     
    public void startSensors() { 
    	if (!mSensorsStarted) {
    		mSensorManager.registerListener(this, mAccelerometer, SensorManager.SENSOR_DELAY_UI);
6
CodeRank
This code example shows how to use the following methods:close, lineTo, moveTo, setFillType
This code example shows how to use the following methods:lineTo, moveTo, setFillType
	} 
	 
	@Override 
	public void draw(Canvas canvas, MapView mv, boolean shadow)
	{ 
		Path p = new Path();
		p.setFillType(Path.FillType.INVERSE_EVEN_ODD);
		Projection projection = mv.getProjection();
	    Point from = new Point();
	    Point to = new Point();
	    projection.toPixels(p1, from);
	    projection.toPixels(p2, to);
	    p.moveTo(from.x, from.y);
	    p.lineTo(to.x, to.y);
	    Paint mPaint = new Paint();
	    mPaint.setStyle(Style.STROKE);
	    mPaint.setColor(this.cor);
	    mPaint.setStrokeWidth(this.espessura);
	    mPaint.setAntiAlias(true);
	    canvas.drawPath(p, mPaint);
6
CodeRank

Related Path setFillType Questions & Answers:

setFillType Method Overview
Set the path's fill type.
See Code Examples for other Android Path Methods: