|
@@ -20,6 +20,8 @@ public class CreateImageNode : Node, IPreviewRenderable
|
|
|
|
|
|
public RenderInputProperty Content { get; }
|
|
public RenderInputProperty Content { get; }
|
|
|
|
|
|
|
|
+ public InputProperty<VecD> ContentOffset { get; }
|
|
|
|
+
|
|
public RenderOutputProperty RenderOutput { get; }
|
|
public RenderOutputProperty RenderOutput { get; }
|
|
|
|
|
|
private TextureCache textureCache = new();
|
|
private TextureCache textureCache = new();
|
|
@@ -30,6 +32,7 @@ public class CreateImageNode : Node, IPreviewRenderable
|
|
Size = CreateInput(nameof(Size), "SIZE", new VecI(32, 32)).WithRules(v => v.Min(VecI.One));
|
|
Size = CreateInput(nameof(Size), "SIZE", new VecI(32, 32)).WithRules(v => v.Min(VecI.One));
|
|
Fill = CreateInput(nameof(Fill), "FILL", Colors.Transparent);
|
|
Fill = CreateInput(nameof(Fill), "FILL", Colors.Transparent);
|
|
Content = CreateRenderInput(nameof(Content), "CONTENT");
|
|
Content = CreateRenderInput(nameof(Content), "CONTENT");
|
|
|
|
+ ContentOffset = CreateInput(nameof(ContentOffset), "CONTENT_OFFSET", VecD.Zero);
|
|
RenderOutput = CreateRenderOutput("RenderOutput", "RENDER_OUTPUT", () => new Painter(OnPaint));
|
|
RenderOutput = CreateRenderOutput("RenderOutput", "RENDER_OUTPUT", () => new Painter(OnPaint));
|
|
}
|
|
}
|
|
|
|
|
|
@@ -58,6 +61,8 @@ public class CreateImageNode : Node, IPreviewRenderable
|
|
RenderContext ctx = new RenderContext(surface.DrawingSurface, context.FrameTime, context.ChunkResolution,
|
|
RenderContext ctx = new RenderContext(surface.DrawingSurface, context.FrameTime, context.ChunkResolution,
|
|
context.DocumentSize, context.ProcessingColorSpace);
|
|
context.DocumentSize, context.ProcessingColorSpace);
|
|
|
|
|
|
|
|
+ surface.DrawingSurface.Canvas.Translate((float)-ContentOffset.Value.X, (float)-ContentOffset.Value.Y);
|
|
|
|
+
|
|
Content.Value?.Paint(ctx, surface.DrawingSurface);
|
|
Content.Value?.Paint(ctx, surface.DrawingSurface);
|
|
|
|
|
|
surface.DrawingSurface.Canvas.RestoreToCount(saved);
|
|
surface.DrawingSurface.Canvas.RestoreToCount(saved);
|