private static void DrawEllipse(Graphics g, Pen pen, Brush brush, TmxMap tmxMap, TmxObjectEllipse tmxEllipse) { RectangleF rc = new RectangleF(new PointF(0, 0), tmxEllipse.Size); if (tmxMap.Orientation == TmxMap.MapOrientation.Isometric) { // Circles and ellipses not supported in Insometric mode g.FillEllipse(Brushes.Red, rc); g.DrawEllipse(Pens.White, rc); Logger.WriteWarning(" Not supported (isometric): {0}", tmxEllipse.GetNonEmptyName()); } else if (!tmxEllipse.IsCircle()) { // We don't really support ellipses, especially as colliders g.FillEllipse(Brushes.Red, rc); g.DrawEllipse(Pens.White, rc); Logger.WriteWarning(" Not supported (ellipse): {0}", tmxEllipse.GetNonEmptyName()); } else { g.FillEllipse(brush, rc); g.DrawEllipse(pen, rc); } }
private static void DrawEllipse(SKCanvas canvas, SKColor color, TmxMap tmxMap, TmxObjectEllipse tmxEllipse) { SKRect rc = new SKRect(0, 0, tmxEllipse.Size.Width, tmxEllipse.Size.Height); SKColor stroke = color; SKColor fill = color.WithAlpha(128); using (SKPaint paint = new SKPaint()) using (SKPath path = new SKPath()) { if (tmxMap.Orientation == TmxMap.MapOrientation.Isometric) { // Circles and ellipses not supported in Insometric mode stroke = SKColors.Black; fill = SKColors.Red; Logger.WriteWarning("Circles/Ellipses not supported in isometric mode: {0}", tmxEllipse.GetNonEmptyName()); } else if (!tmxEllipse.IsCircle()) { stroke = SKColors.Black; fill = SKColors.Red; Logger.WriteWarning("Object is an ellipse and will be ignored (only circles supported): {0}", tmxEllipse.GetNonEmptyName()); } path.AddOval(rc); paint.Style = SKPaintStyle.Fill; paint.Color = fill; canvas.DrawPath(path, paint); paint.Style = SKPaintStyle.Stroke; paint.StrokeWidth = StrokeWidthThick; paint.Color = stroke; canvas.DrawPath(path, paint); } }