Forum Cross Platform with Xamarin

How to manipulate SKCanvas matrix from forms gesture recognizers?

I am trying my first Skia Sharp app in Xamarin.Forms and want to manipulate the SKCanvas matrix from gesture recognizers. For example, the PinchGestureRecognizer should scale the SKCanvas. My issue is how to do this. The PinchGestureRecognizer code executes outside of the SKCanvas where I only have access to the SKCanvasView. From the SKCanvasView, there is no way to get the SKCanvas or SKSurface inside to change the matrix. Am I instead supposed to create a class variable that contains the matrix that is manipulated by the gesture recognizers and then just call Invalidate on the SKCanvasView and when the PaintCanvas method is called to then use the class variable holding the matrix and set the matrix on the underlying SKCanvas?

Sign In or Register to comment.