Skip to content

Instantly share code, notes, and snippets.

@juliusdeblaaij
Created August 10, 2022 08:27
Show Gist options
  • Save juliusdeblaaij/31f33104e3c80edbda5e32e9a6250c89 to your computer and use it in GitHub Desktop.
Save juliusdeblaaij/31f33104e3c80edbda5e32e9a6250c89 to your computer and use it in GitHub Desktop.
public void Render(SKCanvas canvas, float angleInRadians, SKPoint center, float scale, params object[] parameters)
{
var Image = (SKImage) parameters[0];
var info = (SKImageInfo) parameters[2];
// get the screen density for scaling
var display = DisplayInformation.GetForCurrentView();
var _scale = display.LogicalDpi / 96.0f;
var scaledSize = new SKSize((float) info.Width / _scale, (float) info.Height / _scale);
// handle the device screen density
canvas.Scale(_scale);
canvas.Clear(SKColors.White);
canvas.DrawImage(Image, 0, 0);
// Business logic to draw shapes ...
canvas.Flush();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment