Code example for Paint

Methods: setStrokeCap, setStrokeJoin, setStrokeWidth, setStyle

0
 
    /** 
     * Creates paint for doodles. 
     */ 
    public static Paint createPaint() {
        Paint paint = new Paint(Paint.DITHER_FLAG | Paint.ANTI_ALIAS_FLAG);
        paint.setStyle(Paint.Style.STROKE);
        paint.setStrokeJoin(Paint.Join.ROUND);
        paint.setStrokeCap(Paint.Cap.ROUND);
        paint.setStrokeWidth(15);
        return paint;
    } 
 
    public Doodle(int color, PointF startPoint) {
        this.color = Color.argb(192, Color.red(color), Color.green(color), Color.blue(color));
        normalizedPath.moveTo(startPoint.x, startPoint.y);
        points.add(startPoint);
    } 
 
    /** 
     * Adds control points whose coordinates range from 0 to 1 to construct the doodle path.