Преглед на файлове

Fixed 0 width antialiased shapes

flabbet преди 9 месеца
родител
ревизия
ab8cc447a7
променени са 2 файла, в които са добавени 4 реда и са изтрити 4 реда
  1. 2 2
      src/ChunkyImageLib/Operations/EllipseOperation.cs
  2. 2 2
      src/ChunkyImageLib/Operations/RectangleOperation.cs

+ 2 - 2
src/ChunkyImageLib/Operations/EllipseOperation.cs

@@ -165,9 +165,9 @@ internal class EllipseOperation : IMirroredDrawOperation
         surf.Canvas.DrawOval(fillRect.Center, fillRect.Size / 2f, paint);
         
         paint.IsAntiAliased = true;
-        paint.Color = strokeColor;
+        paint.Color = strokeWidth <= 0 ? fillColor : strokeColor;
         paint.Style = PaintStyle.Stroke;
-        paint.StrokeWidth = strokeWidth;
+        paint.StrokeWidth = strokeWidth <= 0 ? 1f : strokeWidth;
         
         RectD strokeRect = ((RectD)location).Inflate((-strokeWidth / 2f));
         

+ 2 - 2
src/ChunkyImageLib/Operations/RectangleOperation.cs

@@ -86,8 +86,8 @@ internal class RectangleOperation : IMirroredDrawOperation
 
         // draw stroke
         surf.Canvas.Save();
-        paint.StrokeWidth = (float)Data.StrokeWidth;
-        paint.Color = Data.StrokeColor;
+        paint.StrokeWidth = Data.StrokeWidth > 0 ? Data.StrokeWidth : 1;
+        paint.Color = Data.StrokeWidth > 0 ? Data.StrokeColor : Data.FillColor;
         paint.Style = PaintStyle.Stroke;
         RectD innerRect = rect.Inflate(-Data.StrokeWidth / 2f);
         surf.Canvas.DrawRect((float)innerRect.Left, (float)innerRect.Top, (float)innerRect.Width, (float)innerRect.Height, paint);