private void skglControl1_PaintSurface(object sender, SkiaSharp.Views.Desktop.SKPaintGLSurfaceEventArgs e)
    {
        double angleFraction = trackbarAngle.Value / (double)trackbarAngle.Maximum;
        double angleRadians  = 2 * Math.PI * angleFraction;
        float  angleDegrees  = (float)(angleRadians * 180 / Math.PI);
        float  fontSize      = 96;
        string fontName      = "Impact";

        ICanvas canvas = new SkiaCanvas()
        {
            Canvas = e.Surface.Canvas
        };

        canvas.FillColor = Colors.Navy;
        canvas.FillRectangle(0, 0, skglControl1.Width, skglControl1.Height);

        Microsoft.Maui.Graphics.SizeF stringSize = GraphicsPlatform.CurrentService.GetStringSize(tbText.Text, fontName, fontSize);
        float rectWidth  = stringSize.Width;
        float rectHeight = stringSize.Height;

        Microsoft.Maui.Graphics.PointF[] rectCorners =
        {
            new(0,                  0),
            new(rectWidth,          0),
            new(rectWidth, rectHeight),
            new(0,         rectHeight),
        };
    private void skglControl1_PaintSurface(object sender, SkiaSharp.Views.Desktop.SKPaintGLSurfaceEventArgs e)
    {
        float width  = skglControl1.Width;
        float height = skglControl1.Height;

        ICanvas canvas = new SkiaCanvas()
        {
            Canvas = e.Surface.Canvas
        };

        canvas.FillColor = Color.FromArgb("#003366");
        canvas.FillRectangle(0, 0, width, height);

        canvas.FillColor = Colors.LightGreen;
        canvas.FillRectangle(0, 0, width * LevelFraction, height);
    }
Beispiel #3
0
 protected virtual void OnPaintSurface(SKPaintGLSurfaceEventArgs e)
 {
     // invoke the event
     PaintSurface?.Invoke(this, e);
 }