|
@@ -27,7 +27,8 @@ internal class EllipseOperation : IMirroredDrawOperation
|
|
|
private RectI? ellipseFillRect;
|
|
|
private bool antialiased;
|
|
|
|
|
|
- public EllipseOperation(RectI location, Color strokeColor, Color fillColor, int strokeWidth, double rotationRad, Paint? paint = null)
|
|
|
+ public EllipseOperation(RectI location, Color strokeColor, Color fillColor, int strokeWidth, double rotationRad,
|
|
|
+ bool antiAliased, Paint? paint = null)
|
|
|
{
|
|
|
this.location = location;
|
|
|
this.strokeColor = strokeColor;
|
|
@@ -35,7 +36,7 @@ internal class EllipseOperation : IMirroredDrawOperation
|
|
|
this.strokeWidth = strokeWidth;
|
|
|
this.rotation = rotationRad;
|
|
|
this.paint = paint?.Clone() ?? new Paint();
|
|
|
- antialiased = paint?.IsAntiAliased ?? false;
|
|
|
+ antialiased = antiAliased;
|
|
|
}
|
|
|
|
|
|
private void Init()
|
|
@@ -94,6 +95,7 @@ internal class EllipseOperation : IMirroredDrawOperation
|
|
|
|
|
|
private void DrawAliased(DrawingSurface surf)
|
|
|
{
|
|
|
+ paint.IsAntiAliased = false;
|
|
|
if (strokeWidth == 1)
|
|
|
{
|
|
|
if (Math.Abs(rotation) < 0.001)
|
|
@@ -154,16 +156,22 @@ internal class EllipseOperation : IMirroredDrawOperation
|
|
|
surf.Canvas.Save();
|
|
|
surf.Canvas.RotateRadians((float)rotation, (float)location.Center.X, (float)location.Center.Y);
|
|
|
|
|
|
+ paint.IsAntiAliased = false;
|
|
|
paint.Color = fillColor;
|
|
|
paint.Style = PaintStyle.Fill;
|
|
|
|
|
|
- surf.Canvas.DrawOval(location.Center, location.Size / 2f, paint);
|
|
|
+ RectD fillRect = ((RectD)location).Inflate(-strokeWidth / 2f);
|
|
|
|
|
|
+ surf.Canvas.DrawOval(fillRect.Center, fillRect.Size / 2f, paint);
|
|
|
+
|
|
|
+ paint.IsAntiAliased = true;
|
|
|
paint.Color = strokeColor;
|
|
|
paint.Style = PaintStyle.Stroke;
|
|
|
paint.StrokeWidth = strokeWidth;
|
|
|
|
|
|
- surf.Canvas.DrawOval(location.Center, location.Size / 2f, paint);
|
|
|
+ RectD strokeRect = ((RectD)location).Inflate((-strokeWidth / 2f));
|
|
|
+
|
|
|
+ surf.Canvas.DrawOval(strokeRect.Center, strokeRect.Size / 2f, paint);
|
|
|
|
|
|
surf.Canvas.Restore();
|
|
|
}
|
|
@@ -191,7 +199,7 @@ internal class EllipseOperation : IMirroredDrawOperation
|
|
|
newLocation = (RectI)newLocation.ReflectX((double)verAxisX).Round();
|
|
|
if (horAxisY is not null)
|
|
|
newLocation = (RectI)newLocation.ReflectY((double)horAxisY).Round();
|
|
|
- return new EllipseOperation(newLocation, strokeColor, fillColor, strokeWidth, rotation, paint);
|
|
|
+ return new EllipseOperation(newLocation, strokeColor, fillColor, strokeWidth, rotation, antialiased, paint);
|
|
|
}
|
|
|
|
|
|
public void Dispose()
|