Exemplo n.º 1
0
        private void OnPaintSurface(SKCanvas canvas, SKRect rect, bool isDrawResult, float transX = 0, float transY = 0, float scale = 1)
        {
            if (config.BackgroundType == BackgroundType.Color)
            {
                canvas.Clear(config.BackgroundColor);
            }
            else if (config.BackgroundType == BackgroundType.StretchedImage && backgroundBitmap != null)
            {
                canvas.Clear();
                canvas.DrawBackground(backgroundBitmap, rect, config);
            }
            else
            {
                canvas.Clear();
            }

            if (backgroundBitmap != null)
            {
                canvas.Save();
            }
            canvas.SetMatrix(new SKMatrix(scale, 0, transX * scale, 0, scale, transY * scale, 0, 0, 1));
            canvas.DrawBitmap(mainBitmap, transX, transY, scale);
            canvas.DrawPath(completedPaths, isDrawResult ? null : inProgressPaths);
            canvas.Restore();
            canvas.DrawBitmap(bitmapCollection, transX, transY, scale);
        }