我已经使用SkiaSharp已有几个月了,并且在Android和IOS设备上显示我的绘图说明方面取得了巨大的成功。我正在使用SKCanvasView控件,将其放在ScrollView控件中。滚动ScrollView时,将SKCanvasView转换为ScrollTop和ScrollLeft位置,以便SKCanvasView可以与ScrollView Control的Visible区域保持完整。
这一切在Android中都能顺利进行。但是在IOS设备中,滚动不流畅。滚动是由UI线程保持的,并且不平滑。请看一下代码,如果有任何建议,请提出建议。
private void View_PaintSurface(object sender, SKPaintSurfaceEventArgs e)
{
SKRect rect = paginatedViewProvider.GetViewPortRect();
// I have lots of image tiles which I am drawing on skbitmap and returning it. This is taking around 10ms
SKBitmap pageBitmap = GenerateSKBitmapFromIntenseCalculation();
float Top = (float)(rect.Top - scrollTop);
float Left = (float)(rect.Left - scrollLeft);
e.Surface.Canvas.DrawBitmap(pageBitmap, SKRect.Create(Left, Top, rect.Width, rect.Height));
}
private bool OnTimerTick()
{
viewPanel.InvalidateSurface();
return true;
}