|
@@ -1,4 +1,5 @@
|
|
|
-using PixiEditor.DrawingApi.Core.Surfaces;
|
|
|
+using PixiEditor.DrawingApi.Core.Numerics;
|
|
|
+using PixiEditor.DrawingApi.Core.Surfaces;
|
|
|
using PixiEditor.DrawingApi.Core.Surfaces.PaintImpl;
|
|
|
using PixiEditor.Numerics;
|
|
|
|
|
@@ -7,7 +8,7 @@ namespace PixiEditor.ChangeableDocument.Changeables.Graph.Nodes.Shapes.Data;
|
|
|
public class PointsVectorData : ShapeVectorData
|
|
|
{
|
|
|
public List<VecD> Points { get; set; } = new();
|
|
|
-
|
|
|
+
|
|
|
public PointsVectorData(IEnumerable<VecD> points)
|
|
|
{
|
|
|
Points = new List<VecD>(points);
|
|
@@ -15,33 +16,40 @@ public class PointsVectorData : ShapeVectorData
|
|
|
|
|
|
public override RectD GeometryAABB => new RectD(Points.Min(p => p.X), Points.Min(p => p.Y), Points.Max(p => p.X),
|
|
|
Points.Max(p => p.Y));
|
|
|
+
|
|
|
public override ShapeCorners TransformationCorners => new ShapeCorners(
|
|
|
GeometryAABB).WithMatrix(TransformationMatrix);
|
|
|
|
|
|
public override void RasterizeGeometry(DrawingSurface drawingSurface, ChunkResolution resolution, Paint? paint)
|
|
|
{
|
|
|
- Rasterize(drawingSurface, paint, false);
|
|
|
+ Rasterize(drawingSurface, paint, resolution, false);
|
|
|
}
|
|
|
|
|
|
public override void RasterizeTransformed(DrawingSurface drawingSurface, ChunkResolution resolution, Paint paint)
|
|
|
{
|
|
|
- Rasterize(drawingSurface, paint, true);
|
|
|
+ Rasterize(drawingSurface, paint, resolution, true);
|
|
|
}
|
|
|
|
|
|
- private void Rasterize(DrawingSurface drawingSurface, Paint paint, bool applyTransform)
|
|
|
+ private void Rasterize(DrawingSurface drawingSurface, Paint paint, ChunkResolution resolution, bool applyTransform)
|
|
|
{
|
|
|
paint.Color = FillColor;
|
|
|
paint.StrokeWidth = StrokeWidth;
|
|
|
-
|
|
|
+
|
|
|
int num = 0;
|
|
|
if (applyTransform)
|
|
|
{
|
|
|
num = drawingSurface.Canvas.Save();
|
|
|
- drawingSurface.Canvas.SetMatrix(TransformationMatrix);
|
|
|
+ Matrix3X3 final = TransformationMatrix with
|
|
|
+ {
|
|
|
+ TransX = TransformationMatrix.TransX * (float)resolution.Multiplier(),
|
|
|
+ TransY = TransformationMatrix.TransY * (float)resolution.Multiplier()
|
|
|
+ };
|
|
|
+ drawingSurface.Canvas.SetMatrix(final);
|
|
|
}
|
|
|
-
|
|
|
- drawingSurface.Canvas.DrawPoints(PointMode.Points, Points.Select(p => new Point((int)p.X, (int)p.Y)).ToArray(), paint);
|
|
|
-
|
|
|
+
|
|
|
+ drawingSurface.Canvas.DrawPoints(PointMode.Points, Points.Select(p => new Point((int)p.X, (int)p.Y)).ToArray(),
|
|
|
+ paint);
|
|
|
+
|
|
|
if (applyTransform)
|
|
|
{
|
|
|
drawingSurface.Canvas.RestoreToCount(num);
|
|
@@ -67,9 +75,7 @@ public class PointsVectorData : ShapeVectorData
|
|
|
{
|
|
|
return new PointsVectorData(Points)
|
|
|
{
|
|
|
- StrokeColor = StrokeColor,
|
|
|
- FillColor = FillColor,
|
|
|
- StrokeWidth = StrokeWidth
|
|
|
+ StrokeColor = StrokeColor, FillColor = FillColor, StrokeWidth = StrokeWidth
|
|
|
};
|
|
|
}
|
|
|
}
|