burhanrashid52 / PhotoEditor

A Photo Editor library with simple, easy support for image editing using paints,text,filters,emoji and Sticker like stories.
MIT License
4.07k stars 981 forks source link

SurfaceFlinger: Failed to find layer & Applying effect in wrong GL context #213

Open ashwath20 opened 4 years ago

ashwath20 commented 4 years ago
...document, PID: 664
    java.lang.RuntimeException: Applying effect in wrong GL context!
        at android.media.effect.EffectContext.assertValidGLState(EffectContext.java:109)
        at android.media.effect.FilterEffect.beginGLEffect(FilterEffect.java:64)
        at android.media.effect.SingleFilterEffect.apply(SingleFilterEffect.java:68)
        at ja.burhanrashid52.photoeditor.ImageFilterView.applyEffect(ImageFilterView.java:263)
        at ja.burhanrashid52.photoeditor.ImageFilterView.onDrawFrame(ImageFilterView.java:100)
        at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1571)
        at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1270)

Does this library support all the android version above 5.0 i am using 8.1.0

ihassanali259 commented 3 years ago

I am having the same problem. Did you come up with any solution?

jomarierafa commented 3 years ago

same issue when using recyclerview

NahlaSaadAlDeen commented 2 years ago

have anyone find the solution, please?

adnanbhatti14 commented 2 years ago

@NahlaSaadAlDeen I was same issue but now its working fine, OnImageFilterSelected use like below: override fun onImageFilterSelected(photoFilter: PhotoFilter?) { hideFilters() mPhotoEditor?.setFilterEffect(photoFilter) val saveSettings = SaveSettings.Builder() .setClearViewsEnabled(true) .setTransparencyEnabled(true) .build() if (mPhotoEditor != null) { mPhotoEditor?.saveAsFile( mFilePath, saveSettings, object : PhotoEditor.OnSaveListener { override fun onSuccess(imagePath: String) {

                }

                override fun onFailure(exception: java.lang.Exception) {
                    Toast.makeText(this@SendFileActivity, "failure", Toast.LENGTH_SHORT)
                        .show()
                }
            })
    }
}
NahlaSaadAlDeen commented 2 years ago

I'v solved it add the lib as module in the project, update on ImageFilterView class the update is in this section of code if (!mInitialized) { //Only need to do this once mEffectContext = EffectContext.createWithCurrentGlContext(); mTexRenderer.init(); loadTextures(); mInitialized = true; }

the solution is : remove the mInitialized condition and let the code in it run without this condition (remove the role of mInitialized)

VishalNehra commented 1 year ago

@burhanrashid52 can you please prioritise this issue. Facing this in my current usage in recycler view.

burhanrashid52 commented 1 year ago

@burhanrashid52 can you please prioritise this issue. Facing this in my current usage in recycler view.

Check this comment on issue #242

VishalNehra commented 1 year ago

@burhanrashid52 can you please prioritise this issue. Facing this in my current usage in recycler view.

Check this comment on issue #242

Worked! Thanks :)

adnanbhatti14 commented 1 year ago

hi, i customize your code like whatsapp photo editor, if you add me to a contributor and allow me then i will push a advanced code Thanks

On Sun, Dec 18, 2022 at 2:56 PM Burhanuddin Rashid @.***> wrote:

@burhanrashid52 https://github.com/burhanrashid52 can you please prioritise this issue. Facing this in my current usage in recycler view.

Check this comment https://github.com/burhanrashid52/PhotoEditor/issues/242#issuecomment-1336449879 on issue #242 https://github.com/burhanrashid52/PhotoEditor/issues/242

— Reply to this email directly, view it on GitHub https://github.com/burhanrashid52/PhotoEditor/issues/213#issuecomment-1356761429, or unsubscribe https://github.com/notifications/unsubscribe-auth/AXKZ5OSTP2KJQ5E22SLCJUDWN3NVVANCNFSM4KBTRFPQ . You are receiving this because you commented.Message ID: @.***>

burhanrashid52 commented 1 year ago

