Search in sources :

Example 6 with PathEffect

use of android.graphics.PathEffect in project WoWoViewPager by Nightonke.

the class WoWoPathView method onDraw.

@Override
protected void onDraw(Canvas canvas) {
    super.onDraw(canvas);
    PathEffect pathEffect = new DashPathEffect(new float[] { mPathLength, mPathLength }, (mPathLength - mPathLength * mProgress));
    mPaint.setPathEffect(pathEffect);
    canvas.save();
    canvas.translate(getPaddingLeft(), getPaddingTop());
    canvas.drawPath(mPath, mPaint);
    if (headImageId != 0) {
        mPathMeasure.getPosTan(mPathLength * mProgress, mBitmapPosition, mBitmapTan);
        mMatrix.reset();
        float degrees = (float) (Math.atan2(mBitmapTan[1], mBitmapTan[0]) * 180.0 / Math.PI);
        mMatrix.postRotate(degrees, mBitmapOffsetX, mBitmapOffsetY);
        mMatrix.postTranslate(mBitmapPosition[0] - mBitmapOffsetX, mBitmapPosition[1] - mBitmapOffsetY);
        canvas.drawBitmap(mBitmap, mMatrix, null);
    }
    canvas.restore();
}
Also used : DashPathEffect(android.graphics.DashPathEffect) PathEffect(android.graphics.PathEffect) DashPathEffect(android.graphics.DashPathEffect)

Example 7 with PathEffect

use of android.graphics.PathEffect in project UltimateAndroid by cymcsg.

the class DiscrollvablePathLayout method onDraw.

@Override
protected void onDraw(Canvas canvas) {
    super.onDraw(canvas);
    makeAndMeasurePath();
    if (!isInEditMode()) {
        // Apply the dash effect
        float length = mPathMeasure.getLength();
        PathEffect effect = new DashPathEffect(new float[] { length, length }, length * (1 - mRatio));
        mPaint.setPathEffect(effect);
    }
    canvas.drawPath(mPath, mPaint);
}
Also used : DashPathEffect(android.graphics.DashPathEffect) PathEffect(android.graphics.PathEffect) DashPathEffect(android.graphics.DashPathEffect)

Example 8 with PathEffect

use of android.graphics.PathEffect in project assertj-android by square.

the class AbstractPaintAssert method hasPathEffect.

public S hasPathEffect(PathEffect effect) {
    isNotNull();
    PathEffect actualEffect = actual.getPathEffect();
    // 
    assertThat(actualEffect).overridingErrorMessage("Expected path effect <%s> but was <%s>.", effect, // 
    actualEffect).isSameAs(effect);
    return myself;
}
Also used : PathEffect(android.graphics.PathEffect)

Aggregations

PathEffect (android.graphics.PathEffect)8 DashPathEffect (android.graphics.DashPathEffect)7 Paint (android.graphics.Paint)2 Cap (android.graphics.Paint.Cap)2 Join (android.graphics.Paint.Join)2 Style (android.graphics.Paint.Style)2 Path (android.graphics.Path)2 BasicStroke (org.achartengine.renderer.BasicStroke)2 LinearGradient (android.graphics.LinearGradient)1 Shader (android.graphics.Shader)1