PathsDrawable.java 文件源码

java
阅读 27 收藏 0 点赞 0 评论 0

项目:GitHub 作者:
@Override
public void draw(@NonNull Canvas canvas) {
    Rect bounds = getBounds();
    int width = bounds.width();
    int height = bounds.height();
    if (mPaint.getAlpha() == 0xFF) {
        canvas.save();
        canvas.translate(bounds.left-mStartX, bounds.top-mStartY);
        if (mPaths != null) {
            for (int i = 0; i < mPaths.size(); i++) {
                if (mColors != null && i < mColors.size()) {
                    mPaint.setColor(mColors.get(i));
                }
                canvas.drawPath(mPaths.get(i), mPaint);
            }
            mPaint.setAlpha(0xFF);
        }
        canvas.restore();
    } else {
        createCachedBitmapIfNeeded(width, height);
        if (!canReuseCache()) {
            updateCachedBitmap(width, height);
            updateCacheStates();
        }
        canvas.drawBitmap(mCachedBitmap, bounds.left, bounds.top, mPaint);
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号