Search in sources :

Example 1 with LPaint

use of com.airbnb.lottie.animation.LPaint in project lottie-android by airbnb.

the class LottieDrawable method ensureSoftwareRenderingObjectsInitialized.

private void ensureSoftwareRenderingObjectsInitialized() {
    if (softwareRenderingCanvas != null) {
        return;
    }
    softwareRenderingCanvas = new Canvas();
    softwareRenderingTransformedBounds = new RectF();
    softwareRenderingOriginalCanvasMatrix = new Matrix();
    softwareRenderingOriginalCanvasMatrixInverse = new Matrix();
    canvasClipBounds = new Rect();
    canvasClipBoundsRectF = new RectF();
    softwareRenderingPaint = new LPaint();
    softwareRenderingSrcBoundsRect = new Rect();
    softwareRenderingDstBoundsRect = new Rect();
    softwareRenderingDstBoundsRectF = new RectF();
}
Also used : RectF(android.graphics.RectF) Rect(android.graphics.Rect) Matrix(android.graphics.Matrix) Canvas(android.graphics.Canvas) LPaint(com.airbnb.lottie.animation.LPaint)

Example 2 with LPaint

use of com.airbnb.lottie.animation.LPaint in project lottie-android by airbnb.

the class Utils method renderPath.

/**
 * For testing purposes only. DO NOT USE IN PRODUCTION.
 */
@SuppressWarnings("unused")
public static Bitmap renderPath(Path path) {
    RectF bounds = new RectF();
    path.computeBounds(bounds, false);
    Bitmap bitmap = Bitmap.createBitmap((int) bounds.right, (int) bounds.bottom, Bitmap.Config.ARGB_8888);
    Canvas canvas = new Canvas(bitmap);
    Paint paint = new LPaint();
    paint.setAntiAlias(true);
    paint.setColor(Color.BLUE);
    canvas.drawPath(path, paint);
    return bitmap;
}
Also used : RectF(android.graphics.RectF) Bitmap(android.graphics.Bitmap) Canvas(android.graphics.Canvas) LPaint(com.airbnb.lottie.animation.LPaint) LPaint(com.airbnb.lottie.animation.LPaint) Paint(android.graphics.Paint)

Aggregations

Canvas (android.graphics.Canvas)2 RectF (android.graphics.RectF)2 LPaint (com.airbnb.lottie.animation.LPaint)2 Bitmap (android.graphics.Bitmap)1 Matrix (android.graphics.Matrix)1 Paint (android.graphics.Paint)1 Rect (android.graphics.Rect)1