SkiaSharp SKMatrix.PostConcat Obsolete?

435 views Asked by At

I am using the Docs to implement some Skia Sharp in a Xamarin project to move some images around on the screen and it works well following these docs:

https://learn.microsoft.com/en-us/xamarin/xamarin-forms/user-interface/graphics/skiasharp/transforms/touch?WT.mc_id=OSS-MVP-5003764

However in the TouchManipulation code it uses:

SKMatrix.PostConcat(ref matrix, touchMatrix);

But PostConcat has been depreciated and for the life of me, I can't find what is supposed to be used in its place? I am barely dangerous with Skia I understand the basics and got this working but would dearly love to make this warning go away and then update the Docs to reflect the change needed so others following don't get the same warning.

Any ideas?

3

There are 3 answers

1
Cheesebaron On

Have you tried just writing:

matrix.PreConcat(touchMatrix);

That isn't obsolete.

1
Will Autio On

I had some code:

SKMatrix.PostConcat(ref touchMatrix, TranslationMatrix);

which I replaced with:

touchMatrix = touchMatrix.PostConcat(TranslationMatrix);
0
Doug S On

Yes, both PostConcat(SKMatrix, SKMatrix) and PreConcat(SKMatrix, SKMatrix) are obsolete.

You need to replace your code like so:

matrix = matrix.PostConcat(touchMatrix);