Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bottom edge is not blurred correctly #125

Closed
Viscaria233 opened this issue Oct 30, 2020 · 1 comment
Closed

Bottom edge is not blurred correctly #125

Viscaria233 opened this issue Oct 30, 2020 · 1 comment

Comments

@Viscaria233
Copy link

Version 1.6.4
Samsung Galaxy Note 10+ 5G

Simply draw some background then make a BlurView with height=36dp (equals to 104px on my device)
Screenshot_20201030-171534_TestApp 1
The bottom edge of BlurView(36dp) looks lighter. But 45dp height works fine.

<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:padding="20px">

    <FrameLayout
        android:id="@+id/bgView"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@drawable/bgimg">
        <FrameLayout
            android:layout_width="200dp"
            android:layout_height="300dp"
            android:background="@drawable/bg2">
        </FrameLayout>
    </FrameLayout>

    <eightbitlab.com.blurview.BlurView
        android:id="@+id/blurView36"
        android:layout_width="300dp"
        android:layout_height="36dp"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintLeft_toLeftOf="parent"
        android:background="#55ffffff">
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="height=36dp(104px)"/>
    </eightbitlab.com.blurview.BlurView>

    <eightbitlab.com.blurview.BlurView
        android:id="@+id/blurView45"
        android:layout_width="300dp"
        android:layout_height="45dp"
        app:layout_constraintTop_toBottomOf="@id/blurView36"
        app:layout_constraintLeft_toLeftOf="parent"
        android:layout_marginTop="20dp"
        android:background="#55ffffff">
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="height=45dp(130px)"/>
    </eightbitlab.com.blurview.BlurView>

</androidx.constraintlayout.widget.ConstraintLayout>
{ blurView: BlurView ->
    blurView.setupWith(bgView)
            .setBlurAlgorithm(RenderScriptBlur(context))
            .setBlurRadius(20f)
            .setFrameClearDrawable(requireActivity().window.decorView.background)
            .setHasFixedTransformationMatrix(true)
}.let {
    it.invoke(blurView36)
    it.invoke(blurView45)
}
@Dimezis
Copy link
Owner

Dimezis commented Nov 2, 2020

Yeah, you're right, it's because I was rounding the height after scaling.
Making a fix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants