<commit_before>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection.Emit;
using System.Text;
using SkiaSharp;
using SkiaSharp.Views.Forms;
using Xamarin.Forms;

namespace XamJam.Ratings
{
    public class RatingStarView : ContentView
    {
        public RatingStarView()
        {
            var canvasView = new SKCanvasView { WidthRequest = 48, HeightRequest = 48 };
            canvasView.PaintSurface += RatingStarView_PaintSurface;
            canvasView.InvalidateSurface();
            Content = canvasView;
        }

        private void RatingStarView_PaintSurface(object sender, SKPaintSurfaceEventArgs e)
        {
            SKCanvas canvas = e.Surface.Canvas;
            // clear the canvas / fill with white
            canvas.Clear(SKColors.White);

            // set up drawing tools
            using (var paint = new SKPaint())
            {
                paint.IsAntialias = true;
                paint.Color = new SKColor(0x2c, 0x3e, 0x50);
                paint.StrokeCap = SKStrokeCap.Round;

                // create the Xamagon path
                using (var path = new SKPath())
                {
                    // 1: Start at top middle
                    path.MoveTo(24f, 0f);
                    // 2: Top Left Inner
                    path.LineTo(17f, 15f);
                    // 3: Left Tip
                    path.LineTo(0f, 18f);
                    // 4: Bottom Left Inner
                    path.LineTo(12f, 30f);
                    // 5: Bottom Left Tip
                    path.LineTo(10f, 48f);
                    // 6: Lower Middle Inner
                    path.LineTo(24f, 38f);
                    // 7: Bottom Right Tip
                    path.LineTo(38f, 48f);
                    // 8: Bottom Right Inner
                    path.LineTo(36f, 30f);
                    // 9: Right Tip
                    path.LineTo(48f, 18f);
                    // 10: Up & Left to upper right inner
                    path.LineTo(31f, 15f);
                    // 0: Back up to Top
                    path.LineTo(24f, 0f);
                    path.Close();

                    // draw the Xamagon path
                    canvas.DrawPath(path, paint);
                }
            }

        }
    }
}<commit_msg>added a placeholder for the Fill Gradient<commit_after>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection.Emit;
using System.Text;
using SkiaSharp;
using SkiaSharp.Views.Forms;
using Xamarin.Forms;

namespace XamJam.Ratings
{
    public class RatingStarView : ContentView
    {
        public RatingStarView()
        {
            var canvasView = new SKCanvasView { WidthRequest = 48, HeightRequest = 48 };
            canvasView.PaintSurface += RatingStarView_PaintSurface;
            canvasView.InvalidateSurface();
            Content = canvasView;
        }

        private static readonly SKShader FillGradient = SKShader.CreateLinearGradient(
            new SKPoint(24,0), 
            new SKPoint(24, 0), 
            new[] { SKColors.LightYellow, SKColors.Yellow}, 
            new[] { 0.0f, 1.0f }, 
            SKShaderTileMode.Clamp);

        private void RatingStarView_PaintSurface(object sender, SKPaintSurfaceEventArgs e)
        {
            SKCanvas canvas = e.Surface.Canvas;
            // clear the canvas / fill with white
            canvas.Clear(SKColors.White);

            // set up drawing tools
            using (var paint = new SKPaint())
            {
                paint.IsAntialias = true;
                paint.Color = new SKColor(0x2c, 0x3e, 0x50);
                paint.StrokeCap = SKStrokeCap.Round;

                // create the Xamagon path
                using (var path = new SKPath())
                {
                    // 1: Start at top middle
                    path.MoveTo(24f, 0f);
                    // 2: Top Left Inner
                    path.LineTo(17f, 15f);
                    // 3: Left Tip
                    path.LineTo(0f, 18f);
                    // 4: Bottom Left Inner
                    path.LineTo(12f, 30f);
                    // 5: Bottom Left Tip
                    path.LineTo(10f, 48f);
                    // 6: Lower Middle Inner
                    path.LineTo(24f, 38f);
                    // 7: Bottom Right Tip
                    path.LineTo(38f, 48f);
                    // 8: Bottom Right Inner
                    path.LineTo(36f, 30f);
                    // 9: Right Tip
                    path.LineTo(48f, 18f);
                    // 10: Up & Left to upper right inner
                    path.LineTo(31f, 15f);
                    // 0: Back up to Top
                    path.LineTo(24f, 0f);
                    path.Close();

                    // draw the Xamagon path
                    canvas.DrawPath(path, paint);
                }

                // Now create this shader and fill the path somehow with it?
                // paint.Shader = FillGradient;
                // TODO: How do we fill the path with this paint?
            }
        }
    }
}
{'fraction_non_alphanumeric': 0.0851063829787234, 'fraction_numerical': 0.026937341401522544, 'mean_word_length': 1.1953727506426735, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6711853', 'n_tokens_mistral': 1499, 'n_tokens_neox': 1296, 'n_words': 359}