Paint mPaint = new Paint(); mPaint.setColor(Color.RED);//Set the color mPaint.setARGB(255, 255, 255, 0);//Set the paint object color range 0~255 mPaint.setAlpha(200) ;//Set alpha opaque, the range is 0~255 mPaint.setAntiAlias(true);//Anti-aliasing mPaint.setStyle(Paint.Style.FILL);//Stroke effect FILL->full black STROKE->edge black FILL_AND_STROKE->all have mPaint.setStrokeWidth(4);//Stroke width mPaint.setStrokeCap(Paint.Cap.ROUND);//Set the rounded corner effect BUTT->default ROUND->rounded corners are redundant SQUARE->square corners are redundant Come out mPaint.setStrokeJoin(Paint.Join.MITER);//Set the corner style mPaint.setShader(new SweepGradient(200, 200, Color.BLUE, Color.RED));//Set the ring renderer mPaint.setXfermode(new PorterDuffXfermode (PorterDuff.Mode.DARKEN));//Set the layer blending mode mPaint.setColorFilter(new LightingColorFilter(0x00fff, 0x000000));//Set the color filter mPaint.setFilterBitmap(true);//Set the bilinear filter mPaint.setMaskFilter(new BlurMaskFilter(10, BlurMaskFilter.Blur.NORMAL));//Set the brush mask filter, pass in the degree and style mPaint.setTextScaleX(3);//Set the text zoom factor mPaint.setTextSize(40) ;//Set the font size mPaint.setTextAlign(Paint.Align.LEFT);//Set the alignment mPaint.setUnderlineText(true);//Set the underline String str = "Android text drawing"; Rect rect = new Rect(); mPaint.getTextBounds(str, 0, str.length(), rect);//Measure the size of the text and save the information to the rect object mPaint.measureText(str);//Get the width of the text mPaint.getFontMetrics();/ /Get font metrics object
android path api record
Guess you like
Origin blog.csdn.net/Small_Wave_Wave/article/details/109307488
Recommended
Ranking