Search in sources :

Example 86 with Path

use of android.graphics.Path in project LoadingView by ldoublem.

the class LVRingProgress method drawProgress.

private void drawProgress(Canvas canvas, Paint paint, int sweepAngle) {
    paint.reset();
    paint.setAntiAlias(true);
    paint.setStrokeWidth(mPadding);
    paint.setStyle(Paint.Style.STROKE);
    Path pathProgress = new Path();
    pathProgress.addArc(rectFBg, -90, sweepAngle);
    Shader mShader = new LinearGradient(rectFBg.left, rectFBg.top, rectFBg.left, rectFBg.bottom, new int[] { ProStartColor, ProEndColor }, new float[] { 0f, 1f }, Shader.TileMode.CLAMP);
    paint.setShader(mShader);
    paint.setStrokeCap(Paint.Cap.ROUND);
    paint.setStrokeJoin(Paint.Join.ROUND);
    canvas.drawPath(pathProgress, paint);
    paint.setShader(null);
    mPaintText.setTextSize(mPaint.getStrokeWidth() / 2);
    String text = String.valueOf((int) (sweepAngle / MaxAngle * 100)) + "%";
    canvas.drawTextOnPath(text, pathProgress, (float) (Math.PI * rectFBg.width() * (sweepAngle / MaxAngle) - getFontlength(mPaintText, text) * 1.5f), getFontHeight(mPaintText) / 3, mPaintText);
}
Also used : Path(android.graphics.Path) LinearGradient(android.graphics.LinearGradient) Shader(android.graphics.Shader)

Example 87 with Path

use of android.graphics.Path in project LoadingView by ldoublem.

the class LVRingProgress method getmBitmapBg.

private Bitmap getmBitmapBg(Paint paint) {
    Canvas canvas = null;
    if (mBitmapBg == null) {
        mBitmapBg = Bitmap.createBitmap(getMeasuredWidth(), getMeasuredHeight(), Bitmap.Config.ARGB_8888);
        canvas = new Canvas(mBitmapBg);
        //            paint.reset();
        paint.setAntiAlias(true);
        paint.setStrokeWidth(mPadding);
        paint.setStyle(Paint.Style.STROKE);
        //            paint.setColor(Color.rgb(241, 241, 241));
        Path pathBg = new Path();
        pathBg.addArc(rectFBg, 0, 360);
        paint.setShadowLayer(mPadding / 3, 0, mPadding / 4, Color.argb(100, 0, 0, 0));
        canvas.drawPath(pathBg, paint);
    }
    return mBitmapBg;
}
Also used : Path(android.graphics.Path) Canvas(android.graphics.Canvas)

Example 88 with Path

use of android.graphics.Path in project LoadingView by ldoublem.

the class LVBlazeWood method drawFire2.

private void drawFire2(Canvas canvas) {
    int color = (Integer) evaluator.evaluate(mAnimatedValue, Color.rgb(232, 132, 40), Color.rgb(223, 86, 33));
    mPaintFire.setColor(color);
    RectF rectFire2 = new RectF();
    rectFire2.bottom = this.rectFire2.centerY() + rectFire3.height() / 2 + +(this.rectFire2.height() / 2 - rectFire3.height() / 2) * (1 - mAnimatedValue) - (this.rectFire2.centerY() - this.rectFire3.centerY()) * mAnimatedValue;
    rectFire2.top = this.rectFire2.centerY() - rectFire3.height() / 2 + -(this.rectFire2.height() / 2 - rectFire3.height() / 2) * (1 - mAnimatedValue) - (this.rectFire2.centerY() - this.rectFire3.centerY()) * mAnimatedValue;
    rectFire2.left = this.rectFire2.centerX() - rectFire3.width() / 2 + -(this.rectFire2.height() / 2 - rectFire3.width() / 2) * (1 - mAnimatedValue) + (this.rectFire3.width() / 3 * mAnimatedValue);
    rectFire2.right = this.rectFire2.centerX() + rectFire3.width() / 2 + +(this.rectFire2.height() / 2 - rectFire3.width() / 2) * (1 - mAnimatedValue) + (this.rectFire3.width() / 3 * mAnimatedValue);
    Path pathFire = new Path();
    pathFire.moveTo(rectFire2.centerX(), rectFire2.top);
    pathFire.lineTo(rectFire2.right, rectFire2.centerY());
    pathFire.lineTo(rectFire2.centerX(), rectFire2.bottom);
    pathFire.lineTo(rectFire2.left, rectFire2.centerY());
    pathFire.close();
    canvas.drawPath(pathFire, mPaintFire);
}
Also used : RectF(android.graphics.RectF) Path(android.graphics.Path) Paint(android.graphics.Paint)

