Search in sources :

Example 81 with Paint

use of android.graphics.Paint in project UltimateAndroid by cymcsg.

the class HoloCircularProgressBar method updateBackgroundColor.

/**
	 * updates the paint of the background
	 */
private void updateBackgroundColor() {
    mBackgroundColorPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    mBackgroundColorPaint.setColor(mProgressBackgroundColor);
    mBackgroundColorPaint.setStyle(Paint.Style.STROKE);
    mBackgroundColorPaint.setStrokeWidth(mCircleStrokeWidth);
    invalidate();
}
Also used : Paint(android.graphics.Paint)

Example 82 with Paint

use of android.graphics.Paint in project UltimateAndroid by cymcsg.

the class TimelyView method init.

private void init() {
    // A new paint with the style as stroke.
    mPaint = new Paint();
    mPaint.setAntiAlias(true);
    mPaint.setColor(Color.BLACK);
    mPaint.setStrokeWidth(5.0f);
    mPaint.setStyle(Paint.Style.STROKE);
    mPath = new Path();
}
Also used : Path(android.graphics.Path) Paint(android.graphics.Paint)

Example 83 with Paint

use of android.graphics.Paint in project phonegap-plugin-push by phonegap.

the class GCMIntentService method getCircleBitmap.

private Bitmap getCircleBitmap(Bitmap bitmap) {
    final Bitmap output = Bitmap.createBitmap(bitmap.getWidth(), bitmap.getHeight(), Bitmap.Config.ARGB_8888);
    final Canvas canvas = new Canvas(output);
    final int color = Color.RED;
    final Paint paint = new Paint();
    final Rect rect = new Rect(0, 0, bitmap.getWidth(), bitmap.getHeight());
    final RectF rectF = new RectF(rect);
    paint.setAntiAlias(true);
    canvas.drawARGB(0, 0, 0, 0);
    paint.setColor(color);
    float cx = bitmap.getWidth() / 2;
    float cy = bitmap.getHeight() / 2;
    float radius = cx < cy ? cx : cy;
    canvas.drawCircle(cx, cy, radius, paint);
    paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_IN));
    canvas.drawBitmap(bitmap, rect, rect, paint);
    bitmap.recycle();
    return output;
}
Also used : RectF(android.graphics.RectF) Bitmap(android.graphics.Bitmap) Rect(android.graphics.Rect) PorterDuffXfermode(android.graphics.PorterDuffXfermode) Canvas(android.graphics.Canvas) Paint(android.graphics.Paint) SuppressLint(android.annotation.SuppressLint) Paint(android.graphics.Paint)

Example 84 with Paint

use of android.graphics.Paint in project plaid by nickbutcher.

the class ThreadedCommentDrawable method draw.

@Override
public void draw(Canvas canvas) {
    for (int thread = 0; thread < threads; thread++) {
        int left = halfThreadWidth + (thread * (threadWidth + gap));
        canvas.drawLine(left, 0, left, getBounds().bottom, paint);
    }
}
Also used : Paint(android.graphics.Paint)

Example 85 with Paint

use of android.graphics.Paint in project plaid by nickbutcher.

the class GridItemDividerDecoration method onDrawOver.

@Override
public void onDrawOver(Canvas canvas, RecyclerView parent, RecyclerView.State state) {
    if (parent.isAnimating())
        return;
    final int childCount = parent.getChildCount();
    final RecyclerView.LayoutManager lm = parent.getLayoutManager();
    for (int i = 0; i < childCount; i++) {
        final View child = parent.getChildAt(i);
        RecyclerView.ViewHolder viewHolder = parent.getChildViewHolder(child);
        if (requiresDivider(viewHolder)) {
            final int right = lm.getDecoratedRight(child);
            final int bottom = lm.getDecoratedBottom(child);
            // draw the bottom divider
            canvas.drawRect(lm.getDecoratedLeft(child), bottom - dividerSize, right, bottom, paint);
            // draw the right edge divider
            canvas.drawRect(right - dividerSize, lm.getDecoratedTop(child), right, bottom - dividerSize, paint);
        }
    }
}
Also used : RecyclerView(android.support.v7.widget.RecyclerView) RecyclerView(android.support.v7.widget.RecyclerView) View(android.view.View) Paint(android.graphics.Paint)

Aggregations

Paint (android.graphics.Paint)3611 Canvas (android.graphics.Canvas)815 Bitmap (android.graphics.Bitmap)735 RectF (android.graphics.RectF)484 Rect (android.graphics.Rect)400 Path (android.graphics.Path)281 TextPaint (android.text.TextPaint)269 PorterDuffXfermode (android.graphics.PorterDuffXfermode)232 Matrix (android.graphics.Matrix)173 SuppressLint (android.annotation.SuppressLint)148 Point (android.graphics.Point)147 TypedArray (android.content.res.TypedArray)134 BitmapShader (android.graphics.BitmapShader)117 View (android.view.View)103 Drawable (android.graphics.drawable.Drawable)99 BitmapDrawable (android.graphics.drawable.BitmapDrawable)92 ColorMatrix (android.graphics.ColorMatrix)76 ColorMatrixColorFilter (android.graphics.ColorMatrixColorFilter)66 Resources (android.content.res.Resources)65 PorterDuffColorFilter (android.graphics.PorterDuffColorFilter)57