emilsjolander / android-FlipView

A small, easy to use android library for implementing flipping between views as seen in the popular Flipboard application
Apache License 2.0
925 stars 273 forks source link

怎样才能将执行的mCamera.rotationX的那个View弄为圆角呢 #88

Closed negier closed 3 years ago

negier commented 4 years ago

我改了这里面的代码,但并没有效果,还是矩形:

private void drawFlippingShadeShine(Canvas canvas) {
        final float degreesFlipped = getDegreesFlipped();
        if (degreesFlipped < 90) {
            final int alpha = (int) ((degreesFlipped / 90f) * MAX_SHINE_ALPHA);
            mShinePaint.setAlpha(alpha);
            canvas.drawRoundRect(isFlippingVertically() ? mBottomRect : mRightRect,
                    30,30,mShinePaint);
        } else {
            final int alpha = (int) ((Math.abs(degreesFlipped - 180) / 90f) * MAX_SHADE_ALPHA);
            mShadePaint.setAlpha(alpha);
            canvas.drawRoundRect(isFlippingVertically() ? mTopRect : mLeftRect,30,30,
                    mShadePaint);
        }
    }
docwei2050 commented 4 years ago

使用xfermode 图层叠加啊,,,

negier commented 4 years ago

使用xfermode 图层叠加啊,,,

他用的是Canvas.clipRect,怎么能用Xfermode。

xinzhang123 commented 3 years ago

好兄弟,解决了吗,我也想加翻转时候的圆角

negier commented 3 years ago

将所有的Canvas.clipRect的地方改为

Path path = new Path();
path.addRoundRect(rect, corner, corner, Path.Direction.CW);
canvas.clipPath(path);

即可