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

Use GPUImageFilterGroup causes confusion in the background #395

Closed
xiandanin opened this issue Jun 27, 2018 · 5 comments
Closed

Use GPUImageFilterGroup causes confusion in the background #395

xiandanin opened this issue Jun 27, 2018 · 5 comments

Comments

@xiandanin
Copy link

xiandanin commented Jun 27, 2018

When I use GPUImageFilterGroup, the background has a lot of clutter.

The first time the set group does not have a problem,after the second time, the set group background is confused..

I use ScaleType.CENTER_INSIDE

GPUImageFilterGroup group = new GPUImageFilterGroup();
group.addFilter(new GPUImageSaturationFilter(1.3f));
group.addFilter(new GPUImageBrightnessFilter(0.2f));
group.addFilter(new GPUImageContrastFilter(1.3f));
group.addFilter(new GPUImageWhiteBalanceFilter(5000f,2f));
surfaceView.setFilter(group);

image

@xuzhiyong017
Copy link

I have the same problem.

@ZongwenSun
Copy link

there are two ways to fix this problem.

  1. use GPUImageView.setRatio((float)bitmap.getWidth() / bitmap.getHeight()), this can make the size of GPUImageView the same with the bitmap.
  2. in GPUImageFilter.onDraw method, add "GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT | GLES20.GL_DEPTH_BUFFER_BIT)"

@xiandanin
Copy link
Author

xiandanin commented Nov 29, 2018

@ZongwenSun it works,give you 👍

@JarvisBuop
Copy link

same problem, thanks

xuzhiyong017 pushed a commit to xuzhiyong017/android-gpuimage that referenced this issue Jul 22, 2021
xuzhiyong017 pushed a commit to xuzhiyong017/android-gpuimage that referenced this issue Jul 22, 2021
@wasim15185
Copy link

wasim15185 commented Aug 18, 2021

I have same problem it's not working help me please . I have stuck from 3 days

My Problems

  1. When slider value is less than 1.0f (means <1.0f) then white shadow is appearing out side of Image ( Basically in GPUImageContrastFilter)
    preview
    preview 2

  2. When app is running in background and back to app then image broken which was described previously in this issue

    preview (if you not able to see please zoom green area)

XML

<jp.co.cyberagent.android.gpuimage.GPUImageView
            android:id="@+id/photoViewId"
            android:layout_width="match_parent"
            android:layout_height="0dp"
            app:gpuimage_show_loading="false"
            app:gpuimage_surface_type="texture_view"
            app:layout_constraintBottom_toTopOf="@+id/sliderId"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent" />

in Code

private val scaleType = GPUImage.ScaleType.CENTER_INSIDE;

binding.photoViewId.setScaleType(scaleType)

What did I apply for those problem

I applied two ways which was discussed in this issue , both are not working for me

  1. first , binding.photoViewId.setRatio((adjustViewModel.imgWidth.value!!/adjustViewModel.imgHeight.value!!).toFloat()) this is
    decrease height and width of photo size .

  2. second , i did not get how to add GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT | GLES20.GL_DEPTH_BUFFER_BIT) in GPUImageFilter.onDraw method . Though I applied a technique , I created a New Class which extends GPUImageFilter class and inside overridden onDraw method added GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT | GLES20.GL_DEPTH_BUFFER_BIT) then apply with in GpuImageView then photo is turning black

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

5 participants