浏览代码

Review fixes + icon + fixed create image rendering bug

Krzysztof Krysiński 2 周之前
父节点
当前提交
82ef8dfe3b

+ 1 - 1
src/Drawie

@@ -1 +1 @@
-Subproject commit 4a8a09f39ae70b0c6981fa3ba23cd1a3ee65ec1d
+Subproject commit 72897fd9e82d8997414dc709efed1783d6865936

+ 1 - 0
src/PixiEditor.ChangeableDocument/Changeables/Graph/Nodes/CreateImageNode.cs

@@ -86,6 +86,7 @@ public class CreateImageNode : Node
         RenderContext ctx = context.Clone();
         RenderContext ctx = context.Clone();
         ctx.RenderSurface = surface.DrawingSurface;
         ctx.RenderSurface = surface.DrawingSurface;
         ctx.RenderOutputSize = surface.Size;
         ctx.RenderOutputSize = surface.Size;
+        ctx.VisibleDocumentRegion = null;
 
 
         float chunkMultiplier = (float)context.ChunkResolution.Multiplier();
         float chunkMultiplier = (float)context.ChunkResolution.Multiplier();
 
 

+ 4 - 7
src/PixiEditor.ChangeableDocument/Changeables/Graph/Nodes/Image/PatternNode.cs

@@ -1,13 +1,11 @@
 using Drawie.Backend.Core;
 using Drawie.Backend.Core;
 using Drawie.Backend.Core.ColorsImpl;
 using Drawie.Backend.Core.ColorsImpl;
-using Drawie.Backend.Core.ColorsImpl.Paintables;
 using Drawie.Backend.Core.Mesh;
 using Drawie.Backend.Core.Mesh;
 using Drawie.Backend.Core.Numerics;
 using Drawie.Backend.Core.Numerics;
 using Drawie.Backend.Core.Surfaces;
 using Drawie.Backend.Core.Surfaces;
 using Drawie.Backend.Core.Surfaces.PaintImpl;
 using Drawie.Backend.Core.Surfaces.PaintImpl;
 using Drawie.Backend.Core.Vector;
 using Drawie.Backend.Core.Vector;
 using Drawie.Numerics;
 using Drawie.Numerics;
-using PixiEditor.ChangeableDocument.Changeables.Graph.Interfaces;
 using PixiEditor.ChangeableDocument.Changeables.Graph.Nodes.Shapes.Data;
 using PixiEditor.ChangeableDocument.Changeables.Graph.Nodes.Shapes.Data;
 using PixiEditor.ChangeableDocument.Rendering;
 using PixiEditor.ChangeableDocument.Rendering;
 
 
@@ -16,10 +14,10 @@ namespace PixiEditor.ChangeableDocument.Changeables.Graph.Nodes.Image;
 [NodeInfo("Pattern")]
 [NodeInfo("Pattern")]
 public class PatternNode : RenderNode
 public class PatternNode : RenderNode
 {
 {
-    public InputProperty<Texture> Fill { get; }
+    public InputProperty<Texture?> Fill { get; }
     public InputProperty<Matrix3X3> FillMatrix { get; }
     public InputProperty<Matrix3X3> FillMatrix { get; }
     public InputProperty<double> Spacing { get; }
     public InputProperty<double> Spacing { get; }
-    public InputProperty<ShapeVectorData> Path { get; }
+    public InputProperty<ShapeVectorData?> Path { get; }
     public InputProperty<PatternAlignment> Alignment { get; }
     public InputProperty<PatternAlignment> Alignment { get; }
     public InputProperty<PatternStretching> Stretching { get; }
     public InputProperty<PatternStretching> Stretching { get; }
 
 
@@ -98,8 +96,8 @@ public class PatternNode : RenderNode
     private void PlaceStretchToFit(DrawingSurface surface, VectorPath path, float distance, float spacing,
     private void PlaceStretchToFit(DrawingSurface surface, VectorPath path, float distance, float spacing,
         Paint tilePaint)
         Paint tilePaint)
     {
     {
-        int texWidth = (int)Fill.Value.Size.X;
-        int texHeight = (int)Fill.Value.Size.Y;
+        int texWidth = Fill.Value.Size.X;
+        int texHeight = Fill.Value.Size.Y;
 
 
         // Iterate over each column of the texture (1px wide quads)
         // Iterate over each column of the texture (1px wide quads)
         for (int x = 0; x < texWidth; x++)
         for (int x = 0; x < texWidth; x++)
@@ -148,7 +146,6 @@ public class PatternNode : RenderNode
         }
         }
     }
     }
 
 
