private void DrawTrouble(SKCanvas canvas, SKRect bounds)
        {
            SKPath  gp = new SKPath();
            SKColor firstColor;
            SKColor secondColor;

            firstColor  = new SKColor(255, 255, 255, 150); // 60 instead of 100 seems to do the trick
            secondColor = new SKColor(0, 0, 0, 150);
            var    br_Fill = MiscHelpers.GetLinearGradientPaint(firstColor, secondColor, bounds, MiscHelpers.EnumLinearGradientPercent.Angle180);
            SKRect rect_Temp;
            float  int_Offset = bounds.Width / 6;

            gp.AddLine(new SKPoint(bounds.Left + int_Offset, bounds.Top + (bounds.Height / 4)), new SKPoint((bounds.Left + bounds.Width) - (int_Offset), bounds.Top + (bounds.Height / 4)), true);
            gp.ArcTo(SKRect.Create(bounds.Left + int_Offset, (bounds.Top + (bounds.Height / 2)) - int_Offset, bounds.Width - (int_Offset * 2), bounds.Height / 2), 0, 180, false);
            gp.Close();
            canvas.DrawPath(gp, MainPaint);
            canvas.DrawPath(gp, br_Fill);
            gp        = new SKPath();
            rect_Temp = SKRect.Create(bounds.Left + int_Offset, bounds.Top, bounds.Width - (int_Offset * 2), bounds.Height / 2);
            gp.AddOval(rect_Temp);
            gp.Close();
            canvas.DrawPath(gp, MainPaint);
            rect_Temp = SKRect.Create(rect_Temp.Left + (rect_Temp.Width / 4), rect_Temp.Top + (rect_Temp.Height / 4), (rect_Temp.Width / 2), rect_Temp.Height / 2);
            br_Fill   = MiscHelpers.GetLinearGradientPaint(secondColor, firstColor, bounds, MiscHelpers.EnumLinearGradientPercent.Angle180);
            canvas.DrawOval(rect_Temp, br_Fill);
        }
        private void DrawMarble(SKCanvas canvas, SKRect thisRect) // start with the marble piece.
        {
            var    br_Fill = MiscHelpers.GetCenterGradientPaint(SKColors.White, MainColor.ToSKColor(), new SKPoint(thisRect.Left + (thisRect.Width / 2), thisRect.Top + (thisRect.Height / 2)), thisRect.Height / 2);
            SKPath gp      = new SKPath();

            gp.AddOval(thisRect);
            SKColor firstColor;
            SKColor secondColor;

            firstColor  = new SKColor(255, 255, 255, 50); // 60 instead of 100 seems to do the trick
            secondColor = new SKColor(0, 0, 0, 50);
            var br_Shade = MiscHelpers.GetLinearGradientPaint(firstColor, secondColor, thisRect, MiscHelpers.EnumLinearGradientPercent.Angle45);

            canvas.DrawPath(gp, br_Fill);
            canvas.DrawPath(gp, br_Shade);
        }
Esempio n. 3
0
        public void DrawSquare(SKCanvas thisCanvas, float width, float height)
        {
            var bounds = SKRect.Create(0, 0, width, height);

            _redPenBrush !.StrokeWidth       = bounds.Width / 20;
            _slateGrayPenBrush !.StrokeWidth = bounds.Width / 30;
            _blackPenBrush !.StrokeWidth     = bounds.Width / 20;
            _darkGrayPenBrush !.StrokeWidth  = bounds.Width / 30;
            MiscHelpers.DefaultFont          = "Verdana";
            var thisPercs = MiscHelpers.EnumLinearGradientPercent.Angle45;

            if (IsFlipped == true)
            {
                if (IsMine == true || Flagged == true)
                {
                    var firstColor  = new SKColor(255, 255, 255, 100);
                    var secondColor = new SKColor(0, 0, 0, 100);
                    var secondBrush = MiscHelpers.GetLinearGradientPaint(firstColor, secondColor, bounds, thisPercs);
                    thisCanvas.DrawOval(bounds.Left + (bounds.Width / 2), bounds.Top + (bounds.Width / 2), bounds.Width / 4, bounds.Height / 4, _redSolidBrush);
                    // well see how the second part comes along (could be iffy)(?)
                    thisCanvas.DrawOval(bounds.Left + (bounds.Width / 2), bounds.Top + (bounds.Width / 2), bounds.Width / 4, bounds.Height / 4, secondBrush);
                }
                else if (NeighborMines > 0)
                {
                    var textPaint = MiscHelpers.GetTextPaint(SKColors.Aqua, (bounds.Height * 3) / 4);
                    thisCanvas.DrawCustomText(NeighborMines.ToString(), TextExtensions.EnumLayoutOptions.Center, TextExtensions.EnumLayoutOptions.Center, textPaint, bounds, out _); // i think
                }
                if (Flagged == true)
                {
                    thisCanvas.DrawLine(bounds.Location.X, bounds.Location.Y, bounds.Location.X + bounds.Width, bounds.Location.Y + bounds.Height, _blackPenBrush);
                    thisCanvas.DrawLine(bounds.Location.X + bounds.Width, bounds.Location.Y, bounds.Location.X, bounds.Location.Y + bounds.Height, _blackPenBrush);
                }
            }
            else
            {
                SKRect otherRect;
                otherRect = SKRect.Create(bounds.Location.X + (bounds.Width / 6), bounds.Location.Y + (bounds.Height / 6), (bounds.Width * 2) / 3, (bounds.Height * 2) / 3);
                SKColor firstColor;
                SKColor secondColor;
                SKPaint currentPaint;
                if (Pressed == true)
                {
                    currentPaint = _darkGrayPenBrush;
                    firstColor   = new SKColor(0, 0, 0, 150);
                    secondColor  = new SKColor(255, 255, 255, 150);
                }
                else
                {
                    currentPaint = _slateGrayPenBrush;
                    firstColor   = new SKColor(255, 255, 255, 150);
                    secondColor  = new SKColor(0, 0, 0, 150);
                }
                var tempPaint = MiscHelpers.GetLinearGradientPaint(firstColor, secondColor, bounds, thisPercs);
                thisCanvas.DrawRect(bounds, tempPaint);
                thisCanvas.DrawRect(otherRect, currentPaint);
                if (Flagged == true)
                {
                    SKPath ThisPath = new SKPath();
                    ThisPath.MoveTo(bounds.Location.X + (bounds.Width / 2), bounds.Location.Y + (bounds.Height / 4));
                    ThisPath.LineTo(bounds.Location.X + ((bounds.Width * 3) / 4), bounds.Location.Y + ((bounds.Height * 3) / 8));
                    ThisPath.LineTo(bounds.Location.X + (bounds.Width / 2), bounds.Location.Y + (bounds.Height / 2));
                    thisCanvas.DrawPath(ThisPath, _redSolidBrush);
                    thisCanvas.DrawLine(bounds.Location.X + (bounds.Width / 2), bounds.Location.Y + ((bounds.Height * 3) / 4), bounds.Location.X + (bounds.Width / 2), bounds.Location.Y + (bounds.Height / 4), _redPenBrush);
                }
            }
            thisCanvas.DrawRect(bounds, _slateGrayPenBrush);
        }