question

MisterXamarin-2605 avatar image
0 Votes"
MisterXamarin-2605 asked JarvanZhang-MSFT answered

Xamarin Form SkiaSharp SKMatrix transformation

Hi,
I try to solve my problem with SkMatrix in SkiaSharp :

I want to transform my Bitmap1 (corners A, B, C, D) and resize it to my full container (corners 1, 2, 3, 4) with Matrix transform.

(Of course the Bitmap will be a bit distorted ...)

Help of expert would be appreciated ;-)

Thanks



82361-sample.jpg


dotnet-xamarin
sample.jpg (82.6 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

JarvanZhang-MSFT avatar image
0 Votes"
JarvanZhang-MSFT answered

I want to transform my Bitmap1 (corners A, B, C, D) and resize it to my full container (corners 1, 2, 3, 4) with Matrix transform.

Hi, MisterXamarin-2605. To resize an SKBitmap to fill an SKCanvasView, try using the Resize method.

var resizedBitmap = bitmap.Resize(info, SKBitmapResizeMethod.Box);
canvas.DrawBitmap(resizedBitmap, info.Width / 2 - resizedBitmap.Width / 2, info.Height / 2 - resizedBitmap.Height / 2);


Refer to: https://forums.xamarin.com/discussion/comment/342107/#Comment_342107

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.