Example 89 with Path

use of android.graphics.Path in project LoadingView by ldoublem.

the class LVBlazeWood method drawFire0.

private void drawFire0(Canvas canvas) {
    int color = (Integer) evaluator.evaluate(mAnimatedValue, Color.rgb(255, 220, 1), Color.rgb(240, 169, 47));
    mPaintFire.setColor(color);
    Path pathFire = new Path();
    RectF rectFire0 = new RectF();
    rectFire0.top = this.rectFire0.centerY() - (this.rectFire1.height() / 2 - this.rectFire0.height() / 2) * mAnimatedValue - (this.rectFire0.centerY() - this.rectFire1.centerY()) * mAnimatedValue;
    rectFire0.bottom = this.rectFire0.centerY() + (this.rectFire1.height() / 2 - this.rectFire0.height() / 2) * mAnimatedValue - (this.rectFire0.centerY() - this.rectFire1.centerY()) * mAnimatedValue;
    rectFire0.left = this.rectFire0.centerX() - (this.rectFire1.width() / 2 - this.rectFire0.width() / 2) * mAnimatedValue - rectFire1.width() / 5 * mAnimatedValue;
    rectFire0.right = this.rectFire0.centerX() + (this.rectFire1.width() / 2 - this.rectFire0.width() / 2) * mAnimatedValue - rectFire1.width() / 5 * mAnimatedValue;
    pathFire.moveTo(rectFire0.centerX(), rectFire0.top);
    pathFire.lineTo(rectFire0.right, rectFire0.centerY());
    pathFire.lineTo(rectFire0.centerX(), rectFire0.bottom);
    pathFire.lineTo(rectFire0.left, rectFire0.centerY());
    pathFire.close();
    canvas.drawPath(pathFire, mPaintFire);
}
Also used : Path(android.graphics.Path) RectF(android.graphics.RectF) Paint(android.graphics.Paint)

Example 90 with Path

use of android.graphics.Path in project LoadingView by ldoublem.

the class LVBlazeWood method drawFire3.

private void drawFire3(Canvas canvas) {
    mPaintFire.setColor(Color.rgb(223, 86, 33));
    RectF rectFire3 = new RectF();
    rectFire3.bottom = this.rectFire3.centerY() + this.rectFire3.height() / 2 * (1 - mAnimatedValue) - (this.rectFire3.height() * 0.75f) * mAnimatedValue;
    rectFire3.top = this.rectFire3.centerY() - this.rectFire3.height() / 2 * (1 - mAnimatedValue) - (this.rectFire3.height() * 0.75f) * mAnimatedValue;
    rectFire3.left = this.rectFire3.centerX() - this.rectFire3.height() / 2 * (1 - mAnimatedValue) - this.rectFire3.width() / 3 * mAnimatedValue;
    rectFire3.right = this.rectFire3.centerX() + this.rectFire3.height() / 2 * (1 - mAnimatedValue) - this.rectFire3.width() / 3 * mAnimatedValue;
    ;
    Path pathFire = new Path();
    pathFire.moveTo(rectFire3.centerX(), rectFire3.top);
    pathFire.lineTo(rectFire3.right, rectFire3.centerY());
    pathFire.lineTo(rectFire3.centerX(), rectFire3.bottom);
    pathFire.lineTo(rectFire3.left, rectFire3.centerY());
    pathFire.close();
    canvas.drawPath(pathFire, mPaintFire);
}
Also used : RectF(android.graphics.RectF) Path(android.graphics.Path)

Aggregations

Path (android.graphics.Path)631 Paint (android.graphics.Paint)237 RectF (android.graphics.RectF)142 Rect (android.graphics.Rect)40 Canvas (android.graphics.Canvas)39 Matrix (android.graphics.Matrix)36 TextPaint (android.text.TextPaint)27 Bitmap (android.graphics.Bitmap)26 ObjectAnimator (android.animation.ObjectAnimator)18 LinearGradient (android.graphics.LinearGradient)18 PointF (android.graphics.PointF)18 Point (android.graphics.Point)16 View (android.view.View)16 RadialGradient (android.graphics.RadialGradient)15 Animator (android.animation.Animator)13 AnimatorListenerAdapter (android.animation.AnimatorListenerAdapter)12 PathMeasure (android.graphics.PathMeasure)11 PropertyValuesHolder (android.animation.PropertyValuesHolder)10 InflateException (android.view.InflateException)10 ViewGroup (android.view.ViewGroup)10