private void DrawFill(SKCanvas canvas) // okay now. { SKRect firstText; firstText = MainGraphics !.GetActualRectangle(0, 30, 107, 25); var firstPaint = MiscHelpers.GetTextPaint(SKColors.Red, MainGraphics.GetFontSize(40)); var secondPaint = MiscHelpers.GetTextPaint(SKColors.Aqua, MainGraphics.GetFontSize(35)); var TempRect = MainGraphics.GetActualRectangle(15, 65, 77, 35); canvas.DrawRect(TempRect, _redFill); canvas.DrawBorderText("Fill", TextExtensions.EnumLayoutOptions.Center, TextExtensions.EnumLayoutOptions.Start, firstPaint, _borderTextPaint !, firstText); canvas.DrawBorderText("1000", TextExtensions.EnumLayoutOptions.Center, TextExtensions.EnumLayoutOptions.Center, secondPaint, _borderTextPaint !, TempRect); }
private void DrawBonus(SKCanvas canvas) // okay now { var firstRect = MainGraphics !.GetActualRectangle(7, 7, 95, 25); var secondRect = MainGraphics.GetActualRectangle(7, 100, 95, 25); canvas.DrawRect(firstRect, _redFill); canvas.DrawRect(secondRect, _redFill); var firstText = MainGraphics.GetActualRectangle(0, 37, 107, 35); var secondTExt = MainGraphics.GetActualRectangle(0, 72, 107, 35); var thisPaint = MiscHelpers.GetTextPaint(SKColors.Maroon, MainGraphics.GetFontSize(35)); canvas.DrawBorderText("Bonus", TextExtensions.EnumLayoutOptions.Center, TextExtensions.EnumLayoutOptions.Start, thisPaint, _borderTextPaint !, firstText); canvas.DrawBorderText(Value.ToString(), TextExtensions.EnumLayoutOptions.Center, TextExtensions.EnumLayoutOptions.Start, thisPaint, _borderTextPaint !, secondTExt); }
public void DrawBacks(SKCanvas canvas, SKRect rect_Card) { var FontSize = rect_Card.Height * .3f; var TextPaint = GetTextPaint(SKColors.White, FontSize); canvas.DrawBorderText("Rage", EnumLayoutOptions.Center, EnumLayoutOptions.Center, TextPaint, _blackBorder !, rect_Card); }
public void DrawBacks(SKCanvas Canvas, SKRect rect_Card) { SKRect firstRect; SKRect secondRect; SKRect thirdRect; firstRect = MainGraphics !.GetActualRectangle(2, 2, 74, 33); secondRect = MainGraphics.GetActualRectangle(2, 35, 74, 33); thirdRect = MainGraphics.GetActualRectangle(2, 68, 74, 33); var fontSize = firstRect.Height * 0.6f; // can be adjusted var textPaint = MiscHelpers.GetTextPaint(SKColors.White, fontSize); Canvas.DrawBorderText("Tee", TextExtensions.EnumLayoutOptions.Center, TextExtensions.EnumLayoutOptions.Center, textPaint, _blackBorder !, firstRect); Canvas.DrawBorderText("It", TextExtensions.EnumLayoutOptions.Center, TextExtensions.EnumLayoutOptions.Center, textPaint, _blackBorder !, secondRect); Canvas.DrawBorderText("Up", TextExtensions.EnumLayoutOptions.Center, TextExtensions.EnumLayoutOptions.Center, textPaint, _blackBorder !, thirdRect); }
public void DrawDice(SKCanvas dc) { if (Visible == false) { return; //just in case. } if (CanStartDrawing() == false) { return; } dc.Clear(); SKRect rect_Card; rect_Card = SKRect.Create(0, 0, ActualWidthHeight, ActualWidthHeight); //i think dc.DrawRoundRect(rect_Card, RoundedRadius, RoundedRadius, _fillPaint); if (IsSelected == true) { dc.DrawRoundRect(rect_Card, RoundedRadius, RoundedRadius, _selectPaint); } dc.DrawRoundRect(rect_Card, RoundedRadius, RoundedRadius, _borderPaint); var fontSize = rect_Card.Height * .5f; SKPaint textPaint = MiscHelpers.GetTextPaint(SKColors.White, fontSize); dc.DrawBorderText(Value, EnumLayoutOptions.Center, EnumLayoutOptions.Center, textPaint, _textBorder !, rect_Card); }
private void DrawValue(SKCanvas thisCanvas, SKRect thisRect) { var fontSize = thisRect.Height * 1.1f; var textPaint = MiscHelpers.GetTextPaint(SKColors.Aqua, fontSize); var pen = MiscHelpers.GetStrokePaint(SKColors.Black, 1); thisCanvas.DrawBorderText(Value.ToString(), TextExtensions.EnumLayoutOptions.Center, TextExtensions.EnumLayoutOptions.Center, textPaint, pen, thisRect); // value is already given }
protected void DrawValueCard(SKCanvas canvas, SKRect rect_Card, string valueNeeded) // to be more flexible { float fontSize; fontSize = (rect_Card.Height * 0.5f); // has to experiment var textPaint = GetTextPaint(SKColors.White, fontSize); canvas.DrawBorderText(valueNeeded, TextExtensions.EnumLayoutOptions.Center, TextExtensions.EnumLayoutOptions.Center, textPaint, _textBorder !, rect_Card); }
private void DrawMustBust(SKCanvas canvas, SKRect thisRect) { SKRect firstRect; SKRect lastRect; firstRect = MainGraphics !.GetActualRectangle(7, 10, 93, 25); lastRect = MainGraphics.GetActualRectangle(7, 100, 93, 25); canvas.DrawRect(firstRect, _maroonFill); canvas.DrawRect(firstRect, _aquaPen); canvas.DrawRect(lastRect, _maroonFill); canvas.DrawRect(lastRect, _aquaPen); var textPaint = MiscHelpers.GetTextPaint(SKColors.Aqua, MainGraphics.GetFontSize(30)); var textRect = MainGraphics.GetActualRectangle(0, 43, 107, 37); canvas.DrawBorderText("Must", TextExtensions.EnumLayoutOptions.Center, TextExtensions.EnumLayoutOptions.Start, textPaint, _borderTextPaint !, textRect); textRect = MainGraphics.GetActualRectangle(SKRect.Create(thisRect.Left, 72, 107, 37)); canvas.DrawBorderText("Bust!", TextExtensions.EnumLayoutOptions.Center, TextExtensions.EnumLayoutOptions.Start, textPaint, _borderTextPaint !, textRect); }
private void DrawDistanceCard(SKCanvas canvas, string str_Text, SKRect rect_Card) { SKPath gp_Card; SKPaint pn_Card; SKPaint textBorder; SKColor clr_Text = SKColors.Black; SKColor clr_Border = SKColors.Red; SKPaint textPaint; switch (str_Text) { case "25": { clr_Text = SKColors.Red; clr_Border = SKColors.Green; break; } case "50": { clr_Text = SKColors.Red; clr_Border = SKColors.Blue; break; } case "75": { clr_Text = SKColors.Green; clr_Border = SKColors.Red; break; } case "100": { clr_Text = SKColors.Green; clr_Border = SKColors.Blue; break; } case "200": { clr_Text = SKColors.Blue; clr_Border = SKColors.Green; break; } } pn_Card = MiscHelpers.GetStrokePaint(clr_Border, rect_Card.Width / 20); gp_Card = new SKPath(); gp_Card.AddArc(SKRect.Create(System.Convert.ToInt32((rect_Card.Left + (rect_Card.Width / 10))), System.Convert.ToInt32((rect_Card.Top + (rect_Card.Height / 10))), System.Convert.ToInt32(((rect_Card.Width * 4) / 5)), System.Convert.ToInt32(((rect_Card.Height * 3) / 7))), 180, 180); gp_Card.AddLine(System.Convert.ToInt32((rect_Card.Left + ((rect_Card.Width * 9) / 10))), System.Convert.ToInt32((rect_Card.Top + ((rect_Card.Height * 9) / 10))), System.Convert.ToInt32((rect_Card.Left + (rect_Card.Width / 10))), System.Convert.ToInt32((rect_Card.Top + ((rect_Card.Height * 9) / 10)))); gp_Card.Close(); canvas.DrawPath(gp_Card, pn_Card); textPaint = MiscHelpers.GetTextPaint(clr_Text, rect_Card.Height / 3); textBorder = MiscHelpers.GetStrokePaint(SKColors.Black, 1); // for speed limit, 1 is fine textPaint.FakeBoldText = true; canvas.DrawBorderText(str_Text, TextExtensions.EnumLayoutOptions.Center, TextExtensions.EnumLayoutOptions.Center, textPaint, textBorder, rect_Card); }
public void DrawBacks(SKCanvas canvas, SKRect rect_Card) { var tempRect = SKRect.Create(rect_Card.Location.X + 3, rect_Card.Location.Y + 3, rect_Card.Width - 6, rect_Card.Height - 6); canvas.DrawRect(tempRect, _redPaint); var fontSize = tempRect.Height * 1.2f; var textPaint = MiscHelpers.GetTextPaint(SKColors.Aqua, fontSize); canvas.DrawBorderText("X", TextExtensions.EnumLayoutOptions.Center, TextExtensions.EnumLayoutOptions.Center, textPaint, _blackBorder !, tempRect); }
public void DrawBacks(SKCanvas canvas, SKRect rect_Card) { if (BackText == "") { throw new BasicBlankException("Must have the back text"); } var thisList = BackText.Split(" ").ToList(); if (thisList.Count > 2) { throw new Exception("Only 2 lines are supported currently"); } var thisFill = GetFillColor(); var thisPaint = GetSolidPaint(thisFill); DrawDefaultRectangles(canvas, rect_Card, thisPaint); SKPaint textPaint; CustomBasicList <SKRect> rectList = new CustomBasicList <SKRect>(); if (thisList.Count == 1) { rectList.Add(rect_Card); } else { SKRect firstRect; firstRect = SKRect.Create(8, 8, rect_Card.Width - 6, rect_Card.Height / 2.1f); var secondRect = SKRect.Create(8, rect_Card.Height / 2, rect_Card.Width - 6, rect_Card.Height / 2.1f); rectList.Add(firstRect); rectList.Add(secondRect); } if (rectList.Count != thisList.Count) { throw new BasicBlankException("Numbers Don't Match For Drawing Backs"); } int x = 0; foreach (var thisRect in rectList) { float fontSize; var ThisText = thisList[x]; if (ThisText.Length == 5) { fontSize = rect_Card.Height / 4.2f; } else { fontSize = rect_Card.Height / 3.6f; } textPaint = MiscHelpers.GetTextPaint(BackFontColor, fontSize); canvas.DrawBorderText(ThisText, TextExtensions.EnumLayoutOptions.Center, TextExtensions.EnumLayoutOptions.Center, textPaint, _textBorder !, thisRect); x++; } }
private void DrawDoubleTrouble(SKCanvas canvas) { SKRect firstRect; SKRect lastRect; SKRect firstText; SKRect middleText; SKRect lastText; firstRect = MainGraphics !.GetActualRectangle(5, 5, 97, 20); lastRect = MainGraphics.GetActualRectangle(5, 109, 97, 20); var firstPaint = MiscHelpers.GetTextPaint(SKColors.LightPink, MainGraphics.GetFontSize(25)); var middlePaint = MiscHelpers.GetTextPaint(SKColors.Maroon, MainGraphics.GetFontSize(25)); firstText = MainGraphics.GetActualRectangle(0, 26, 107, 30); middleText = MainGraphics.GetActualRectangle(0, 56, 107, 30); lastText = MainGraphics.GetActualRectangle(0, 86, 107, 30); canvas.DrawRect(firstRect, _redFill); canvas.DrawRect(lastRect, _redFill); canvas.DrawBorderText("Double", TextExtensions.EnumLayoutOptions.Center, TextExtensions.EnumLayoutOptions.Start, firstPaint, _borderTextPaint !, firstText); canvas.DrawBorderText("Trouble", TextExtensions.EnumLayoutOptions.Center, TextExtensions.EnumLayoutOptions.Start, middlePaint, _borderTextPaint !, middleText); canvas.DrawBorderText("Double", TextExtensions.EnumLayoutOptions.Center, TextExtensions.EnumLayoutOptions.Start, firstPaint, _borderTextPaint !, lastText); }
public void DrawImage(SKCanvas canvas, SKRect rect_Card) { if (IsJoker == true) { var thisPen = MiscHelpers.GetStrokePaint(_tempColor, 2); var tempRect = MainGraphics !.GetActualRectangle(SKRect.Create(16, 6, 28, 28)); canvas.DrawSmiley(tempRect, null !, thisPen, _blackPaint !); return; } var fontSize = rect_Card.Height * 0.9f; // can be adjusted obviously var paint = MiscHelpers.GetTextPaint(_tempColor, fontSize); canvas.DrawBorderText(Number.ToString(), TextExtensions.EnumLayoutOptions.Center, TextExtensions.EnumLayoutOptions.Center, paint, _blackBorder !, rect_Card); }
public void DrawBacks(SKCanvas canvas, SKRect rect_Card) { canvas.DrawRect(rect_Card, _backPaint); CustomBasicList <SKRect> thisList = new CustomBasicList <SKRect>(); float fontSize; fontSize = rect_Card.Height / 3.2f; var textPaint = MiscHelpers.GetTextPaint(SKColors.Yellow, fontSize); var thisRect = SKRect.Create(2, 2, rect_Card.Width, rect_Card.Height / 3); thisList.Add(thisRect); thisRect = SKRect.Create(2, rect_Card.Height / 3, rect_Card.Width, rect_Card.Height / 3); thisList.Add(thisRect); thisRect = SKRect.Create(2, (rect_Card.Height / 3) * 2, rect_Card.Width, rect_Card.Height / 3); thisList.Add(thisRect); int x = 0; string thisText; foreach (var ThisRect in thisList) { x += 1; switch (x) { case 1: { thisText = "Hit"; break; } case 2: { thisText = "The"; break; } case 3: { thisText = "Deck"; break; } default: { throw new BasicBlankException("Only 3 lines"); } } canvas.DrawBorderText(thisText, TextExtensions.EnumLayoutOptions.Center, TextExtensions.EnumLayoutOptions.Center, textPaint, _textBorder !, ThisRect); } }
private void DrawChance(SKCanvas thisCanvas) { var firstRect = MainGraphics !.GetActualRectangle(2, 0, 51, 26); var fontSize = MainGraphics.GetFontSize(12); var textPaint = MiscHelpers.GetTextPaint(SKColors.Black, fontSize); textPaint.FakeBoldText = true; thisCanvas.DrawCustomText("Chance", TextExtensions.EnumLayoutOptions.Center, TextExtensions.EnumLayoutOptions.Center, textPaint, firstRect, out _); var secondRect = MainGraphics.GetActualRectangle(0, 10, 60, 70); fontSize = MainGraphics.GetFontSize(45); textPaint = MiscHelpers.GetTextPaint(SKColors.Red, fontSize); textPaint.FakeBoldText = true; thisCanvas.DrawBorderText("?", TextExtensions.EnumLayoutOptions.Center, TextExtensions.EnumLayoutOptions.Center, textPaint, _blackBorder1 !, secondRect); }
private void DrawBorderText(SKCanvas canvas, SKRect rect_Card) { float tempFont; if (Value == 10) { tempFont = rect_Card.Width / 1.3f; } else { tempFont = rect_Card.Width / 0.9f; } using var FillPaint = MiscHelpers.GetTextPaint(SKColors.White, tempFont); using var StrokePaint = MiscHelpers.GetTextPaint(SKColors.Black, tempFont); canvas.DrawBorderText(Value.ToString(), TextExtensions.EnumLayoutOptions.Center, TextExtensions.EnumLayoutOptions.Center, FillPaint, StrokePaint, rect_Card); }
private void DrawBorderText(SKCanvas Canvas, string value, SKRect rect_Card) { float fontSize; if (CardType != EnumTypeList.Draw4) { fontSize = rect_Card.Height * 1.2f; } else { fontSize = rect_Card.Height / 2.5f; } var textPaint = MiscHelpers.GetTextPaint(SKColors.White, fontSize); Canvas.DrawBorderText(value, TextExtensions.EnumLayoutOptions.Center, TextExtensions.EnumLayoutOptions.Center, textPaint, _textBorder !, rect_Card); }
private void DrawValue(SKCanvas Canvas, SKRect rect_Card) { SKColor thisColor; switch (Suit) { case EnumSuitList.Clubs: { thisColor = SKColors.Green; break; } case EnumSuitList.Diamonds: { thisColor = SKColors.Blue; break; } case EnumSuitList.Hearts: { thisColor = SKColors.Red; break; } case EnumSuitList.Spades: { thisColor = SKColors.Blue; break; } case EnumSuitList.Stars: { thisColor = SKColors.Yellow; break; } default: { throw new BasicBlankException("Not Supported"); } } var fontSize = rect_Card.Height * 0.7f; // can vary (?) var thisPaint = MiscHelpers.GetTextPaint(thisColor, fontSize); Canvas.DrawBorderText(GetTextOfCard(), TextExtensions.EnumLayoutOptions.Center, TextExtensions.EnumLayoutOptions.Center, thisPaint, _borderPaint !, rect_Card); }
private void DrawGo(SKCanvas thisCanvas) { var firstRect = MainGraphics !.GetActualRectangle(0, 0, 55, 40); var fontSize = MainGraphics.GetFontSize(30); var textPaint = MiscHelpers.GetTextPaint(SKColors.Red, fontSize); textPaint.FakeBoldText = true; thisCanvas.DrawBorderText("Go", TextExtensions.EnumLayoutOptions.Center, TextExtensions.EnumLayoutOptions.Center, textPaint, _blackBorder1 !, firstRect); var secondRect = MainGraphics.GetActualRectangle(0, 35, 55, 20); fontSize = MainGraphics.GetFontSize(14); // decided to make slightly smaller textPaint = MiscHelpers.GetTextPaint(SKColors.Black, fontSize); textPaint.FakeBoldText = true; var thirdRect = MainGraphics.GetActualRectangle(0, 53, 55, 20); thisCanvas.DrawCustomText("Collect", TextExtensions.EnumLayoutOptions.Center, TextExtensions.EnumLayoutOptions.Center, textPaint, secondRect, out _); thisCanvas.DrawCustomText("$200", TextExtensions.EnumLayoutOptions.Center, TextExtensions.EnumLayoutOptions.Center, textPaint, thirdRect, out _); }
public void DrawBacks(SKCanvas canvas, SKRect rect_Card) { canvas.DrawRect(rect_Card, _backPaint); SKRect firstRect; firstRect = SKRect.Create(8, 8, rect_Card.Width - 6, rect_Card.Height / 2.1f); var secondRect = SKRect.Create(8, rect_Card.Height / 2, rect_Card.Width - 6, rect_Card.Height / 2.1f); canvas.DrawRect(firstRect, _redPaint); canvas.DrawRect(secondRect, _chocolatePaint); CustomBasicList <SKRect> thisList = new CustomBasicList <SKRect>(); float fontSize = rect_Card.Height / 3.2f; var textPaint = MiscHelpers.GetTextPaint(SKColors.Aqua, fontSize); thisList.Add(firstRect); thisList.Add(secondRect); int x = 0; string thisText; foreach (var thisRect in thisList) { x += 1; switch (x) { case 1: { thisText = "Milk"; break; } case 2: { thisText = "Run"; break; } default: { throw new BasicBlankException("Only 2 lines"); } } canvas.DrawBorderText(thisText, TextExtensions.EnumLayoutOptions.Center, TextExtensions.EnumLayoutOptions.Center, textPaint, _textBorder !, thisRect); } }
public void DrawImage(SKCanvas canvas, SKRect rect_Card) { SKRect topRect; topRect = MainGraphics !.GetActualRectangle(13, 13, 50, 50); canvas.DrawOval(topRect, _greenPaint); if (IsMulligan == false) { var firstFonts = topRect.Height * 0.8f; var firstTextPaint = MiscHelpers.GetTextPaint(SKColors.White, firstFonts); canvas.DrawBorderText(Points.ToString(), TextExtensions.EnumLayoutOptions.Center, TextExtensions.EnumLayoutOptions.Center, firstTextPaint, _blackBorder !, topRect); } SKRect fullBottom; fullBottom = MainGraphics.GetActualRectangle(4, 67, 68, 35); var firstBottom = MainGraphics.GetActualRectangle(4, 67, 68, 17); var secondBottom = MainGraphics.GetActualRectangle(4, 84, 68, 17); var thisList = GetTextList(); var fontSize = fullBottom.Height * 0.41f; SKPaint thisPaint; if (IsMulligan == true) { thisPaint = MiscHelpers.GetTextPaint(SKColors.Red, fontSize); } else { thisPaint = MiscHelpers.GetTextPaint(SKColors.Green, fontSize); } if (thisList.Count == 1) { canvas.DrawCustomText(thisList.Single(), TextExtensions.EnumLayoutOptions.Center, TextExtensions.EnumLayoutOptions.Center, thisPaint, fullBottom, out _); } else if (thisList.Count == 2) { canvas.DrawCustomText(thisList.First(), TextExtensions.EnumLayoutOptions.Center, TextExtensions.EnumLayoutOptions.Center, thisPaint, firstBottom, out _); canvas.DrawCustomText(thisList.Last(), TextExtensions.EnumLayoutOptions.Center, TextExtensions.EnumLayoutOptions.Center, thisPaint, secondBottom, out _); } else { throw new BasicBlankException("Rethink"); } }
private void DrawRegular(SKCanvas canvas) { var shapeRect = MainGraphics !.GetActualRectangle(13, 5, 30, 30); SKPaint solidPaint; if ((int)Color == (int)EnumColor.Blue) { solidPaint = _lightBluePaint !; } else if ((int)Color == (int)EnumColor.Red) { solidPaint = _redPaint !; } else { throw new Exception("Not Supported"); } if ((int)Shape == (int)EnumCardShape.Circle) { canvas.DrawOval(shapeRect, solidPaint); canvas.DrawOval(shapeRect, _thickBorders); } else if ((int)Shape == (int)EnumCardShape.Square) { canvas.DrawRect(shapeRect, solidPaint); canvas.DrawRect(shapeRect, _thickBorders); } else if ((int)Shape == (int)EnumCardShape.Triangle) { canvas.DrawTriangle(shapeRect, solidPaint, _thickBorders !); } else { throw new Exception("Not Supported"); } var textRect = MainGraphics.GetActualRectangle(0, 35, 55, 35); var fontSize = textRect.Height * 1.1f; // can adjust as needed var textPaint = MiscHelpers.GetTextPaint(solidPaint.Color, fontSize); canvas.DrawBorderText(Value.ToString(), TextExtensions.EnumLayoutOptions.Center, TextExtensions.EnumLayoutOptions.Center, textPaint, _blackBorders !, textRect); }
public void DrawDice(SKCanvas dc) { dc.Clear(); //always needs to clear for this one. if (Text == "-1" || Text == "") { return; //because can't be -1. } SKRect rect_Card; rect_Card = SKRect.Create(0, 0, ActualWidthHeight, ActualWidthHeight); //i think dc.DrawRoundRect(rect_Card, RoundedRadius, RoundedRadius, _fillPaint); if (WillHold == true) { dc.DrawRoundRect(rect_Card, RoundedRadius, RoundedRadius, _selectPaint); } SKPaint thisPaint; float fontSize = rect_Card.Height * 0.9f; thisPaint = MiscHelpers.GetTextPaint(SKColors.Blue, fontSize); thisPaint.FakeBoldText = WillHold; dc.DrawBorderText(Text, TextExtensions.EnumLayoutOptions.Center, TextExtensions.EnumLayoutOptions.Center, thisPaint, _blackBorder, rect_Card); }
private void DrawNoDice(SKCanvas canvas) { var textRect = MainGraphics !.GetActualRectangle(0, 10, 107, 44); var thisPaint = MiscHelpers.GetTextPaint(SKColors.Aqua, MainGraphics.GetFontSize(27)); canvas.DrawBorderText("No Dice", TextExtensions.EnumLayoutOptions.Center, TextExtensions.EnumLayoutOptions.Start, thisPaint, _borderTextPaint !, textRect); var lastRect = MainGraphics.GetActualRectangle(23, 59, 60, 60); var thisPen = MiscHelpers.GetStrokePaint(SKColors.Red, 7); // i think 7 no matter what (?) canvas.DrawOval(lastRect, thisPen); StandardDiceGraphicsCP thisDice = new StandardDiceGraphicsCP(); thisDice.Location = new SKPoint(lastRect.Left + (lastRect.Size.Width / 4), lastRect.Top + (lastRect.Size.Height / 4)); thisDice.NeedsToClear = false; // its this instead. var thisSize = MainGraphics.GetActualSize(new SKSize(34, 34)); thisDice.ActualWidthHeight = thisSize.Height; thisDice.UseSmallerBorders(); thisDice.Value = 6; thisDice.DrawDice(canvas); canvas.DrawLine(lastRect.Left + 10, lastRect.Top + 10, lastRect.Right - 10, lastRect.Bottom - 10, thisPen); }
public void DrawImage(SKCanvas canvas, SKRect rect_Card) { SKPath gp_Card; SKPaint tempPen; SKPoint[] pts; int int_Temp; SKMatrix tmp_Matrix; SKRegion reg_Temp; SKPoint pt_Center; pt_Center = new SKPoint(rect_Card.Left + (rect_Card.Width / 2), rect_Card.Top + (rect_Card.Height / 2) + (rect_Card.Width / 100)); SKPaint textPaint; SKPaint textBorder; switch (Category) { case EnumCompleteCategories.Accident: gp_Card = new SKPath(); gp_Card.AddLine(System.Convert.ToInt32(((rect_Card.Left + (rect_Card.Width / 2)) - (rect_Card.Width / 8))), System.Convert.ToInt32(((rect_Card.Top + (rect_Card.Height / 2)) - (rect_Card.Height / 10))), System.Convert.ToInt32((rect_Card.Left + (rect_Card.Width / 2) + (rect_Card.Width / 8))), System.Convert.ToInt32(((rect_Card.Top + (rect_Card.Height / 2)) - (rect_Card.Height / 10))), true); gp_Card.AddLine(System.Convert.ToInt32((rect_Card.Left + ((rect_Card.Width * 3) / 4))), System.Convert.ToInt32((rect_Card.Top + (rect_Card.Height / 2))), System.Convert.ToInt32((rect_Card.Left + ((rect_Card.Width * 9) / 10))), System.Convert.ToInt32((rect_Card.Top + (rect_Card.Height / 2)))); gp_Card.AddLine(System.Convert.ToInt32((rect_Card.Left + ((rect_Card.Width * 9) / 10))), System.Convert.ToInt32((rect_Card.Top + (rect_Card.Height / 2) + (rect_Card.Height / 8))), System.Convert.ToInt32((rect_Card.Left + (rect_Card.Width / 10))), System.Convert.ToInt32((rect_Card.Top + (rect_Card.Height / 2) + (rect_Card.Height / 8)))); gp_Card.AddLine(System.Convert.ToInt32((rect_Card.Left + (rect_Card.Width / 10))), System.Convert.ToInt32((rect_Card.Top + (rect_Card.Height / 2))), System.Convert.ToInt32((rect_Card.Left + (rect_Card.Width / 4))), System.Convert.ToInt32((rect_Card.Top + (rect_Card.Height / 2)))); gp_Card.Close(); // i think canvas.DrawPath(gp_Card, _basicPen); gp_Card = new SKPath(); gp_Card.AddOval(SKRect.Create((rect_Card.Left + (rect_Card.Width / 4)) - (rect_Card.Width / 12), (rect_Card.Top + (rect_Card.Height / 2) + (rect_Card.Height / 8)) - (rect_Card.Width / 12), rect_Card.Width / 6, rect_Card.Width / 6)); canvas.DrawPath(gp_Card, _whitePaint); canvas.DrawPath(gp_Card, _basicPen); gp_Card = new SKPath(); gp_Card.AddOval(SKRect.Create((rect_Card.Left + ((rect_Card.Width * 3) / 4)) - (rect_Card.Width / 12), (rect_Card.Top + (rect_Card.Height / 2) + (rect_Card.Height / 8)) - (rect_Card.Width / 12), rect_Card.Width / 6, rect_Card.Width / 6)); canvas.DrawPath(gp_Card, _whitePaint); canvas.DrawPath(gp_Card, _basicPen); tempPen = MiscHelpers.GetStrokePaint(SKColors.Red, rect_Card.Width / 30); canvas.DrawLine(System.Convert.ToInt32((rect_Card.Left + ((rect_Card.Width * 3) / 4))), System.Convert.ToInt32((rect_Card.Top + (rect_Card.Height / 2))), System.Convert.ToInt32((rect_Card.Left + ((rect_Card.Width * 19) / 20))), System.Convert.ToInt32((rect_Card.Top + (rect_Card.Height / 2) + (rect_Card.Height / 10))), tempPen); canvas.DrawLine(System.Convert.ToInt32((rect_Card.Left + ((rect_Card.Width * 3) / 4))), System.Convert.ToInt32((rect_Card.Top + (rect_Card.Height / 2) + (rect_Card.Height / 10))), System.Convert.ToInt32((rect_Card.Left + ((rect_Card.Width * 19) / 20))), System.Convert.ToInt32((rect_Card.Top + (rect_Card.Height / 2))), tempPen); break; case EnumCompleteCategories.OutOfGas: tempPen = MiscHelpers.GetStrokePaint(SKColors.Black, rect_Card.Height / 40); int_Temp = (int)rect_Card.Width; gp_Card = new SKPath(); gp_Card.AddArc(SKRect.Create(rect_Card.Left - (int_Temp / 2) + (rect_Card.Width / 2), rect_Card.Top + (rect_Card.Height / 3), int_Temp, int_Temp), -135, 90); canvas.DrawPath(gp_Card, tempPen); tempPen = MiscHelpers.GetStrokePaint(SKColors.Red, rect_Card.Height / 40); tempPen.StrokeCap = SKStrokeCap.Round; // strokejoin did not help one bit canvas.DrawLine(rect_Card.Left + (rect_Card.Width / 2), rect_Card.Top + (rect_Card.Height / 3) + (int_Temp / 2), rect_Card.Width / 3.5f, rect_Card.Height / 2.16f, tempPen); var ThisPaint = MiscHelpers.GetTextPaint(SKColors.Red, rect_Card.Height / 4, "Ariel"); ThisPaint.FakeBoldText = true; canvas.DrawText("E", rect_Card.Left + (rect_Card.Width / 10), rect_Card.Top + (rect_Card.Height / 3), ThisPaint); ThisPaint = MiscHelpers.GetTextPaint(SKColors.Black, rect_Card.Height / 4, "Ariel"); ThisPaint.FakeBoldText = true; canvas.DrawText("F", rect_Card.Left + ((rect_Card.Width * 15) / 20), rect_Card.Top + (rect_Card.Height / 3), ThisPaint); break; case EnumCompleteCategories.FlatTire: gp_Card = new SKPath(); gp_Card.AddOval(SKRect.Create(rect_Card.Left + (rect_Card.Width / 6), pt_Center.Y - ((rect_Card.Width * 4) / 12), (rect_Card.Width * 4) / 6, (rect_Card.Width * 4) / 6)); reg_Temp = MiscHelpers.GetNewRegion(SKRect.Create(rect_Card.Left + (rect_Card.Width / 6), (pt_Center.Y - ((rect_Card.Width * 4) / 12)) + ((((rect_Card.Width * 4) / 6) * 5) / 6), (rect_Card.Width * 4) / 6, (rect_Card.Width * 4) / 6)); var OtherRegion = new SKRegion(reg_Temp); reg_Temp.SetPath(gp_Card); canvas.DrawRegion(reg_Temp, _redFill); reg_Temp.SetPath(gp_Card, OtherRegion); canvas.DrawRegion(reg_Temp, _whitePaint); gp_Card = new SKPath(); gp_Card.AddOval(SKRect.Create(rect_Card.Left + ((rect_Card.Width * 2) / 6), pt_Center.Y - ((rect_Card.Width * 2) / 12), (rect_Card.Width * 2) / 6, (rect_Card.Width * 2) / 6)); canvas.DrawPath(gp_Card, _whitePaint); gp_Card = new SKPath(); gp_Card.AddOval(SKRect.Create(rect_Card.Left + (rect_Card.Width / 3) + (rect_Card.Width / 12), pt_Center.Y - (rect_Card.Width / 12), rect_Card.Width / 6, rect_Card.Width / 6)); canvas.DrawPath(gp_Card, _blackPaint); break; case EnumCompleteCategories.SpeedLimit: textPaint = MiscHelpers.GetTextPaint(SKColors.Black, rect_Card.Height / 3); textBorder = MiscHelpers.GetStrokePaint(SKColors.Black, 1); // for speed limit, 1 is fine canvas.DrawBorderText("50", TextExtensions.EnumLayoutOptions.Center, TextExtensions.EnumLayoutOptions.Center, textPaint, textBorder, rect_Card); tempPen = MiscHelpers.GetStrokePaint(SKColors.Red, rect_Card.Width / 10); gp_Card = new SKPath(); gp_Card.AddOval(SKRect.Create(rect_Card.Left + (rect_Card.Width / 8), (rect_Card.Top + (rect_Card.Height / 2)) - ((rect_Card.Width * 3) / 8), (rect_Card.Width * 3) / 4, (rect_Card.Width * 3) / 4)); canvas.DrawPath(gp_Card, tempPen); break; case EnumCompleteCategories.Stop: gp_Card = new SKPath(); gp_Card.AddOval(SKRect.Create((rect_Card.Left + (rect_Card.Width / 2)) - (rect_Card.Width / 6), (rect_Card.Top + (rect_Card.Height / 2)) - (rect_Card.Width / 6), rect_Card.Width / 3, rect_Card.Width / 3)); canvas.DrawPath(gp_Card, _grayPaint); tmp_Matrix = SKMatrix.MakeTranslation(0, (rect_Card.Width * 5) / 13); gp_Card.Transform(tmp_Matrix); canvas.DrawPath(gp_Card, _grayPaint); tmp_Matrix = SKMatrix.MakeTranslation(0, (-rect_Card.Width * 10) / 13); gp_Card.Transform(tmp_Matrix); canvas.DrawPath(gp_Card, _redFill); break; case EnumCompleteCategories.Repairs: gp_Card = new SKPath(); reg_Temp = MiscHelpers.GetNewRegion(SKRect.Create(rect_Card.Left + (rect_Card.Width / 3), rect_Card.Top, rect_Card.Width / 3, rect_Card.Height / 3)); gp_Card.AddOval(SKRect.Create(rect_Card.Left + (rect_Card.Width / 6), rect_Card.Top + (rect_Card.Height / 10), (rect_Card.Width * 4) / 6, (rect_Card.Height * 3) / 7)); gp_Card.AddRect(SKRect.Create(rect_Card.Left + (rect_Card.Width / 3), rect_Card.Top + (rect_Card.Height / 2), rect_Card.Width / 3, (rect_Card.Height * 4) / 9)); var OtherRegion2 = new SKRegion(reg_Temp); reg_Temp.SetPath(gp_Card); canvas.DrawRegion(reg_Temp, _greenPaint); reg_Temp.SetPath(gp_Card, OtherRegion2); canvas.DrawRegion(reg_Temp, _whitePaint); gp_Card = new SKPath(); gp_Card.AddRect(SKRect.Create((rect_Card.Left + (rect_Card.Width / 2)) - (rect_Card.Width / 12), rect_Card.Top + (rect_Card.Height / 8), rect_Card.Width / 6, rect_Card.Height / 7)); canvas.DrawPath(gp_Card, _blackPaint); break; case EnumCompleteCategories.Gasoline: gp_Card = new SKPath(); gp_Card.AddLine(System.Convert.ToInt32((rect_Card.Left + (rect_Card.Width / 4))), System.Convert.ToInt32((rect_Card.Top + (rect_Card.Height / 4))), System.Convert.ToInt32((rect_Card.Left + (rect_Card.Width / 2))), System.Convert.ToInt32((rect_Card.Top + (rect_Card.Height / 4))), true); gp_Card.AddLine(System.Convert.ToInt32((rect_Card.Left + (rect_Card.Width / 2))), System.Convert.ToInt32((rect_Card.Top + (rect_Card.Height / 4))), System.Convert.ToInt32((rect_Card.Left + ((rect_Card.Width * 3) / 4))), System.Convert.ToInt32((rect_Card.Top + (rect_Card.Height / 3)))); gp_Card.AddLine(System.Convert.ToInt32((rect_Card.Left + ((rect_Card.Width * 3) / 4))), System.Convert.ToInt32((rect_Card.Top + ((rect_Card.Height * 3) / 4))), System.Convert.ToInt32((rect_Card.Left + (rect_Card.Width / 4))), System.Convert.ToInt32((rect_Card.Top + ((rect_Card.Height * 3) / 4)))); gp_Card.Close(); canvas.DrawPath(gp_Card, _greenPaint); gp_Card = new SKPath(); gp_Card.AddRect(SKRect.Create(rect_Card.Left, rect_Card.Top, rect_Card.Width / 8, rect_Card.Height / 20)); tmp_Matrix = SKMatrix.MakeRotationDegrees(23, rect_Card.Left, rect_Card.Top); tmp_Matrix.TransX = (rect_Card.Width * 20) / 30; tmp_Matrix.TransY = rect_Card.Height / 5.4f; gp_Card.Transform(tmp_Matrix); canvas.DrawPath(gp_Card, _greenPaint); break; case EnumCompleteCategories.Spare: gp_Card = new SKPath(); gp_Card.AddOval(SKRect.Create(rect_Card.Left + (rect_Card.Width / 6), pt_Center.Y - ((rect_Card.Width * 4) / 12), (rect_Card.Width * 4) / 6, (rect_Card.Width * 4) / 6)); reg_Temp = MiscHelpers.GetNewRegion(SKRect.Create(rect_Card.Left + (rect_Card.Width / 6), (pt_Center.Y - ((rect_Card.Width * 4) / 12)) + ((((rect_Card.Width * 4) / 6) * 5) / 6), (rect_Card.Width * 4) / 6, (rect_Card.Width * 4) / 6)); reg_Temp.SetPath(gp_Card); canvas.DrawRegion(reg_Temp, _greenPaint); gp_Card = new SKPath(); gp_Card.AddOval(SKRect.Create(rect_Card.Left + ((rect_Card.Width * 2) / 6), pt_Center.Y - ((rect_Card.Width * 2) / 12), (rect_Card.Width * 2) / 6, (rect_Card.Width * 2) / 6)); canvas.DrawPath(gp_Card, _whitePaint); gp_Card = new SKPath(); gp_Card.AddOval(SKRect.Create(rect_Card.Left + (rect_Card.Width / 3) + (rect_Card.Width / 12), pt_Center.Y - (rect_Card.Width / 12), rect_Card.Width / 6, rect_Card.Width / 6)); canvas.DrawPath(gp_Card, _blackPaint); break; case EnumCompleteCategories.EndOfLimit: textPaint = MiscHelpers.GetTextPaint(SKColors.Gray, rect_Card.Height / 3); textBorder = MiscHelpers.GetStrokePaint(SKColors.Black, 1); // for speed limit, 1 is fine textPaint.FakeBoldText = true; canvas.DrawBorderText("50", TextExtensions.EnumLayoutOptions.Center, TextExtensions.EnumLayoutOptions.Center, textPaint, textBorder, rect_Card); tempPen = MiscHelpers.GetStrokePaint(SKColors.Green, rect_Card.Width / 10); gp_Card = new SKPath(); gp_Card.AddOval(SKRect.Create(rect_Card.Left + (rect_Card.Width / 8), (rect_Card.Top + (rect_Card.Height / 2)) - ((rect_Card.Width * 3) / 8), (rect_Card.Width * 3) / 4, (rect_Card.Width * 3) / 4)); canvas.DrawPath(gp_Card, tempPen); gp_Card = new SKPath(); gp_Card.AddLine(System.Convert.ToInt32((rect_Card.Left + (rect_Card.Width / 2))), System.Convert.ToInt32(((rect_Card.Top + (rect_Card.Height / 2)) - ((rect_Card.Width * 3) / 8))), System.Convert.ToInt32((rect_Card.Left + (rect_Card.Width / 2))), System.Convert.ToInt32((rect_Card.Top + (rect_Card.Height / 2) + ((rect_Card.Width * 3) / 8))), true); tmp_Matrix = SKMatrix.MakeRotationDegrees(45, pt_Center.X, pt_Center.Y); gp_Card.Transform(tmp_Matrix); canvas.DrawPath(gp_Card, tempPen); break; case EnumCompleteCategories.Roll: gp_Card = new SKPath(); gp_Card.AddOval(SKRect.Create((rect_Card.Left + (rect_Card.Width / 2)) - (rect_Card.Width / 6), (rect_Card.Top + (rect_Card.Height / 2)) - (rect_Card.Width / 6), rect_Card.Width / 3, rect_Card.Width / 3)); canvas.DrawPath(gp_Card, _grayPaint); tmp_Matrix = SKMatrix.MakeTranslation(0, (rect_Card.Width * 5) / 13); gp_Card.Transform(tmp_Matrix); canvas.DrawPath(gp_Card, _greenPaint); tmp_Matrix = SKMatrix.MakeTranslation(0, (-rect_Card.Width * 10) / 13); gp_Card.Transform(tmp_Matrix); canvas.DrawPath(gp_Card, _grayPaint); break; case EnumCompleteCategories.DrivingAce: gp_Card = new SKPath(); gp_Card.AddOval(SKRect.Create(rect_Card.Left + (rect_Card.Width / 10), (rect_Card.Top + (rect_Card.Height / 2)) - ((rect_Card.Width * 4) / 10), (rect_Card.Width * 8) / 10, (rect_Card.Width * 8) / 10)); tempPen = MiscHelpers.GetStrokePaint(SKColors.Blue, rect_Card.Width / 20); canvas.DrawPath(gp_Card, tempPen); tmp_Matrix = SKMatrix.MakeRotationDegrees(120, pt_Center.X, pt_Center.Y); gp_Card = new SKPath(); gp_Card.AddLine(System.Convert.ToInt32(((rect_Card.Left + (rect_Card.Width / 2)) - (rect_Card.Width / 25))), System.Convert.ToInt32((rect_Card.Top + (rect_Card.Height / 2) + ((rect_Card.Width * 4) / 10))), System.Convert.ToInt32(((rect_Card.Left + (rect_Card.Width / 2)) - (rect_Card.Width / 15))), System.Convert.ToInt32((rect_Card.Top + (rect_Card.Height / 2))), true); gp_Card.AddLine(System.Convert.ToInt32((rect_Card.Left + (rect_Card.Width / 2) + (rect_Card.Width / 15))), System.Convert.ToInt32((rect_Card.Top + (rect_Card.Height / 2))), System.Convert.ToInt32((rect_Card.Left + (rect_Card.Width / 2) + (rect_Card.Width / 25))), System.Convert.ToInt32((rect_Card.Top + (rect_Card.Height / 2) + ((rect_Card.Width * 4) / 10)))); gp_Card.Close(); canvas.DrawPath(gp_Card, _safefyPaint); gp_Card.Transform(tmp_Matrix); canvas.DrawPath(gp_Card, _safefyPaint); gp_Card.Transform(tmp_Matrix); canvas.DrawPath(gp_Card, _safefyPaint); gp_Card = new SKPath(); gp_Card.AddOval(SKRect.Create((rect_Card.Left + (rect_Card.Width / 2)) - (rect_Card.Width / 8), (rect_Card.Top + (rect_Card.Height / 2)) - (rect_Card.Width / 8), rect_Card.Width / 4, rect_Card.Width / 4)); canvas.DrawPath(gp_Card, _whitePaint); canvas.DrawPath(gp_Card, tempPen); break; case EnumCompleteCategories.ExtraTank: gp_Card = new SKPath(); pts = new SKPoint[3]; pts[0] = new SKPoint(rect_Card.Left + (rect_Card.Width / 4), (rect_Card.Top + (rect_Card.Height / 2)) - (rect_Card.Height / 8)); pts[1] = new SKPoint(rect_Card.Left + (rect_Card.Width / 6), rect_Card.Top + (rect_Card.Height / 2)); pts[2] = new SKPoint(rect_Card.Left + (rect_Card.Width / 4), rect_Card.Top + (rect_Card.Height / 2) + (rect_Card.Height / 8)); var top1 = pts[0]; gp_Card.MoveTo(pts[0]); gp_Card.QuadTo(pts[1], pts[2]); pts[0] = new SKPoint(rect_Card.Left + ((rect_Card.Width * 3) / 4), rect_Card.Top + (rect_Card.Height / 2) + (rect_Card.Height / 8)); pts[1] = new SKPoint(rect_Card.Left + ((rect_Card.Width * 5) / 6), rect_Card.Top + (rect_Card.Height / 2)); pts[2] = new SKPoint(rect_Card.Left + ((rect_Card.Width * 3) / 4), (rect_Card.Top + (rect_Card.Height / 2)) - (rect_Card.Height / 8)); var bottom2 = pts[0]; gp_Card.MoveTo(pts[0]); gp_Card.QuadTo(pts[1], pts[2]); var tempRect = new SKRect(top1.X, top1.Y, bottom2.X, bottom2.Y); gp_Card.Close(); canvas.DrawPath(gp_Card, _safefyPaint); gp_Card = new SKPath(); gp_Card.AddRect(SKRect.Create(rect_Card.Left + ((rect_Card.Width * 2) / 5), (rect_Card.Top + (rect_Card.Height / 2)) - (rect_Card.Height / 8) - (rect_Card.Height / 20), rect_Card.Width / 5, rect_Card.Height / 30)); canvas.DrawPath(gp_Card, _safefyPaint); canvas.DrawRect(tempRect, _safefyPaint); break; case EnumCompleteCategories.PunctureProof: gp_Card = new SKPath(); gp_Card.AddOval(SKRect.Create(rect_Card.Left + (rect_Card.Width / 6), pt_Center.Y - ((rect_Card.Width * 4) / 12), (rect_Card.Width * 4) / 6, (rect_Card.Width * 4) / 6)); reg_Temp = MiscHelpers.GetNewRegion(SKRect.Create(rect_Card.Left + (rect_Card.Width / 6), (pt_Center.Y - ((rect_Card.Width * 4) / 12)) + ((((rect_Card.Width * 4) / 6) * 5) / 6), (rect_Card.Width * 4) / 6, (rect_Card.Width * 4) / 6)); reg_Temp.SetPath(gp_Card); canvas.DrawRegion(reg_Temp, _safefyPaint); gp_Card = new SKPath(); gp_Card.AddOval(SKRect.Create(rect_Card.Left + ((rect_Card.Width * 2) / 6), pt_Center.Y - ((rect_Card.Width * 2) / 12), (rect_Card.Width * 2) / 6, (rect_Card.Width * 2) / 6)); canvas.DrawPath(gp_Card, _whitePaint); gp_Card = new SKPath(); gp_Card.AddOval(SKRect.Create(rect_Card.Left + (rect_Card.Width / 3) + (rect_Card.Width / 12), pt_Center.Y - (rect_Card.Width / 12), rect_Card.Width / 6, rect_Card.Width / 6)); canvas.DrawPath(gp_Card, _blackPaint); tmp_Matrix = SKMatrix.MakeTranslation(rect_Card.Width / 12, 0); gp_Card = new SKPath(); gp_Card.AddLine(rect_Card.Left, rect_Card.Top + (rect_Card.Height * 4 / 5) + (rect_Card.Width / 24), rect_Card.Left + (rect_Card.Width / 24), rect_Card.Top + (rect_Card.Height * 4 / 5 - (rect_Card.Width / 24)), true); gp_Card.AddLine(System.Convert.ToInt32((rect_Card.Left + (rect_Card.Width / 24))), System.Convert.ToInt32(((rect_Card.Top + ((rect_Card.Height * 4) / 5)) - (rect_Card.Width / 24))), System.Convert.ToInt32((rect_Card.Left + (rect_Card.Width / 12))), System.Convert.ToInt32((rect_Card.Top + ((rect_Card.Height * 4) / 5) + (rect_Card.Width / 24)))); for (var int_Count = 1; int_Count <= 10; int_Count++) { gp_Card.Transform(tmp_Matrix); canvas.DrawPath(gp_Card, _safefyPaint); } break; case EnumCompleteCategories.RightOfWay: tempPen = MiscHelpers.GetStrokePaint(SKColors.Blue, rect_Card.Width / 50); gp_Card = new SKPath(); gp_Card.AddLine(System.Convert.ToInt32((rect_Card.Left + (rect_Card.Width / 10))), System.Convert.ToInt32(((rect_Card.Top + (rect_Card.Height / 2)) - (rect_Card.Height / 5))), System.Convert.ToInt32((rect_Card.Left + ((rect_Card.Width * 9) / 10))), System.Convert.ToInt32((rect_Card.Top + (rect_Card.Height / 2))), true); canvas.DrawPath(gp_Card, tempPen); gp_Card = new SKPath(); gp_Card.AddLine(System.Convert.ToInt32((rect_Card.Left + (rect_Card.Width / 10))), System.Convert.ToInt32(((rect_Card.Top + (rect_Card.Height / 2)) - (rect_Card.Height / 10))), System.Convert.ToInt32((rect_Card.Left + ((rect_Card.Width * 9) / 10))), System.Convert.ToInt32(((rect_Card.Top + (rect_Card.Height / 2)) - (rect_Card.Height / 10))), true); canvas.DrawPath(gp_Card, tempPen); gp_Card = new SKPath(); gp_Card.AddLine(System.Convert.ToInt32((rect_Card.Left + (rect_Card.Width / 10))), System.Convert.ToInt32((rect_Card.Top + (rect_Card.Height / 2))), System.Convert.ToInt32((rect_Card.Left + ((rect_Card.Width * 9) / 10))), System.Convert.ToInt32(((rect_Card.Top + (rect_Card.Height / 2)) - (rect_Card.Height / 5))), true); canvas.DrawPath(gp_Card, tempPen); gp_Card = new SKPath(); canvas.DrawPath(gp_Card, _whitePaint); gp_Card = new SKPath(); pts = new SKPoint[3]; pts[0] = new SKPoint((rect_Card.Left + (rect_Card.Width / 2)) - (rect_Card.Width / 6), (rect_Card.Top + (rect_Card.Height / 2)) - (rect_Card.Height / 5)); pts[1] = new SKPoint(rect_Card.Left + (rect_Card.Width / 2), (rect_Card.Top + (rect_Card.Height / 2)) - (rect_Card.Height / 4)); pts[2] = new SKPoint(rect_Card.Left + (rect_Card.Width / 2) + (rect_Card.Width / 6), (rect_Card.Top + (rect_Card.Height / 2)) - (rect_Card.Height / 5)); gp_Card.MoveTo(pts[0]); gp_Card.QuadTo(pts[1], pts[2]); gp_Card.AddLine(System.Convert.ToInt32((rect_Card.Left + (rect_Card.Width / 2) + (rect_Card.Width / 6))), System.Convert.ToInt32((rect_Card.Top + (rect_Card.Height / 2))), System.Convert.ToInt32(((rect_Card.Left + (rect_Card.Width / 2)) - (rect_Card.Width / 6))), System.Convert.ToInt32((rect_Card.Top + (rect_Card.Height / 2)))); gp_Card.Close(); canvas.DrawPath(gp_Card, _safefyPaint); gp_Card = new SKPath(); pts = new SKPoint[3]; pts[0] = new SKPoint((rect_Card.Left + (rect_Card.Width / 2)) - (rect_Card.Width / 12), (rect_Card.Top + (rect_Card.Height / 2)) - (rect_Card.Height / 8)); pts[1] = new SKPoint(rect_Card.Left + (rect_Card.Width / 2), (rect_Card.Top + (rect_Card.Height / 2)) - (rect_Card.Height / 6)); pts[2] = new SKPoint(rect_Card.Left + (rect_Card.Width / 2) + (rect_Card.Width / 12), (rect_Card.Top + (rect_Card.Height / 2)) - (rect_Card.Height / 8)); gp_Card.MoveTo(pts[0]); gp_Card.QuadTo(pts[1], pts[2]); gp_Card.AddLine(System.Convert.ToInt32((rect_Card.Left + (rect_Card.Width / 2) + (rect_Card.Width / 12))), System.Convert.ToInt32(((rect_Card.Top + (rect_Card.Height / 2)) - (rect_Card.Height / 20))), System.Convert.ToInt32(((rect_Card.Left + (rect_Card.Width / 2)) - (rect_Card.Width / 12))), System.Convert.ToInt32(((rect_Card.Top + (rect_Card.Height / 2)) - (rect_Card.Height / 20)))); gp_Card.Close(); canvas.DrawPath(gp_Card, _whitePaint); canvas.DrawRect(SKRect.Create(rect_Card.Left + (rect_Card.Width / 4), rect_Card.Top + (rect_Card.Height / 2), rect_Card.Width / 2, rect_Card.Height / 10), _blackPaint); break; case EnumCompleteCategories.Distance25: DrawDistanceCard(canvas, "25", rect_Card); break; case EnumCompleteCategories.Distance50: DrawDistanceCard(canvas, "50", rect_Card); break; case EnumCompleteCategories.Distance75: DrawDistanceCard(canvas, "75", rect_Card); break; case EnumCompleteCategories.Distance100: DrawDistanceCard(canvas, "100", rect_Card); break; case EnumCompleteCategories.Distance200: DrawDistanceCard(canvas, "200", rect_Card); break; default: throw new BasicBlankException("Nothing Found"); } }
public void DrawImage(SKCanvas canvas, SKRect rect_Card) { SKRect firstRect; SKRect secondRect; firstRect = SKRect.Create(2, 2, rect_Card.Width - 6, rect_Card.Height / 2.1f); secondRect = SKRect.Create(rect_Card.Width / 4, rect_Card.Height / 2, rect_Card.Width / 2, rect_Card.Height / 2.2f); var circleRect = SKRect.Create(2, rect_Card.Height / 2, rect_Card.Width - 4, rect_Card.Height / 2.2f); switch (MilkType) { case EnumMilkType.Strawberry: canvas.DrawBitmap(_strawberryImage, firstRect); break; case EnumMilkType.Chocolate: canvas.DrawBitmap(_chocolateImage, firstRect); break; default: throw new BasicBlankException("Must be strawberry or chocolate"); } string thisText = ""; if (CardCategory != EnumCardCategory.Joker) { if (CardCategory == EnumCardCategory.Go) { thisText = "Go"; } else if (CardCategory == EnumCardCategory.Stop) { thisText = "Stop"; } else { thisText = Points.ToString(); } } switch (CardCategory) { case EnumCardCategory.Joker: var newRect = MainGraphics !.GetActualRectangle(13, 36, 30, 30); if (MilkType == EnumMilkType.Chocolate) { canvas.DrawSmiley(newRect, _chocolatePaint !, _textBorder !, _blackPaint !); } else if (MilkType == EnumMilkType.Strawberry) { canvas.DrawSmiley(newRect, _redPaint !, _textBorder !, _blackPaint !); } return; case EnumCardCategory.Go: canvas.DrawOval(circleRect, _limePaint); break; case EnumCardCategory.Stop: canvas.DrawOval(circleRect, _redPaint); break; default: break; } if (thisText == "") { throw new BasicBlankException("No text found"); } var fontSize = secondRect.Height * 1.2f; if (thisText == "Stop") { fontSize = secondRect.Height * .7f; //otherwise parts get cut off. } var textPaint = MiscHelpers.GetTextPaint(SKColors.White, fontSize); canvas.DrawBorderText(thisText, TextExtensions.EnumLayoutOptions.Center, TextExtensions.EnumLayoutOptions.Center, textPaint, _textBorder !, secondRect); }
public override void DrawImage(SKCanvas dc) { if (ActualHeight == 1) { return; } // anything that needs to be drawn for each space will be here. if nothing is done, then will do nothing. if (Number == 0) { return;// because no number associated with it. must have a number } if (Number == 10 || Number == 11) { throw new BasicBlankException("Can't have 10 or 11 for number"); } if (Number < 1 || Number > 12) { throw new BasicBlankException("Number has to be between 2 and 12 but no 10 or 11"); } // can be transparent and previous one (if removing space) if (ActualHeight != ActualWidth) { throw new BasicBlankException("Must be perfect squares for this game"); } if (ActualWidth == 0 || ActualHeight == 0) { throw new BasicBlankException("Can't be 0 for the actual width or height"); } var thisRect = GetMainRect(); var newRect = SKRect.Create(3, 3, thisRect.Width - 6, thisRect.Height - 6); if (Number != 2 && Number != 12) { if (WasPrevious == true) { dc.DrawRect(thisRect, _yellowPaint); } else { dc.DrawRect(thisRect, _whitePaint); } SKPaint otherTextPaint; if (MainColor.Equals(cs.Transparent) == false) { // this means do a circle dc.DrawOval(newRect, _borderPaint); dc.DrawOval(newRect, MainPaint); // i think otherTextPaint = MiscHelpers.GetTextPaint(SKColors.Aqua, newRect.Height * 1.2f); } else { otherTextPaint = MiscHelpers.GetTextPaint(SKColors.Red, newRect.Height * 1.2f); } dc.DrawBorderText(Number.ToString(), TextExtensions.EnumLayoutOptions.Center, TextExtensions.EnumLayoutOptions.Center, otherTextPaint, _text1Paint, newRect); dc.DrawRect(thisRect, _borderPaint); return; } dc.DrawRect(thisRect, _grayPaint); StandardDiceGraphicsCP firstDice = new StandardDiceGraphicsCP(); { var withBlock = firstDice; withBlock.Location = new SKPoint(newRect.Location.X, newRect.Location.Y); withBlock.NeedsToClear = false; withBlock.ActualWidthHeight = newRect.Height / 2.1f; withBlock.Value = Number / 2; withBlock.UseSmallerBorders(); if (WasPrevious == true) { withBlock.FillColor = cs.Yellow; } } StandardDiceGraphicsCP secondDice = new StandardDiceGraphicsCP(); { var withBlock1 = secondDice; withBlock1.Location = new SKPoint(firstDice.Location.X + 3 + firstDice.ActualWidthHeight, firstDice.Location.Y + 3 + firstDice.ActualWidthHeight); withBlock1.NeedsToClear = false; withBlock1.ActualWidthHeight = newRect.Height / 2.1f; withBlock1.Value = Number / 2; withBlock1.UseSmallerBorders(); if (WasPrevious == true) { withBlock1.FillColor = cs.Yellow; } } firstDice.DrawDice(dc); secondDice.DrawDice(dc); if (MainColor.Equals(cs.Transparent) == false) { // this means do a circle dc.DrawOval(newRect, _borderPaint); dc.DrawOval(newRect, MainPaint); // i think SKPaint otherTextPaint; if (Number == 2) { otherTextPaint = MiscHelpers.GetTextPaint(SKColors.Aqua, newRect.Height * 1.2f); } else { otherTextPaint = MiscHelpers.GetTextPaint(SKColors.Aqua, newRect.Height * 0.7f); } dc.DrawBorderText(Number.ToString(), TextExtensions.EnumLayoutOptions.Center, TextExtensions.EnumLayoutOptions.Center, otherTextPaint, _text1Paint, newRect); dc.DrawRect(thisRect, _borderPaint); return; } dc.DrawRect(thisRect, _borderPaint); }
public void DrawBacks(SKCanvas canvas, SKRect rect_Card) { SKRect firstRect; SKRect secondRect; SKRect thirdRect; SKRect fourthRect; firstRect = MainGraphics !.GetActualRectangle(8, 8, 15, 34); secondRect = MainGraphics.GetActualRectangle(23, 8, 11, 34); thirdRect = MainGraphics.GetActualRectangle(34, 8, 19, 34); fourthRect = MainGraphics.GetActualRectangle(53, 8, 19, 34); SKRect bottomRect; bottomRect = MainGraphics.GetActualRectangle(8, 50, 64, 42); var fontSize = firstRect.Height * 0.6f; canvas.DrawRect(firstRect, _purplePaint); canvas.DrawRect(firstRect, _blackBorder); var textPaint = MiscHelpers.GetTextPaint(SKColors.White, fontSize); canvas.DrawBorderText("L", TextExtensions.EnumLayoutOptions.Center, TextExtensions.EnumLayoutOptions.Center, textPaint, _blackBorder !, firstRect); canvas.DrawRect(secondRect, _bluePaint); canvas.DrawRect(secondRect, _blackBorder); canvas.DrawBorderText("I", TextExtensions.EnumLayoutOptions.Center, TextExtensions.EnumLayoutOptions.Center, textPaint, _blackBorder !, secondRect); canvas.DrawRect(thirdRect, _greenPaint); canvas.DrawRect(thirdRect, _blackBorder); canvas.DrawBorderText("F", TextExtensions.EnumLayoutOptions.Center, TextExtensions.EnumLayoutOptions.Center, textPaint, _blackBorder !, thirdRect); canvas.DrawRect(fourthRect, _darkOrangePaint); canvas.DrawRect(fourthRect, _blackBorder); canvas.DrawBorderText("E", TextExtensions.EnumLayoutOptions.Center, TextExtensions.EnumLayoutOptions.Center, textPaint, _blackBorder !, fourthRect); textPaint = MiscHelpers.GetTextPaint(SKColors.White, bottomRect.Height * 0.45f); string text; SKPaint currentPaint; switch (CardCategory) { case EnumCardCategory.Career: { currentPaint = _bluePaint !; text = "Career"; break; } case EnumCardCategory.House: { currentPaint = _darkOrangePaint !; text = "House"; break; } case EnumCardCategory.Salary: { currentPaint = _greenPaint !; text = "Salary"; break; } case EnumCardCategory.Stock: { currentPaint = _purplePaint !; text = "Stock"; break; } default: { throw new BasicBlankException("No type selected for back of cards"); } } canvas.DrawRect(bottomRect, currentPaint); canvas.DrawRect(bottomRect, _blackBorder); canvas.DrawBorderText(text, TextExtensions.EnumLayoutOptions.Center, TextExtensions.EnumLayoutOptions.Center, textPaint, _blackBorder !, bottomRect); }