hi, i customize your code like whatsapp photo editor, if you add me to a contributor and allow me then i will push a advanced code Thanks On Sun, Dec 18, 2022 at 2:56 PM Burhanuddin Rashid @.> wrote: @burhanrashid52 https://github.com/burhanrashid52 can you please prioritise this issue. Facing this in my current usage in recycler view. Check this comment <#242 (comment)> on issue #242 <#242> — Reply to this email directly, view it on GitHub <#213 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AXKZ5OSTP2KJQ5E22SLCJUDWN3NVVANCNFSM4KBTRFPQ . You are receiving this because you commented.Message ID: @.>

Can you please share the screenshot or video on how it looks and works?

adnanbhatti14 commented 1 year ago

Sure, here it is.

On Thu, Dec 22, 2022 at 3:55 PM Burhanuddin Rashid @.***> wrote:

hi, i customize your code like whatsapp photo editor, if you add me to a contributor and allow me then i will push a advanced code Thanks … <#m_5790026895206117598m-7604266635401519495_> On Sun, Dec 18, 2022 at 2:56 PM Burhanuddin Rashid @.> wrote: @burhanrashid52 https://github.com/burhanrashid52 https://github.com/burhanrashid52 https://github.com/burhanrashid52 can you please prioritise this issue. Facing this in my current usage in recycler view. Check this comment <#242 (comment) https://github.com/burhanrashid52/PhotoEditor/issues/242#issuecomment-1336449879> on issue #242 https://github.com/burhanrashid52/PhotoEditor/issues/242 <#242 https://github.com/burhanrashid52/PhotoEditor/issues/242> — Reply to this email directly, view it on GitHub <#213 (comment) https://github.com/burhanrashid52/PhotoEditor/issues/213#issuecomment-1356761429>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AXKZ5OSTP2KJQ5E22SLCJUDWN3NVVANCNFSM4KBTRFPQ https://github.com/notifications/unsubscribe-auth/AXKZ5OSTP2KJQ5E22SLCJUDWN3NVVANCNFSM4KBTRFPQ . You are receiving this because you commented.Message ID: @.>

Can you please share the screenshot or video on how it looks and works?

— Reply to this email directly, view it on GitHub https://github.com/burhanrashid52/PhotoEditor/issues/213#issuecomment-1362694993, or unsubscribe https://github.com/notifications/unsubscribe-auth/AXKZ5ORHNQITETTJ2GGBANDWOQXS7ANCNFSM4KBTRFPQ . You are receiving this because you commented.Message ID: @.***>

Akshay-kumar79 commented 1 year ago

Hi @adnanbhatti14, Could you please share the solution here as well?

adnanbhatti14 commented 10 months ago

i already attached screenshot of working app, i customized with multiple images like whatsapp. can we schedule a meeting?

On Fri, Jul 7, 2023 at 4:50 PM Akshay kumar shaw @.***> wrote:

Hi @adnanbhatti14 https://github.com/adnanbhatti14, Could you please share the solution here as well?

— Reply to this email directly, view it on GitHub https://github.com/burhanrashid52/PhotoEditor/issues/213#issuecomment-1625296658, or unsubscribe https://github.com/notifications/unsubscribe-auth/AXKZ5OQZDMEWLZ35JIDPCWLXO7ZYPANCNFSM4KBTRFPQ . You are receiving this because you were mentioned.Message ID: @.***>

Akshay-kumar79 commented 10 months ago

Hi @adnanbhatti14, Actually I am already done with the project. Thank you for considering this.

kitet commented 3 months ago

I'v solved it add the lib as module in the project, update on ImageFilterView class the update is in this section of code if (!mInitialized) { //Only need to do this once mEffectContext = EffectContext.createWithCurrentGlContext(); mTexRenderer.init(); loadTextures(); mInitialized = true; }

the solution is : remove the mInitialized condition and let the code in it run without this condition (remove the role of mInitialized)

Thank you @NahlaSaadAlDeen . This issue has cost me some huge amount of time but finally. I imported the library module and updated as advised. Thank you.

burhanrashid52 commented 3 months ago

I'v solved it add the lib as module in the project, update on ImageFilterView class the update is in this section of code if (!mInitialized) { //Only need to do this once mEffectContext = EffectContext.createWithCurrentGlContext(); mTexRenderer.init(); loadTextures(); mInitialized = true; } the solution is : remove the mInitialized condition and let the code in it run without this condition (remove the role of mInitialized)

Thank you @NahlaSaadAlDeen . This issue has cost me some huge amount of time but finally. I imported the library module and updated as advised. Thank you.

Cool. Would you like to raise a PR for this?