Paint setColor - 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 setColor 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: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: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:setColor, setStrokeWidth, setStyle
This code example shows how to use the following methods:setColor
        this.color = color;
    } 
 
    @Override public void draw(Canvas canvas) {
        if ((color >>> 24) != 0) {
            paint.setColor(color);
            canvas.drawRect(getBounds(), paint);
        } 
    } 
 
    @Override 
    public void setAlpha(int alpha) {
        if (alpha != (color >>> 24)) {
            color = (color & 0x00FFFFFF) | (alpha << 24);
            invalidateSelf();
        } 
    } 
 
    @Override public void setColorFilter(ColorFilter colorFilter) {
        //Ignored 
8
CodeRank
This code example shows how to use the following methods:getFontMetricsInt, measureText, setColor, setTextAlign, setTextSize
This code example shows how to use the following methods:setAntiAlias, setColor, setFakeBoldText, setTextSize

Related Paint setColor Questions & Answers:

setColor Method Overview
Set the paint's color.
See Code Examples for other Android Paint Methods: