Search in sources :

Example 66 with Paint

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];
        }
    }
}
Also used : Paint(android.graphics.Paint)

Example 67 with Paint

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;
    }
}
Also used : Paint(android.graphics.Paint)

Example 68 with Paint

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();
}
Also used : Paint(android.graphics.Paint)

Example 69 with Paint

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();
}
Also used : Paint(android.graphics.Paint)

Example 70 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)

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