private void Box(SKCanvas canvas, Box line) { var region = new SKRegion(); region.SetRect(new SKRectI((int)line.Start.X, (int)line.Start.Y, (int)line.End.X, (int)line.End.Y)); canvas.DrawRegion(region, _paintDevice); }
void OnCanvasViewPaintSurface(object sender, SKPaintSurfaceEventArgs args) { // Retrieve canvas state. SKImageInfo info = args.Info; SKSurface surface = args.Surface; SKCanvas canvas = surface.Canvas; // Clear any drawing from previous draw call. canvas.Clear(); int radius = 10; // Create circular path using (SKPath circlePath = new SKPath()) { circlePath.AddCircle(0, 0, radius); // Create circular region using (SKRegion circleRegion = new SKRegion()) { // Defines a region that is 20 x 20 pixel units. circleRegion.SetRect(new SKRectI(-radius, -radius, radius, radius)); circleRegion.SetPath(circlePath); // Set transform to move it to center and scale up canvas.Translate(info.Width / 2, info.Height / 2); // This scales the region to be proportional to our arbitrary units. canvas.Scale(Math.Min(info.Width / 2, info.Height / 2) / radius); // Fill region using (SKPaint fillPaint = new SKPaint()) { fillPaint.Style = SKPaintStyle.Fill; fillPaint.Color = SKColors.Orange; // The circle appears pixelated because our // defined region defines the pixel count. canvas.DrawRegion(circleRegion, fillPaint); } // Fill paint is properly disposed of. // Stroke path for comparison using (SKPaint strokePaint = new SKPaint()) { strokePaint.Style = SKPaintStyle.Stroke; strokePaint.Color = SKColors.Blue; strokePaint.StrokeWidth = 0.1f; // The drawn path is not pixelated as it // is not bounded by a region. canvas.DrawPath(circlePath, strokePaint); } // Stoke paint is properly disposed of. } // Circle region is properly disposed of. } // Circle path is properly disposed of. }
void OnCanvasViewPaintSurface(object sender, SKPaintSurfaceEventArgs args) { SKImageInfo info = args.Info; SKSurface surface = args.Surface; SKCanvas canvas = surface.Canvas; canvas.Clear(); int radius = 10; // Create circular path using (SKPath circlePath = new SKPath()) { circlePath.AddCircle(0, 0, radius); // Create circular region using (SKRegion circleRegion = new SKRegion()) { circleRegion.SetRect(new SKRectI(-radius, -radius, radius, radius)); circleRegion.SetPath(circlePath); // Set transform to move it to center and scale up canvas.Translate(info.Width / 2, info.Height / 2); canvas.Scale(Math.Min(info.Width / 2, info.Height / 2) / radius); // Fill region using (SKPaint fillPaint = new SKPaint()) { fillPaint.Style = SKPaintStyle.Fill; fillPaint.Color = SKColors.Orange; canvas.DrawRegion(circleRegion, fillPaint); } // Stroke path for comparison using (SKPaint strokePaint = new SKPaint()) { strokePaint.Style = SKPaintStyle.Stroke; strokePaint.Color = SKColors.Blue; strokePaint.StrokeWidth = 0.1f; canvas.DrawPath(circlePath, strokePaint); } } } }
protected override void OnDraw(SKImageInfo info, SKCanvas canvas) { if (CanvasSizeChanged) { _outterRect = SKRect.Create( _outterWidthRatio * info.Width / -2, _outterHeightRatio * info.Height / -2, _outterWidthRatio * info.Width, _outterHeightRatio * info.Height); } if (_firstDraw) { if (IsSquare) { float cropRectLength = Math.Min(_initCropperWidthRatio * info.Width, _initCropperHeightRatio * info.Height); _cropRect = SKRect.Create(cropRectLength / -2, cropRectLength / -2, cropRectLength, cropRectLength); } else { _cropRect = SKRect.Create( _initCropperWidthRatio * info.Width / -2, _initCropperHeightRatio * info.Height / -2, _initCropperWidthRatio * info.Width, _initCropperHeightRatio * info.Height); } _firstDraw = false; } //Draw Dim Bg using SKRegion bgRegion = new SKRegion(SKRectI.Round(_outterRect)); bgRegion.Op(SKRectI.Round(_cropRect), SKRegionOperation.Difference); canvas.DrawRegion(bgRegion, _outterRectPaint); //Draw CropRect canvas.DrawRect(_cropRect, _cropperRectPaint); //Draw Corner using SKPath cornerPath = new SKPath(); //左上角 cornerPath.MoveTo(_cropRect.Left + _cornerLength, _cropRect.Top); cornerPath.LineTo(_cropRect.Left, _cropRect.Top); cornerPath.LineTo(_cropRect.Left, _cropRect.Top + _cornerLength); //右上角 cornerPath.MoveTo(_cropRect.Right - _cornerLength, _cropRect.Top); cornerPath.LineTo(_cropRect.Right, _cropRect.Top); cornerPath.LineTo(_cropRect.Right, _cropRect.Top + _cornerLength); //左下角 cornerPath.MoveTo(_cropRect.Left + _cornerLength, _cropRect.Bottom); cornerPath.LineTo(_cropRect.Left, _cropRect.Bottom); cornerPath.LineTo(_cropRect.Left, _cropRect.Bottom - _cornerLength); //右下角 cornerPath.MoveTo(_cropRect.Right - _cornerLength, _cropRect.Bottom); cornerPath.LineTo(_cropRect.Right, _cropRect.Bottom); cornerPath.LineTo(_cropRect.Right, _cropRect.Bottom - _cornerLength); canvas.DrawPath(cornerPath, _cornerPaint); }
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"); } }