Paint setAntiAlias - 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 setAntiAlias method.

This code example shows how to use the following methods:setAntiAlias, setColor, setXfermode
This code example shows how to use the following methods:setAntiAlias, setColor, setStyle, setXfermode
        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);
 
        // prepare paint for frame drawing 
        mPaint.setXfermode(null);
 
        mScale = 1f;
 

9
CodeRank
This code example shows how to use the following methods:setAntiAlias, setColor, setDither, setFilterBitmap
            radius = r;
        } 
    } 
 
    public PointCloud(Drawable drawable) {
        mPaint = new Paint();
        mPaint.setFilterBitmap(true);
        mPaint.setColor(Color.rgb(255, 255, 255)); // TODO: make configurable
        mPaint.setAntiAlias(true);
        mPaint.setDither(true);
 
        mDrawable = drawable;
        if (mDrawable != null) {
            drawable.setBounds(0, 0, drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight());
        } 
    } 
 
    public void setCenter(float x, float y) {
        mCenterX = x;
        mCenterY = y;
9
CodeRank
This code example shows how to use the following methods:setAntiAlias, setColor, setTextSize
        private final Paint mHugePaint;
 
        CustomTextView(Context c) {
            super(c);
 
            mHugePaint = new Paint();
            mHugePaint.setAntiAlias(true);
            mHugePaint.setColor(0xff000000);
            mHugePaint.setTextSize(300f);
        } 
 
        @Override 
        protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
            setMeasuredDimension(MeasureSpec.getSize(widthMeasureSpec), 3000);
        } 
 
        @Override 
        protected void onDraw(Canvas canvas) {
            super.onDraw(canvas);
            canvas.drawRGB(255, 255, 255);
9
CodeRank
This code example shows how to use the following methods:setAntiAlias
    static class DrawingView extends View {
        private final Paint mPaint;
 
        DrawingView(Context c) {
            super(c);
            mPaint = new Paint();
            mPaint.setAntiAlias(true);
        } 
 
        @Override 
        protected void onDraw(Canvas canvas) {
            canvas.save();
            canvas.translate(dipToPx(getContext(), 400), dipToPx(getContext(), 200));
            canvas.rotate(45.0f);
            canvas.drawRGB(255, 255, 255);
            mPaint.setColor(0xffff0000);
            canvas.drawRect(-80.0f, -80.0f, 80.0f, 80.0f, mPaint);
            canvas.drawRect(0.0f, 0.0f, 220.0f, 220.0f, mPaint);            
            canvas.restore();
        } 
8
CodeRank
This code example shows how to use the following methods:setAntiAlias, setFakeBoldText, setTextSize
            mHugePaint = new Paint();
            mHugePaint.setAntiAlias(true);
            mHugePaint.setColor(0xff000000);
            mHugePaint.setTextSize(300f);
 
            mEventPaint = new TextPaint();
            mEventPaint.setFakeBoldText(true);
            mEventPaint.setAntiAlias(true);
            mEventPaint.setTextSize(14);
        } 
 
        @Override 
        protected void onDraw(Canvas canvas) {
            super.onDraw(canvas);
            canvas.drawRGB(255, 255, 255);
 
            canvas.drawText("Hello OpenGL renderer!", 300, 20, mEventPaint);
             
            mMediumPaint.setStyle(Paint.Style.FILL_AND_STROKE);
            mMediumPaint.setStrokeWidth(2.0f);
8
CodeRank
This code example shows how to use the following methods:setARGB, setAntiAlias, setStrokeCap, setStrokeJoin, setStrokeWidth
			canvas.save();
			canvas.scale(w,h);
			if (!leftArrow) {
				canvas.translate(1, 0);
			} 
			Paint p = new Paint();
			p.setAntiAlias(false);
			p.setARGB(175, 216, 216, 216);
			p.setStyle(Paint.Style.FILL);
			canvas.drawPath(path, p);
			p.setARGB(75, 0, 0, 0);
			p.setStrokeWidth(0.1f);
			p.setStrokeJoin(Join.ROUND);
			p.setStrokeCap(Cap.ROUND);
			p.setAntiAlias(true);
			p.setStyle(Paint.Style.STROKE);
			canvas.drawPath(path, p);
			canvas.restore();
		} 
	} 
} 
8
CodeRank
This code example shows how to use the following methods:setAntiAlias, setColor, setShadowLayer, setStrokeWidth
 * User: qii 
 * Date: 12-12-23 
 */ 
public class CircleProgressView extends View {
 
    private Paint mPaint = new Paint();
    private int progress = 0;
    private int max = 100;
 
    public CircleProgressView(Context context) {
        super(context);
    } 
 
    public CircleProgressView(Context context, AttributeSet attrs) {
        this(context, attrs, 0);
    } 
 
    public CircleProgressView(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
        mPaint.setStrokeWidth(5);

8
CodeRank
This code example shows how to use the following methods:setAntiAlias, setColor, setFakeBoldText, setTextSize
This code example shows how to use the following methods:setAntiAlias, setColor, setXfermode

Related Paint setAntiAlias Questions & Answers:

setAntiAlias Method Overview
Helper for setFlags(), setting or clearing the ANTI_ALIAS_FLAG bit AntiAliasing smooths out the edges of what is being drawn, but is has no impact on the interior of the shape.
See Code Examples for other Android Paint Methods: