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);
}
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;
}
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);
}
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);
}
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);
}
Aggregations