Paint setPathEffect - top ranked examples from Open Source projects

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

This code example shows how to use the following methods:setColor, setPathEffect, setShader, setStyle
This code example shows how to use the following methods:setAntiAlias, setColor, setPathEffect, setStrokeWidth
 
	/** 
	 * Dashed, Red, Width=5; 
	 */ 
	public void setPaintDashed() { 
		this.mPaint.setPathEffect(new DashPathEffect(new float[]{10,5}, 0));
		this.mPaint.setStrokeWidth(5);
		this.mPaint.setColor(Color.RED);
		this.mPaint.setAntiAlias(false);
	} 
 
	/** 
	 * Dashed, Red, Width=5; 
	 */ 
	public void setPaintNormal() { 
		this.mPaint.setStrokeWidth(5);
		this.mPaint.setColor(Color.RED);
		this.mPaint.setAntiAlias(true);
	} 
 
7
CodeRank
This code example shows how to use the following methods:getStrokeWidth, setARGB, setAntiAlias, setPathEffect, setStrokeCap
7
CodeRank
This code example shows how to use the following methods:setAntiAlias, setDither, setPathEffect, setStrokeCap, setStrokeJoin
            return false; 
        } 
         
        this.mCanvas = canvas;
         
        mPen.setAntiAlias(true);            // 线条反走样
        mPen.setDither(true);               // 高精度颜色采样,会略慢
        mPen.setStyle(Paint.Style.STROKE);  // 仅描边
        mPen.setPathEffect(null);           // 实线
        mPen.setStrokeCap(Paint.Cap.ROUND); // 圆端
        mPen.setStrokeJoin(Paint.Join.ROUND); // 折线转角圆弧过渡
        mBrush.setStyle(Paint.Style.FILL);  // 仅填充
        mBrush.setColor(Color.TRANSPARENT); // 默认透明,不填充
        mBrush.setAntiAlias(true);          // 文字反走样
         
        return true; 
    } 
     
    public void endPaint() { 
        this.mCanvas = null;
7
CodeRank
This code example shows how to use the following methods:setAntiAlias, setColor, setPathEffect, setShadowLayer, setStrokeWidth
 
public class PathView extends View {
 
	private static final int DEFAULT_COLOR = 0xBB489FFF;
 
	private Paint paint = new Paint();
	private Path originalPath = new Path();
	private Path drawingPath = new Path();
 
	private double scale = 1;
 
	public PathView( Context context ) {
		super( context );
		setWillNotDraw( false );
		paint.setStyle( Paint.Style.STROKE );
		paint.setAntiAlias( true );
		paint.setColor( DEFAULT_COLOR );
		paint.setStrokeWidth( 7 );
		paint.setShadowLayer( 4, 2, 2, 0x66000000 );
		paint.setPathEffect( new CornerPathEffect( 5 ) );

7
CodeRank
This code example shows how to use the following methods:setColor, setPathEffect, setStrokeWidth, setStyle
 * @see TimelineActivity 
 */ 
public class TimelineView extends View
{ 
    private Paint paint  = new Paint();
    private Paint paint_average = new Paint();
    private Paint paint_grid = new Paint();
    private Path path  = new Path();
    private Path path_average = new Path();
    private Path path_grid = new Path();
    private int width = -1, height = -1;
    private float scalingY, scalingX;
    private float  max;
    private long minTime;
    private boolean sizes = false;
    private ProgressBar progress = null;
     
    /** 
     * Constructor, setting the various color and stroke characteristics for the timeline 
     * @param context Reference to the calling {@link android.content.Context} 

7
CodeRank
This code example shows how to use the following methods:setAntiAlias, setColor, setPathEffect, setStrokeCap, setStrokeWidth
	} 
	 
	public void draw(Canvas canvas, MapCameraInterface mapCamera, MapRenderer mapRenderer, View mapOverlay) {
		Position position = this.application.getOwnLocationInformation().getMC2Position();
        System.out.println(position.getMc2Latitude() + "," + position.getMc2Longitude());
		Paint p = new Paint();
		p.setAntiAlias(true);
		p.setColor(0xFFAAAAAA);
		p.setStrokeWidth(4);
		p.setStrokeCap(Cap.ROUND);
		p.setPathEffect(effects[dottedLineFrameNumber]);
		int[] startCoords = mapCamera.getScreenCoordinate(
		        position.getMc2Latitude(), 
		        position.getMc2Longitude());
		 
		int[] destCoords = mapCamera.getScreenCoordinate((int)destLat, (int)destLong);
		if(isOnScreen(startCoords[0], startCoords[1]) && isOnScreen(destCoords[0], destCoords[1])){
			canvas.drawLine(startCoords[0], startCoords[1], destCoords[0], destCoords[1], p);
		} else { 
 
7
CodeRank
This code example shows how to use the following methods:setAntiAlias, setDither, setPathEffect, setStrokeCap, setStrokeJoin
        } 
 
        this.mCanvas = canvas;
        super.beginPaint(); 
 
        mPen.setAntiAlias(true);
        mPen.setDither(true);
        mPen.setStyle(Paint.Style.STROKE);
        mPen.setPathEffect(null);
        mPen.setStrokeJoin(Paint.Join.ROUND);
        mPen.setStrokeCap(Paint.Cap.ROUND);
        mBrush.setStyle(Paint.Style.FILL);
 
        return true; 
    } 
 
    public void endPaint() { 
        this.mCanvas = null;
        super.endPaint(); 
    } 
7
CodeRank
This code example shows how to use the following methods:setColor, setPathEffect, setStyle
	} 
 
	@Override 
	protected void onDraw(Canvas canvas) {
		super.onDraw(canvas);
		Paint paint = new Paint();
		paint.setStyle(Paint.Style.STROKE);
		paint.setColor(Color.GRAY);
		Path path = new Path();
		path.moveTo(10, 10);
		path.lineTo(800, 10);
		// path.lineTo(460,10); 
		PathEffect effects = new DashPathEffect(new float[] { 5, 5, 5, 5 }, 1);
		paint.setPathEffect(effects);
		canvas.drawPath(path, paint);
	} 
 
} 
6
CodeRank
This code example shows how to use the following methods:setColor, setPathEffect, setStrokeWidth, setStyle
            // Draw crop rect and markers 
            CropDrawingUtils.drawCropRect(canvas, mScreenCropBounds);
            if (!mDoSpot) {
                CropDrawingUtils.drawRuleOfThird(canvas, mScreenCropBounds);
            } else { 
                Paint wpPaint = new Paint();
                wpPaint.setColor(mWPMarkerColor);
                wpPaint.setStrokeWidth(3);
                wpPaint.setStyle(Paint.Style.STROKE);
                wpPaint.setPathEffect(new DashPathEffect(new float[]
                        {mDashOnLength, mDashOnLength + mDashOffLength}, 0));
                p.setColor(mOverlayWPShadowColor);
                CropDrawingUtils.drawWallpaperSelectionFrame(canvas, mScreenCropBounds,
                        mSpotX, mSpotY, wpPaint, p);
            } 
            CropDrawingUtils.drawIndicators(canvas, mCropIndicator, mIndicatorSize,
                    mScreenCropBounds, mCropObj.isFixedAspect(), decode(mCropObj.getSelectState(), mRotation));
        } 
 
    } 
6
CodeRank

Related Paint setPathEffect Questions & Answers:

setPathEffect Method Overview
Set or clear the patheffect object.
See Code Examples for other Android Paint Methods: