Forum Libraries, Components, and Plugins

Announcement:

The Xamarin Forums have officially moved to the new Microsoft Q&A experience. Microsoft Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

To create new threads and ask questions head over to Microsoft Q&A for .NET and get involved today.

Issues with scaling

Hi
I have the following code:

private void SkCanvasView_PaintSurface(object sender, SKPaintSurfaceEventArgs e)
{
    var canvas = e.Surface.Canvas;
    var clip = canvas.LocalClipBounds;

    if (bitmap == null)
    {
        using (Stream s = GetType().GetTypeInfo().Assembly.GetManifestResourceStream("image.jpg"))
        {
            using (SKManagedStream sks = new SKManagedStream(s))
            {
                bitmap = SKBitmap.Decode(sks);
            }
        }
    }


    **canvas.Scale(3);**

    canvas.DrawBitmap(bitmap, new SKRect(0, 0, bitmap.Width, bitmap.Height));

    var skPaint = new SKPaint();
    skPaint.Color = SKColors.Green;

    skPoints = points.Select(x => new SKPoint(x.X, x.Y)).ToArray();
    canvas.DrawPoints(SKPointMode.Points, skPoints, skPaint);
}

And without "canvas.Scale(3)" everything is fine, i have green field, but with scaling up, it seems like chessboard(white/green). Bitmap scales up correctly.

Why?

Thanks,
T

Sign In or Register to comment.