I am trying to develop an application that implements fingerpainting on top of an image. I am hitting a roadblock trying to do this with SkiaSharp because I can't figure out how to implement the TouchEffects. Is this something that needs to be manually implemented or is there a better solution? I am a new developer and trying to approach this in the most efficient way! Thanks in advance.
The TouchEffect class is a effect you need to add to the controls. You will want your code to look something like the below.
new Grid { Children = { new SKCanvasView().Invoke(c => c.PaintSurface += OnCanvasViewPaintSurface).Assign(out canvasView) }, Effects = { new TouchEffect().Assign(out touchEffect) // Add to Grid to allow iOS to see the Taps } },
Just copy the rest of the files over from the sample and wire it up together. I found it quite confusing that I had to add the effect to the Grid for iOS and not the SKCanvasView.
This is cross platform, It works for iOS and Android as long as you copy over the effect for each individual platform.
Answers
The TouchEffect class is a effect you need to add to the controls. You will want your code to look something like the below.
Just copy the rest of the files over from the sample and wire it up together. I found it quite confusing that I had to add the effect to the Grid for iOS and not the SKCanvasView.
@seanyda Does this work for cross platform applications or is this iOS specific? It's seeming like the TouchEffect class is something that I have to manually create. Or are you saying I can simply copy and paste the TouchEffect code from the demo and use that in my own application?
This is cross platform, It works for iOS and Android as long as you copy over the effect for each individual platform.