-
     public override Node CreateCopy()
     public override Node CreateCopy()
     {
     {
         return new PatternNode();
         return new PatternNode();

二进制
src/PixiEditor.UI.Common/Fonts/PixiPerfect.ttf


+ 1 - 0
src/PixiEditor.UI.Common/Fonts/PixiPerfectIcons.axaml

@@ -167,6 +167,7 @@
             <system:String x:Key="icon-spline-chart">&#xE9BE;</system:String>
             <system:String x:Key="icon-spline-chart">&#xE9BE;</system:String>
             <system:String x:Key="icon-spray">&#xE90E;</system:String>
             <system:String x:Key="icon-spray">&#xE90E;</system:String>
             <system:String x:Key="icon-square">&#xE973;</system:String>
             <system:String x:Key="icon-square">&#xE973;</system:String>
+            <system:String x:Key="icon-stamp">&#xE9CD;</system:String>
             <system:String x:Key="icon-star">&#xE99C;</system:String>
             <system:String x:Key="icon-star">&#xE99C;</system:String>
             <system:String x:Key="icon-star-filled">&#xE999;</system:String>
             <system:String x:Key="icon-star-filled">&#xE999;</system:String>
             <system:String x:Key="icon-star-half">&#xE9AB;</system:String>
             <system:String x:Key="icon-star-half">&#xE9AB;</system:String>

+ 1 - 0
src/PixiEditor.UI.Common/Fonts/PixiPerfectIcons.axaml.cs

@@ -163,6 +163,7 @@ public static partial class PixiPerfectIcons
     public const string SplineChart = "\uE9BE";
     public const string SplineChart = "\uE9BE";
     public const string Spray = "\uE90E";
     public const string Spray = "\uE90E";
     public const string Square = "\uE973";
     public const string Square = "\uE973";
+    public const string Stamp = "\uE9CD";
     public const string Star = "\uE99C";
     public const string Star = "\uE99C";
     public const string StarFilled = "\uE999";
     public const string StarFilled = "\uE999";
     public const string StarHalf = "\uE9AB";
     public const string StarHalf = "\uE9AB";

+ 1 - 0
src/PixiEditor.UI.Common/Fonts/defs.svg

@@ -228,4 +228,5 @@
 <glyph unicode="&#xe9ca;" glyph-name="shredder" data-tags="shredder" d="M469.333 21.333c0-23.552-19.115-42.667-42.667-42.667s-42.667 19.115-42.667 42.667v213.333c0 23.552 19.115 42.667 42.667 42.667s42.667-19.115 42.667-42.667v-213.333zM640 149.333c0-23.552-19.115-42.667-42.667-42.667s-42.667 19.115-42.667 42.667v85.333c0 23.552 19.115 42.667 42.667 42.667s42.667-19.115 42.667-42.667v-85.333zM554.667 874.667c0 23.552 19.115 42.667 42.667 42.667s42.667-19.115 42.667-42.667v-170.667c0-23.424 19.243-42.667 42.667-42.667h170.667c23.552 0 42.667-19.115 42.667-42.667s-19.115-42.667-42.667-42.667h-170.667c-70.229 0-128 57.771-128 128v170.667zM810.667 106.667c0-23.552-19.115-42.667-42.667-42.667s-42.667 19.115-42.667 42.667v128c0 23.552 19.115 42.667 42.667 42.667s42.667-19.115 42.667-42.667v-128zM85.333 362.667c-23.552 0-42.667 19.115-42.667 42.667s19.115 42.667 42.667 42.667h853.333c23.552 0 42.667-19.115 42.667-42.667s-19.115-42.667-42.667-42.667h-853.333zM896 405.333c0-23.552-19.115-42.667-42.667-42.667s-42.667 19.115-42.667 42.667v238.336l-188.331 188.331h-366.336c-23.424 0-42.667-19.243-42.667-42.667v-384c0-23.552-19.115-42.667-42.667-42.667s-42.667 19.115-42.667 42.667v384c0 70.229 57.771 128 128 128h384c11.307 0 22.187-4.48 30.165-12.501l213.333-213.333c8.021-7.979 12.501-18.859 12.501-30.165v-256zM298.667 106.667c0-23.552-19.115-42.667-42.667-42.667s-42.667 19.115-42.667 42.667v128c0 23.552 19.115 42.667 42.667 42.667s42.667-19.115 42.667-42.667v-128z" />
 <glyph unicode="&#xe9ca;" glyph-name="shredder" data-tags="shredder" d="M469.333 21.333c0-23.552-19.115-42.667-42.667-42.667s-42.667 19.115-42.667 42.667v213.333c0 23.552 19.115 42.667 42.667 42.667s42.667-19.115 42.667-42.667v-213.333zM640 149.333c0-23.552-19.115-42.667-42.667-42.667s-42.667 19.115-42.667 42.667v85.333c0 23.552 19.115 42.667 42.667 42.667s42.667-19.115 42.667-42.667v-85.333zM554.667 874.667c0 23.552 19.115 42.667 42.667 42.667s42.667-19.115 42.667-42.667v-170.667c0-23.424 19.243-42.667 42.667-42.667h170.667c23.552 0 42.667-19.115 42.667-42.667s-19.115-42.667-42.667-42.667h-170.667c-70.229 0-128 57.771-128 128v170.667zM810.667 106.667c0-23.552-19.115-42.667-42.667-42.667s-42.667 19.115-42.667 42.667v128c0 23.552 19.115 42.667 42.667 42.667s42.667-19.115 42.667-42.667v-128zM85.333 362.667c-23.552 0-42.667 19.115-42.667 42.667s19.115 42.667 42.667 42.667h853.333c23.552 0 42.667-19.115 42.667-42.667s-19.115-42.667-42.667-42.667h-853.333zM896 405.333c0-23.552-19.115-42.667-42.667-42.667s-42.667 19.115-42.667 42.667v238.336l-188.331 188.331h-366.336c-23.424 0-42.667-19.243-42.667-42.667v-384c0-23.552-19.115-42.667-42.667-42.667s-42.667 19.115-42.667 42.667v384c0 70.229 57.771 128 128 128h384c11.307 0 22.187-4.48 30.165-12.501l213.333-213.333c8.021-7.979 12.501-18.859 12.501-30.165v-256zM298.667 106.667c0-23.552-19.115-42.667-42.667-42.667s-42.667 19.115-42.667 42.667v128c0 23.552 19.115 42.667 42.667 42.667s42.667-19.115 42.667-42.667v-128z" />
 <glyph unicode="&#xe9cb;" glyph-name="whole-word" data-tags="whole-word" d="M298.667 618.667c94.208 0 170.667-76.459 170.667-170.667s-76.459-170.667-170.667-170.667c-94.208 0-170.667 76.459-170.667 170.667s76.459 170.667 170.667 170.667zM298.667 533.333c-47.104 0-85.333-38.229-85.333-85.333s38.229-85.333 85.333-85.333c47.104 0 85.333 38.229 85.333 85.333s-38.229 85.333-85.333 85.333zM384 576c0 23.552 19.115 42.667 42.667 42.667s42.667-19.115 42.667-42.667v-256c0-23.552-19.115-42.667-42.667-42.667s-42.667 19.115-42.667 42.667v256zM725.333 618.667c94.208 0 170.667-76.459 170.667-170.667s-76.459-170.667-170.667-170.667c-94.208 0-170.667 76.459-170.667 170.667s76.459 170.667 170.667 170.667zM725.333 533.333c-47.104 0-85.333-38.229-85.333-85.333s38.229-85.333 85.333-85.333c47.104 0 85.333 38.229 85.333 85.333s-38.229 85.333-85.333 85.333zM554.667 661.333c0 23.552 19.115 42.667 42.667 42.667s42.667-19.115 42.667-42.667v-341.333c0-23.552-19.115-42.667-42.667-42.667s-42.667 19.115-42.667 42.667v341.333zM128 194.048l2.048-2.048h763.904l2.048 2.048v40.619c0 23.552 19.115 42.667 42.667 42.667s42.667-19.115 42.667-42.667v-42.667l-2.133-17.835-5.547-15.872c-4.395-9.429-10.624-18.261-18.133-25.813-7.552-7.509-16.384-13.739-25.813-18.133l-15.872-5.547-17.835-2.133h-768l-17.835 2.133-15.872 5.547c-9.429 4.395-18.261 10.624-25.813 18.133-7.509 7.552-13.739 16.384-18.133 25.813l-5.547 15.872-2.133 17.835v42.667c0 23.552 19.115 42.667 42.667 42.667s42.667-19.115 42.667-42.667v-40.619z" />
 <glyph unicode="&#xe9cb;" glyph-name="whole-word" data-tags="whole-word" d="M298.667 618.667c94.208 0 170.667-76.459 170.667-170.667s-76.459-170.667-170.667-170.667c-94.208 0-170.667 76.459-170.667 170.667s76.459 170.667 170.667 170.667zM298.667 533.333c-47.104 0-85.333-38.229-85.333-85.333s38.229-85.333 85.333-85.333c47.104 0 85.333 38.229 85.333 85.333s-38.229 85.333-85.333 85.333zM384 576c0 23.552 19.115 42.667 42.667 42.667s42.667-19.115 42.667-42.667v-256c0-23.552-19.115-42.667-42.667-42.667s-42.667 19.115-42.667 42.667v256zM725.333 618.667c94.208 0 170.667-76.459 170.667-170.667s-76.459-170.667-170.667-170.667c-94.208 0-170.667 76.459-170.667 170.667s76.459 170.667 170.667 170.667zM725.333 533.333c-47.104 0-85.333-38.229-85.333-85.333s38.229-85.333 85.333-85.333c47.104 0 85.333 38.229 85.333 85.333s-38.229 85.333-85.333 85.333zM554.667 661.333c0 23.552 19.115 42.667 42.667 42.667s42.667-19.115 42.667-42.667v-341.333c0-23.552-19.115-42.667-42.667-42.667s-42.667 19.115-42.667 42.667v341.333zM128 194.048l2.048-2.048h763.904l2.048 2.048v40.619c0 23.552 19.115 42.667 42.667 42.667s42.667-19.115 42.667-42.667v-42.667l-2.133-17.835-5.547-15.872c-4.395-9.429-10.624-18.261-18.133-25.813-7.552-7.509-16.384-13.739-25.813-18.133l-15.872-5.547-17.835-2.133h-768l-17.835 2.133-15.872 5.547c-9.429 4.395-18.261 10.624-25.813 18.133-7.509 7.552-13.739 16.384-18.133 25.813l-5.547 15.872-2.133 17.835v42.667c0 23.552 19.115 42.667 42.667 42.667s42.667-19.115 42.667-42.667v-40.619z" />
 <glyph unicode="&#xe9cc;" glyph-name="slice" data-tags="slice" d="M753.621 835.285c24.96 24.96 58.837 38.997 94.165 38.997 73.045 0 133.163-60.117 133.163-133.163 0-35.328-14.037-69.205-38.997-94.165l-412.288-412.288c-5.376-5.376-11.349-9.899-17.664-13.525v-71.808c0-46.805-38.528-85.333-85.333-85.333h-341.333c-17.237 0-32.811 10.411-39.424 26.325-6.613 15.957-2.944 34.304 9.259 46.507l698.453 698.453zM426.667 221.141c-6.315 3.627-12.288 8.149-17.664 13.525l-67.669 67.669-153.003-153.003h238.336v71.808zM401.664 362.667l67.669-67.669 412.288 412.288c8.96 8.96 13.995 21.163 13.995 33.835 0 26.24-21.589 47.829-47.829 47.829-12.672 0-24.875-5.035-33.835-13.995l-412.288-412.288z" />
 <glyph unicode="&#xe9cc;" glyph-name="slice" data-tags="slice" d="M753.621 835.285c24.96 24.96 58.837 38.997 94.165 38.997 73.045 0 133.163-60.117 133.163-133.163 0-35.328-14.037-69.205-38.997-94.165l-412.288-412.288c-5.376-5.376-11.349-9.899-17.664-13.525v-71.808c0-46.805-38.528-85.333-85.333-85.333h-341.333c-17.237 0-32.811 10.411-39.424 26.325-6.613 15.957-2.944 34.304 9.259 46.507l698.453 698.453zM426.667 221.141c-6.315 3.627-12.288 8.149-17.664 13.525l-67.669 67.669-153.003-153.003h238.336v71.808zM401.664 362.667l67.669-67.669 412.288 412.288c8.96 8.96 13.995 21.163 13.995 33.835 0 26.24-21.589 47.829-47.829 47.829-12.672 0-24.875-5.035-33.835-13.995l-412.288-412.288z" />
+<glyph unicode="&#xe9cd;" glyph-name="stamp" data-tags="stamp" d="M640 405.333c0-23.552-19.115-42.667-42.667-42.667s-42.667 19.115-42.667 42.667v192c0 35.157 9.173 56.277 20.437 76.416 9.6 17.195 22.229 32.981 22.229 72.917 0 46.805-38.528 85.333-85.333 85.333s-85.333-38.528-85.333-85.333c0-39.936 12.629-55.723 22.229-72.917 11.264-20.139 20.437-41.259 20.437-76.416v-192c0-23.552-19.115-42.667-42.667-42.667s-42.667 19.115-42.667 42.667v192c0 22.016-8.363 32.683-15.701 45.483-13.397 23.467-26.965 50.219-26.965 103.851 0 93.611 77.056 170.667 170.667 170.667s170.667-77.056 170.667-170.667c0-53.632-13.568-80.384-26.965-103.851-7.339-12.8-15.701-23.467-15.701-45.483v-192zM896 298.667v-64c0-46.805-38.528-85.333-85.333-85.333h-597.333c-46.805 0-85.333 38.528-85.333 85.333v64c0 81.92 67.413 149.333 149.333 149.333h469.333c81.92 0 149.333-67.413 149.333-149.333zM213.333 234.667h597.333v64c0 35.115-28.885 64-64 64h-469.333c-35.115 0-64-28.885-64-64v-64zM213.333-21.333c-23.552 0-42.667 19.115-42.667 42.667s19.115 42.667 42.667 42.667h597.333c23.552 0 42.667-19.115 42.667-42.667s-19.115-42.667-42.667-42.667h-597.333z" />
 </font></defs></svg>
 </font></defs></svg>

+ 2 - 1
src/PixiEditor/Data/Localization/Languages/en.json

@@ -1155,5 +1155,6 @@
   "PLACE_ALONG_PATTERN_STRETCHING": "Place along",
   "PLACE_ALONG_PATTERN_STRETCHING": "Place along",
   "CENTER_PATTERN_ALIGNMENT": "Center",
   "CENTER_PATTERN_ALIGNMENT": "Center",
   "OUTSIDE_PATTERN_ALIGNMENT": "Outside",
   "OUTSIDE_PATTERN_ALIGNMENT": "Outside",
-  "INSIDE_PATTERN_ALIGNMENT": "Inside"
+  "INSIDE_PATTERN_ALIGNMENT": "Inside",
+  "PATTERN_NODE": "Pattern"
 }
 }

+ 2 - 5
src/PixiEditor/ViewModels/Document/Nodes/Image/PatternNodeViewModel.cs

@@ -3,8 +3,5 @@ using PixiEditor.ViewModels.Nodes;
 
 
 namespace PixiEditor.ViewModels.Document.Nodes.Image;
 namespace PixiEditor.ViewModels.Document.Nodes.Image;
 
 
-[NodeViewModel("Pattern", "IMAGE", null)]
-internal class PatternNodeViewModel : NodeViewModel<PatternNode>
-{
-
-}
+[NodeViewModel("PATTERN_NODE", "IMAGE", PixiPerfectIcons.Stamp)]
+internal class PatternNodeViewModel : NodeViewModel<PatternNode>;

+ 1 - 1
src/PixiParser

@@ -1 +1 @@
-Subproject commit 0e9c1ec319cb59ab5dffe2eb0e7b8e4165b732d6
+Subproject commit 55a0d52540a867d1db67f935875c503ed9de98c3