Hey SkiaSharp users/developers! I am busy putting together a set of views and layers and stuff to help you get started with SkiaSharp. Right now I am busy getting everything together so the code is a quicksand, but here is the branch:
Check out the views folder in the root for the actual code.
There are also "samples" in the samples/BasicSamples folder. These try to show how you would "set up" the views.
As of now, the GL bits aren't there yet for Mac (I need to go to sleep, but when I wake... that is what I am going to do next). But, everything seems to be "working" for iOS/tvOS (both raster and GL) and the raster stuff is there for Mac. As I said, it is still very much a work-in-progress.
Please feel free to add any comments and suggestions here or on the forums: http://forums.xamarin.com/discussion/76293/new-skiasharp-views-layers-wip
NOTE: The code uses NuGets, so you don't need to build the native libraries (although right now the GRContext.Flush method is not yet in the public NuGet API, so you can comment it out while you dev)
I am aiming for this:
class MySoftwareView : SKView
{
public override void Draw(SKSurface surface, SKImageInfo info)
{
base.Draw(surface, info);
var canvas = surface.Canvas;
// draw using canvas
}
}
@wieslawsoltes: I see you are excited 馃槃 Great to know! If you check out the code and spot any mistakes (or better ways to do something) just leave a comment or create a PR. I am hoping to get this out soon as a separate NuGet so any help is great help!
@mattleibow Yes! I was using view code from samples, but it was bit tedious to create views for each platform and copy code around. I am looking foreword for the separate NuGet's (beta versions are also welcome).
I did lots of work here and got the bitmap/GL views and layers working for all Apple and Android. Now on to Windows/WPF/UWP
I am busy looking at ways to improve 馃槃 I see that we only use a tiny bit of OpenGL/OpenGLES code to setup the view. My thoughts are wondering towards not including the OpenTK assembly just for this... It might be OK to just [DllImport] the bits we need. That way, anyone can use their favourite OpenGL library. I am going to have to do this anyway, when I start using the ANGLE libraries, as OpenTK does not work with ANGLE... #Thoughts
Hi @mattleibow, are you planning to include Xamarin Forms support as well?
@bgmeiner Yes. Once I have UWP (which I am going to do now) I will get the Forms bits in place.
All done in #152
Are there examples using this View feature?
All the samples. I re-wrote all of them to use the new views. Nothing fancy, there is a new NuGet, SkiaSharp.Views that contains the platform code. I didn't want to add more to the base NuGet, so there are new NuGets - one for platform specific views and then SkiaSharp.Views.Forms for Xamarin.Forms views.
More info here: https://github.com/mono/SkiaSharp/releases/tag/v1.54.1
Most helpful comment
I did lots of work here and got the bitmap/GL views and layers working for all Apple and Android. Now on to Windows/WPF/UWP