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

Implement a SkiaSharp TextureView for Android #263

Closed
mattleibow opened this issue Mar 12, 2017 · 10 comments

Comments

Projects
3 participants
@mattleibow
Copy link
Contributor

commented Mar 12, 2017

See information from #228 and #223

Basically there are currently 2 main issues:

  • Transparency is not supported with the Android GLSurfaceView
  • Xamarin.Forms (and any Android) uses a Fragment for navigation, and any view above is overlayed
@DeanClaes

This comment has been minimized.

Copy link

commented May 10, 2017

Hello @mattleibow

Do you have any idea on when this might be implemented?
I have a feeling that this will perform better than the current underlying View when doing animations of any sort (like animated frame images). Right now simply calling InvalidateSurface (without rendering anything) in a loop seems to strain the CPU quite a bit. I supsect that this would not be the case with a TextureView.

@michaelstonis

This comment has been minimized.

Copy link

commented Jan 13, 2018

I assume this will need an implementation like this https://raw.githubusercontent.com/romannurik/muzei/master/main/src/main/java/com/google/android/apps/muzei/render/GLTextureView.java? Do you know if this was ported, it it would be a drop-in kind of replacement? I am willing to give it a shot

@mattleibow

This comment has been minimized.

Copy link
Contributor Author

commented Jan 14, 2018

@michaelstonis thanks for the offer. I managed to find a port already: GLTextureView.cs (I went on a GitHub search for GLTextureView and C# - you can find everything on GitHub nowadays)

I had to make a few tweaks to fix a bug and some Java-to-C# not-quite-rights, but I am mostly done. Just got to clean up the code, remove bad things and make sure I conform to the (attempt) at code styling. I threw up the code here so long: #426

You can have a look, and give any feedback. As soon as this is "stable" I am going to switch out the SKGLView for the forms renderer and use this instead. Hopefully I don't break every app out there, but I shall test! This will fix the two original issues that started this thread.

Let me know what you think, and a very special thanks to @pikkart-support or @Pikkart_AR for doing all the hard work!

@michaelstonis

This comment has been minimized.

Copy link

commented Jan 15, 2018

Is this by chance available via the jenkins builds? For whatever reason, I can't get it to compile locally.

@mattleibow

This comment has been minimized.

Copy link
Contributor Author

commented Jan 18, 2018

I am still working on getting CI to build this - there are a few changes happing to the bots. But, you should be able to just take the 3 files and add them to your project. This just uses the public APIs - I actually worked on this in a small sample app using v1.59.3

@mattleibow mattleibow added this to the 1.60.0 milestone Jan 18, 2018

@mattleibow

This comment has been minimized.

Copy link
Contributor Author

commented Jan 23, 2018

@michaelstonis Have you had an opportunity to try out the texture view? Any feedback?

@michaelstonis

This comment has been minimized.

Copy link

commented Jan 23, 2018

Unfortunately not yet. I am primarily using the Android components via Xamarin.Forms and it looks like there will need to be some underneath the sheets switching to get the TextureView registered as the default GL Surface. I will try to take a look into this soon though.

@mattleibow

This comment has been minimized.

Copy link
Contributor Author

commented Jan 23, 2018

Ah, I will try and get that working too so you can just swap out the dll

@mattleibow mattleibow added this to In Progress in v1.60.1 Feb 2, 2018

@mattleibow

This comment has been minimized.

Copy link
Contributor Author

commented Feb 5, 2018

Just merged the changes. I have switched the default platform renderer for android to the texture view - this should fix all issues :)

@mattleibow mattleibow closed this Feb 5, 2018

v1.60.1 automation moved this from In Progress to Done Feb 5, 2018

@mattleibow

This comment has been minimized.

Copy link
Contributor Author

commented Feb 8, 2018

@michaelstonis @DeanClaes I have reached what I think is good to go...

Give that a whirl and let me know what happens. The Xamarin.Forms view should now be using the TextureView under the hood.

@mattleibow mattleibow removed this from Done in v1.60.1 Feb 23, 2018

@mattleibow mattleibow added this to Done in v1.60.0 May 5, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.