Search in sources :

Example 11 with Paint

use of android.graphics.Paint in project VirtualApp by asLody.

the class LauncherIconView method init.

private void init(Context context, AttributeSet attrs) {
    mMediumAnimTime = getContext().getResources().getInteger(android.R.integer.config_mediumAnimTime);
    final TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.ProgressImageView);
    try {
        this.mProgress = a.getInteger(R.styleable.ProgressImageView_pi_progress, 0);
        this.mStrokeWidth = a.getDimensionPixelOffset(R.styleable.ProgressImageView_pi_stroke, 8);
        this.mRadius = a.getDimensionPixelOffset(R.styleable.ProgressImageView_pi_radius, 0);
        this.mIsSquare = a.getBoolean(R.styleable.ProgressImageView_pi_force_square, false);
        this.mMaskColor = a.getColor(R.styleable.ProgressImageView_pi_mask_color, Color.argb(180, 0, 0, 0));
        this.mPaint = new Paint();
        mPaint.setColor(mMaskColor);
        mPaint.setAntiAlias(true);
        this.mShimmerPaint = new Paint();
        mShimmerPaint.setColor(Color.WHITE);
    } finally {
        a.recycle();
    }
    mShimmerViewHelper = new ShimmerViewHelper(this, mShimmerPaint, attrs);
}
Also used : TypedArray(android.content.res.TypedArray) Paint(android.graphics.Paint)

Example 12 with Paint

use of android.graphics.Paint in project StepView by baoyachi.

the class VerticalStepViewIndicator method init.

/**
     * init
     */
private void init() {
    mPath = new Path();
    mEffects = new DashPathEffect(new float[] { 8, 8, 8, 8 }, 1);
    //初始化
    mCircleCenterPointPositionList = new ArrayList<>();
    mUnCompletedPaint = new Paint();
    mCompletedPaint = new Paint();
    mUnCompletedPaint.setAntiAlias(true);
    mUnCompletedPaint.setColor(mUnCompletedLineColor);
    mUnCompletedPaint.setStyle(Paint.Style.STROKE);
    mUnCompletedPaint.setStrokeWidth(2);
    mCompletedPaint.setAntiAlias(true);
    mCompletedPaint.setColor(mCompletedLineColor);
    mCompletedPaint.setStyle(Paint.Style.STROKE);
    mCompletedPaint.setStrokeWidth(2);
    mUnCompletedPaint.setPathEffect(mEffects);
    mCompletedPaint.setStyle(Paint.Style.FILL);
    //已经完成线的宽高 set mCompletedLineHeight
    mCompletedLineHeight = 0.05f * defaultStepIndicatorNum;
    //圆的半径  set mCircleRadius
    mCircleRadius = 0.28f * defaultStepIndicatorNum;
    //线与线之间的间距    set mLinePadding
    mLinePadding = 0.85f * defaultStepIndicatorNum;
    //已经完成的icon
    mCompleteIcon = ContextCompat.getDrawable(getContext(), R.drawable.complted);
    //正在进行的icon
    mAttentionIcon = ContextCompat.getDrawable(getContext(), R.drawable.attention);
    //未完成的icon
    mDefaultIcon = ContextCompat.getDrawable(getContext(), R.drawable.default_icon);
    //default draw
    mIsReverseDraw = true;
}
Also used : Path(android.graphics.Path) DashPathEffect(android.graphics.DashPathEffect) Paint(android.graphics.Paint)

Example 13 with Paint

use of android.graphics.Paint in project StickyHeaderListView by sfsheng0322.

the class GlideCircleTransform method circleCrop.

private static Bitmap circleCrop(BitmapPool pool, Bitmap source) {
    if (source == null)
        return null;
    int size = Math.min(source.getWidth(), source.getHeight());
    int x = (source.getWidth() - size) / 2;
    int y = (source.getHeight() - size) / 2;
    Bitmap squared = Bitmap.createBitmap(source, x, y, size, size);
    Bitmap result = pool.get(size, size, Bitmap.Config.ARGB_8888);
    if (result == null) {
        result = Bitmap.createBitmap(size, size, Bitmap.Config.ARGB_8888);
    }
    Canvas canvas = new Canvas(result);
    Paint paint = new Paint();
    paint.setShader(new BitmapShader(squared, BitmapShader.TileMode.CLAMP, BitmapShader.TileMode.CLAMP));
    paint.setAntiAlias(true);
    float r = size / 2f;
    canvas.drawCircle(r, r, r, paint);
    return result;
}
Also used : Bitmap(android.graphics.Bitmap) Canvas(android.graphics.Canvas) Paint(android.graphics.Paint) BitmapShader(android.graphics.BitmapShader) Paint(android.graphics.Paint)

Example 14 with Paint

use of android.graphics.Paint in project CircleBar by songnick.

the class RefreshProgress method drawSlowIndicator.

private void drawSlowIndicator(float startAngle, Canvas canvas) {
    Paint circlePaint = new Paint();
    circlePaint.setAntiAlias(true);
    circlePaint.setColor(Color.parseColor("#A8D7A7"));
    circlePaint.setStrokeWidth(7);
    circlePaint.setStyle(Paint.Style.STROKE);
    canvas.drawPath(getArcPath(), circlePaint);
    int restoreCount = canvas.save();
    canvas.translate(rectF.centerX(), rectF.centerY());
    circlePaint.setStyle(Paint.Style.FILL);
    canvas.drawPath(getBallPath(startAngle + 90), circlePaint);
    canvas.drawPath(getBallPath(startAngle + 90 + 30 + 90), circlePaint);
    canvas.drawPath(getBallPath(startAngle + 90 + 30 + 90 + 30 + 90), circlePaint);
    canvas.restoreToCount(restoreCount);
}
Also used : Paint(android.graphics.Paint) Paint(android.graphics.Paint)

Example 15 with Paint

use of android.graphics.Paint in project CircleBar by songnick.

the class IndicatorRadioButton method initPaint.

private void initPaint() {
    mPaint = new Paint();
    mPaint.setStrokeWidth(getResources().getDimension(R.dimen.default_size));
    mPaint.setAntiAlias(true);
}
Also used : Paint(android.graphics.Paint)

Aggregations

Paint (android.graphics.Paint)2248 Canvas (android.graphics.Canvas)466 Bitmap (android.graphics.Bitmap)415 Rect (android.graphics.Rect)267 RectF (android.graphics.RectF)231 TextPaint (android.text.TextPaint)178 PorterDuffXfermode (android.graphics.PorterDuffXfermode)124 Path (android.graphics.Path)120 Matrix (android.graphics.Matrix)105 TypedArray (android.content.res.TypedArray)81 BitmapDrawable (android.graphics.drawable.BitmapDrawable)75 Drawable (android.graphics.drawable.Drawable)65 BitmapShader (android.graphics.BitmapShader)63 Point (android.graphics.Point)60 SuppressLint (android.annotation.SuppressLint)57 View (android.view.View)54 Resources (android.content.res.Resources)42 Test (org.junit.Test)40 ColorMatrixColorFilter (android.graphics.ColorMatrixColorFilter)39 Typeface (android.graphics.Typeface)39