use of android.graphics.Paint in project UltimateAndroid by cymcsg.
the class RotaryView method drawArc.
public void drawArc(Canvas canvas) {
float start = humidity[0];
for (int i = 1; i < humidity.length; i++) {
paint.setColor(ARC_COLORS[i - 1]);
canvas.drawArc(rect, start - discStart, Sweep[i - 1], true, paint);
start += humidity[i];
if (Sweep[i - 1] < humidity[i]) {
Sweep[i - 1] += SWEEP_INC[i - 1];
}
}
}
use of android.graphics.Paint in project UltimateAndroid by cymcsg.
the class TriangleView method drawTriangle.
public void drawTriangle(Canvas c) {
c.drawText("你超过了全国 " + ratio + "%的人", getWidth() / 2, dp * 2.5f, paint_text);
// 图片大小
float bmpsize = dp * 1.7f;
// 初始y位置
heightCentre = getHeight() / 5;
// 初始x位置
widthCentre = getWidth() / 2 + bmpsize;
float x = 0;
float y = 0;
// x 偏移量
float offsetX = dp * 3.5f;
// y 偏移量
float offsetY = dp * 3.5f;
for (int i = 0; i < tag[lenght - 1]; i++) {
for (int j = 0; j < tag.length; j++) {
if (i == tag[j]) {
// 重置y
y = j * offsetY;
// 重置x
x = x - (j * offsetX + offsetX / 2);
break;
}
}
rectF.set(widthCentre - bmpsize + x, heightCentre - bmpsize + y, widthCentre + bmpsize + x, heightCentre + bmpsize + y);
if (i < than) {
bitmap = defaults;
}
if (i == than) {
bitmap = raiseYourhand;
}
if (i > than) {
bitmap = toLetGo;
}
c.drawBitmap(bitmap, null, rectF, paint);
x += offsetX;
}
}
use of android.graphics.Paint in project UltimateAndroid by cymcsg.
the class HoloCircularProgressBar method updateProgressColor.
/**
* updates the paint of the progress and the thumb to give them a new visual
* style
*/
private void updateProgressColor() {
mProgressColorPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
mProgressColorPaint.setColor(mProgressColor);
mProgressColorPaint.setStyle(Paint.Style.STROKE);
mProgressColorPaint.setStrokeWidth(mCircleStrokeWidth);
mThumbColorPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
mThumbColorPaint.setColor(mProgressColor);
mThumbColorPaint.setStyle(Paint.Style.FILL_AND_STROKE);
mThumbColorPaint.setStrokeWidth(mCircleStrokeWidth);
invalidate();
}
use of android.graphics.Paint in project UltimateAndroid by cymcsg.
the class HoloCircularProgressBar method updateMarkerColor.
/**
* updates the paint of the marker
*/
private void updateMarkerColor() {
mMarkerColorPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
mMarkerColorPaint.setColor(mProgressBackgroundColor);
mMarkerColorPaint.setStyle(Paint.Style.STROKE);
mMarkerColorPaint.setStrokeWidth(mCircleStrokeWidth / 2);
invalidate();
}
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();
}
Aggregations