Bläddra i källkod

Added angle to sweep gradient

Krzysztof Krysiński 6 månader sedan
förälder
incheckning
7df2e380d1

+ 1 - 1
src/Drawie

@@ -1 +1 @@
-Subproject commit e4fd9dcad5f1f0d67745217d08b52a4ecbdbfb30
+Subproject commit 4a2fdd1c8cd368b24a512033b5935cf3ee758b8f

+ 2 - 0
src/PixiEditor/Helpers/Extensions/ColorHelpers.cs

@@ -55,6 +55,7 @@ internal static class ColorHelpers
                 new GradientStop(new BackendColor(stop.Color.R, stop.Color.G, stop.Color.B), stop.Offset))),
         IConicGradientBrush conicGradientBrush => new SweepGradientPaintable(
             new VecD(conicGradientBrush.Center.Point.X, conicGradientBrush.Center.Point.Y),
+            conicGradientBrush.Angle,
             conicGradientBrush.GradientStops.Select(stop =>
                 new GradientStop(new BackendColor(stop.Color.R, stop.Color.G, stop.Color.B), stop.Offset))),
 
@@ -78,6 +79,7 @@ internal static class ColorHelpers
         },
         SweepGradientPaintable conicGradientPaintable => new ConicGradientBrush
         {
+            Angle = conicGradientPaintable.Angle,
             Center = new RelativePoint(conicGradientPaintable.Center.X, conicGradientPaintable.Center.Y, RelativeUnit.Absolute),
             GradientStops = ToAvaloniaGradientStops(conicGradientPaintable.GradientStops)
         },

+ 3 - 1
src/PixiEditor/Models/Serialization/Factories/Paintables/SweepGradientSerializationFactory.cs

@@ -10,13 +10,15 @@ internal class SweepGradientSerializationFactory : GradientPaintableSerializatio
     protected override void SerializeSpecificGradient(SweepGradientPaintable paintable, ByteBuilder builder)
     {
         builder.AddVecD(paintable.Center);
+        builder.AddDouble(paintable.Angle);
     }
 
     protected override SweepGradientPaintable DeserializeGradient(bool absoluteValues, Matrix3X3? transform, List<GradientStop> stops,
         ByteExtractor extractor)
     {
         VecD center = extractor.GetVecD();
+        double angle = extractor.GetDouble();
 
-        return new SweepGradientPaintable(center, stops) { AbsoluteValues = absoluteValues, Transform = transform };
+        return new SweepGradientPaintable(center, angle, stops) { AbsoluteValues = absoluteValues, Transform = transform };
     }
 }

+ 1 - 1
src/colorpicker

@@ -1 +1 @@
-Subproject commit d4df47c3ba88c0120c6ae537af7660f13b6ea87d
+Subproject commit b9a7f5673e68fbdec527ebb56fc170b29bfed090