-
Notifications
You must be signed in to change notification settings - Fork 1
/
OnlySkiaSharpMainPage.cs
29 lines (26 loc) · 1.04 KB
/
OnlySkiaSharpMainPage.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
using LiveChartsCore;
using LiveChartsCore.SkiaSharpView;
using LiveChartsCore.SkiaSharpView.Maui;
using SkiaSharp;
using SkiaSharp.Views.Maui.Controls;
namespace MauiSample
{
public class OnlySkiaSharpMainPage : ContentPage
{
public OnlySkiaSharpMainPage()
{
var canvas = new SKCanvasView { VerticalOptions = LayoutOptions.Center };
canvas.PaintSurface += Canvas_PaintSurface;
var grid = new Grid() { Margin = 10 };
grid.RowDefinitions.Add(new RowDefinition { Height = new GridLength(1, GridUnitType.Star) });
grid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) });
grid.Add(canvas, 0, 0);
Content = grid;
}
private void Canvas_PaintSurface(object sender, SkiaSharp.Views.Maui.SKPaintSurfaceEventArgs e)
{
using var paint = new SKPaint { Color = SKColors.Blue };
e.Surface.Canvas.DrawText("Hello from skia", new SKPoint(50, 50), paint);
}
}
}