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

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:setColor, setStyle
This code example shows how to use the following methods:setColor, setStyle, setTextAlign, setTextSize
 
    // --- painting code 
 
    @Override 
    protected void onDraw(Canvas canvas) {
        Paint paint = new Paint();
        paint.setColor(BG_COLOR);
        paint.setStyle(Paint.Style.FILL);
        canvas.drawRect(0, 0, getWidth(), getHeight(), paint);
 
        paint.setColor(FILTER_COLOR);
        Path path = new Path();
        path.moveTo(getWidth() * (0.5f - 0.5f * start / max), 0);
        path.lineTo(getWidth() * (0.5f + 0.5f * start / max), 0);
        path.lineTo(getWidth() * (0.5f + 0.5f * end / max), getHeight());
        path.lineTo(getWidth() * (0.5f - 0.5f * end / max), getHeight());
        path.close();
        canvas.drawPath(path, paint);
 
        paint.setColor(TEXT_COLOR);

9
CodeRank
This code example shows how to use the following methods:setColor, setStrokeWidth, setStyle
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:getColor, getStyle, setColor, setStyle
 
	public void drawLeadingMargin(Canvas c, Paint p, int x, int dir, int top,
			int baseline, int bottom, CharSequence text, int start, int end,
			boolean first, Layout l) {
		if (((Spanned) text).getSpanStart(this) == start) {
			Paint.Style style = p.getStyle();
			int oldcolor = 0;
 
			if (mWantColor) {
				oldcolor = p.getColor();
				p.setColor(mColor);
			} 
 
			p.setStyle(Paint.Style.FILL);
 
			c.drawText(mNumber + ".", x - ((mNumber + "").length() * 10), top + 19, p);
 
			if (mWantColor) {
				p.setColor(oldcolor);
			} 

8
CodeRank
This code example shows how to use the following methods:setAntiAlias, setColor, setStrokeWidth, setStyle
    private ArrayList<Slice> mSlices = Lists.newArrayList();
 
    private int mOriginAngle;
    private Matrix mMatrix = new Matrix();
 
    private Paint mPaintOutline = new Paint();
 
    private Path mPathSide = new Path();
    private Path mPathSideOutline = new Path();
 
    private Path mPathOutline = new Path();
 
    private int mSideWidth;
 
    public class Slice { 
        public long value;
 
        public Path path = new Path();
        public Path pathSide = new Path();
        public Path pathOutline = new Path();

8
CodeRank
This code example shows how to use the following methods:setAntiAlias, setStrokeWidth, setStyle
8
CodeRank
This code example shows how to use the following methods:getStrokeWidth, setColor, setStyle
	private float mRadius = 4;
	private float mRadiusInactive = 4;
	private float mRadiusActive = 4;
	private float spacing = 4;
	private int fadeOutTime = 0;
	private final Paint mPaintInactive = new Paint(Paint.ANTI_ALIAS_FLAG);
	private final Paint mPaintActive = new Paint(Paint.ANTI_ALIAS_FLAG);
	private ViewFlow viewFlow;
	private int currentScroll = 0;
	private int currentPosition = 0;
	private int flowWidth = 0;
	private FadeTimer timer;
	public AnimationListener animationListener = this;
	private Animation animation;
	private boolean mCentered = false;
	private boolean mSnap = false;
 
	/** 
	 * Default constructor 
	 *  

8
CodeRank
This code example shows how to use the following methods:setColor, setStrokeWidth, setStyle
 
    @Override 
    public void onDraw(Canvas canvas) {
        super.onDraw(canvas);
        if (DEBUG) {
            Paint pt = new Paint();
            pt.setColor(0x80FFFF00);
            pt.setStrokeWidth(12.0f);
            pt.setStyle(Paint.Style.STROKE);
            canvas.drawRect(0, 0, canvas.getWidth(), canvas.getHeight(), pt);
        } 
    } 
 
    public void cancelExpandHelper() { 
        if (mExpandHelper != null) {
            mExpandHelper.cancel();
        } 
    } 
} 
 
8
CodeRank

Related Paint setStyle Questions & Answers:

setStyle Method Overview
Set the paint's style, used for controlling how primitives' geometries are interpreted (except for drawBitmap, which always assumes Fill).
See Code Examples for other Android Paint Methods: