Browse Source

Changed KeyFrameTime to Rendering Context

flabbet 1 year ago
parent
commit
0889842c59
25 changed files with 104 additions and 58 deletions
  1. 22 1
      src/PixiEditor.ChangeableDocument/Changeables/Document.cs
  2. 2 1
      src/PixiEditor.ChangeableDocument/Changeables/Graph/Interfaces/IReadOnlyNode.cs
  3. 3 2
      src/PixiEditor.ChangeableDocument/Changeables/Graph/Interfaces/IReadOnlyNodeGraph.cs
  4. 3 2
      src/PixiEditor.ChangeableDocument/Changeables/Graph/NodeGraph.cs
  5. 2 1
      src/PixiEditor.ChangeableDocument/Changeables/Graph/Nodes/CircleNode.cs
  6. 2 1
      src/PixiEditor.ChangeableDocument/Changeables/Graph/Nodes/CombineColorNode.cs
  7. 2 1
      src/PixiEditor.ChangeableDocument/Changeables/Graph/Nodes/EmptyImageNode.cs
  8. 2 1
      src/PixiEditor.ChangeableDocument/Changeables/Graph/Nodes/FolderNode.cs
  9. 8 8
      src/PixiEditor.ChangeableDocument/Changeables/Graph/Nodes/ImageLayerNode.cs
  10. 2 1
      src/PixiEditor.ChangeableDocument/Changeables/Graph/Nodes/ImageSizeNode.cs
  11. 2 1
      src/PixiEditor.ChangeableDocument/Changeables/Graph/Nodes/ImageSpaceNode.cs
  12. 2 1
      src/PixiEditor.ChangeableDocument/Changeables/Graph/Nodes/MathNode.cs
  13. 2 1
      src/PixiEditor.ChangeableDocument/Changeables/Graph/Nodes/MergeNode.cs
  14. 2 1
      src/PixiEditor.ChangeableDocument/Changeables/Graph/Nodes/ModifyImageLeftNode.cs
  15. 2 1
      src/PixiEditor.ChangeableDocument/Changeables/Graph/Nodes/ModifyImageRightNode.cs
  16. 17 9
      src/PixiEditor.ChangeableDocument/Changeables/Graph/Nodes/Node.cs
  17. 2 1
      src/PixiEditor.ChangeableDocument/Changeables/Graph/Nodes/OutputNode.cs
  18. 2 1
      src/PixiEditor.ChangeableDocument/Changeables/Graph/Nodes/SeparateColorNode.cs
  19. 2 1
      src/PixiEditor.ChangeableDocument/Changeables/Graph/Nodes/SeparateVecDNode.cs
  20. 2 1
      src/PixiEditor.ChangeableDocument/Changeables/Graph/Nodes/StructureNode.cs
  21. 4 4
      src/PixiEditor.ChangeableDocument/Rendering/DocumentEvaluator.cs
  22. 17 10
      src/PixiEditor.ChangeableDocument/Rendering/RenderingContext.cs
  23. 0 5
      src/PixiEditor.DrawingApi.Core/Surface/ImageData/Image.cs
  24. 0 1
      src/PixiEditor.DrawingApi.Skia/Implementations/SkiaImageImplementation.cs
  25. 0 1
      src/PixiEditor.DrawingApi.Skia/Implementations/SkiaShaderImplementation.cs

+ 22 - 1
src/PixiEditor.ChangeableDocument/Changeables/Document.cs

@@ -4,6 +4,7 @@ using PixiEditor.ChangeableDocument.Changeables.Graph;
 using PixiEditor.ChangeableDocument.Changeables.Graph.Interfaces;
 using PixiEditor.ChangeableDocument.Changeables.Graph.Nodes;
 using PixiEditor.ChangeableDocument.Changeables.Interfaces;
+using PixiEditor.ChangeableDocument.Rendering;
 using PixiEditor.DrawingApi.Core.Numerics;
 using PixiEditor.DrawingApi.Core.Surface.ImageData;
 using PixiEditor.DrawingApi.Core.Surface.PaintImpl;
@@ -82,7 +83,27 @@ internal class Document : IChangeable, IReadOnlyDocument, IDisposable
         Surface surface = new Surface(tightBounds.Value.Size);
 
         using var paint = new Paint();
-        surface.DrawingSurface.Canvas.DrawImage(layer.Execute(frame), (RectD)tightBounds.Value, paint);
+
+        Image image;
+        
+        if (layer is IReadOnlyImageNode imageNode)
+        {
+            var chunkyImage = imageNode.GetLayerImageAtFrame(frame);
+            using Surface chunkSurface = new Surface(chunkyImage.CommittedSize);
+            chunkyImage.DrawCommittedRegionOn(
+                new RectI(0, 0, chunkyImage.CommittedSize.X, chunkyImage.CommittedSize.Y), 
+                ChunkResolution.Full,
+                chunkSurface.DrawingSurface,
+                VecI.Zero);
+            
+            image = chunkSurface.DrawingSurface.Snapshot();
+        }
+        else
+        {
+            image = layer.Execute(new RenderingContext(frame));
+        }
+        
+        surface.DrawingSurface.Canvas.DrawImage(image, (RectD)tightBounds.Value, paint);
 
         return surface.DrawingSurface.Snapshot();
     }

+ 2 - 1
src/PixiEditor.ChangeableDocument/Changeables/Graph/Interfaces/IReadOnlyNode.cs

@@ -1,4 +1,5 @@
 using PixiEditor.ChangeableDocument.Changeables.Animations;
+using PixiEditor.ChangeableDocument.Rendering;
 using PixiEditor.DrawingApi.Core.Surface.ImageData;
 using PixiEditor.Numerics;
 
@@ -14,7 +15,7 @@ public interface IReadOnlyNode
     
     public string InternalName { get; }
 
-    public Image? Execute(KeyFrameTime frame);
+    public Image? Execute(RenderingContext context);
     public bool Validate();
     
     /// <summary>

+ 3 - 2
src/PixiEditor.ChangeableDocument/Changeables/Graph/Interfaces/IReadOnlyNodeGraph.cs

@@ -1,4 +1,5 @@
-using PixiEditor.DrawingApi.Core.Surface.ImageData;
+using PixiEditor.ChangeableDocument.Rendering;
+using PixiEditor.DrawingApi.Core.Surface.ImageData;
 
 namespace PixiEditor.ChangeableDocument.Changeables.Graph.Interfaces;
 
@@ -9,5 +10,5 @@ public interface IReadOnlyNodeGraph
     public void AddNode(IReadOnlyNode node);
     public void RemoveNode(IReadOnlyNode node);
     public bool TryTraverse(Action<IReadOnlyNode> action);
-    public Image? Execute(int frame);
+    public Image? Execute(RenderingContext context);
 }

+ 3 - 2
src/PixiEditor.ChangeableDocument/Changeables/Graph/NodeGraph.cs

@@ -2,6 +2,7 @@
 using System.Diagnostics;
 using PixiEditor.ChangeableDocument.Changeables.Graph.Interfaces;
 using PixiEditor.ChangeableDocument.Changeables.Graph.Nodes;
+using PixiEditor.ChangeableDocument.Rendering;
 using PixiEditor.DrawingApi.Core.Surface.ImageData;
 
 namespace PixiEditor.ChangeableDocument.Changeables.Graph;
@@ -95,7 +96,7 @@ public class NodeGraph : IReadOnlyNodeGraph, IDisposable
         return true;
     }
 
-    public Image? Execute(int frame)
+    public Image? Execute(RenderingContext context)
     {
         Stopwatch stopwatch = new();
         if (OutputNode == null) return null;
@@ -107,7 +108,7 @@ public class NodeGraph : IReadOnlyNodeGraph, IDisposable
             var node = queue.Dequeue();
             
             stopwatch.Restart();
-            node.Execute(frame);
+            node.Execute(context);
             Console.WriteLine($"{node.GetType().Name} took {stopwatch.ElapsedMilliseconds}ms to execute");
         }
 

+ 2 - 1
src/PixiEditor.ChangeableDocument/Changeables/Graph/Nodes/CircleNode.cs

@@ -1,4 +1,5 @@
 using PixiEditor.ChangeableDocument.Changeables.Animations;
+using PixiEditor.ChangeableDocument.Rendering;
 using PixiEditor.DrawingApi.Core.ColorsImpl;
 using PixiEditor.DrawingApi.Core.Surface;
 using PixiEditor.DrawingApi.Core.Surface.ImageData;
@@ -28,7 +29,7 @@ public class CircleNode : Node
         Output = CreateOutput<Image?>("Output", "OUTPUT", null);
     }
     
-    protected override Image? OnExecute(KeyFrameTime frameTime)
+    protected override Image? OnExecute(RenderingContext context)
     {
         Surface workingSurface = new Surface(new VecI(Radius.Value * 2, Radius.Value * 2));
         

+ 2 - 1
src/PixiEditor.ChangeableDocument/Changeables/Graph/Nodes/CombineColorNode.cs

@@ -1,5 +1,6 @@
 using PixiEditor.ChangeableDocument.Changeables.Animations;
 using PixiEditor.ChangeableDocument.Changeables.Graph.Interfaces;
+using PixiEditor.ChangeableDocument.Rendering;
 using PixiEditor.DrawingApi.Core.ColorsImpl;
 using PixiEditor.DrawingApi.Core.Surface.ImageData;
 
@@ -37,7 +38,7 @@ public class CombineColorNode : Node
         return new Color((byte)r, (byte)g, (byte)b, (byte)a);
     }
     
-    protected override Image? OnExecute(KeyFrameTime frameTime)
+    protected override Image? OnExecute(RenderingContext context)
     {
         return null;
     }

+ 2 - 1
src/PixiEditor.ChangeableDocument/Changeables/Graph/Nodes/EmptyImageNode.cs

@@ -1,4 +1,5 @@
 using PixiEditor.ChangeableDocument.Changeables.Animations;
+using PixiEditor.ChangeableDocument.Rendering;
 using PixiEditor.DrawingApi.Core.ColorsImpl;
 using PixiEditor.DrawingApi.Core.Surface.ImageData;
 using PixiEditor.DrawingApi.Core.Surface.PaintImpl;
@@ -23,7 +24,7 @@ public class CreateImageNode : Node
         Fill = CreateInput(nameof(Fill), "FILL", new Color(0, 0, 0, 255));
     }
     
-    protected override Image? OnExecute(KeyFrameTime frameTime)
+    protected override Image? OnExecute(RenderingContext context)
     {
         using var surface = new Surface(Size.Value);
 

+ 2 - 1
src/PixiEditor.ChangeableDocument/Changeables/Graph/Nodes/FolderNode.cs

@@ -1,5 +1,6 @@
 using PixiEditor.ChangeableDocument.Changeables.Animations;
 using PixiEditor.ChangeableDocument.Changeables.Graph.Interfaces;
+using PixiEditor.ChangeableDocument.Rendering;
 using PixiEditor.DrawingApi.Core.Surface.ImageData;
 using PixiEditor.Numerics;
 
@@ -21,7 +22,7 @@ public class FolderNode : StructureNode, IReadOnlyFolderNode
 
     public override Node CreateCopy() => new FolderNode { MemberName = MemberName };
 
-    protected override Image? OnExecute(KeyFrameTime frame)
+    protected override Image? OnExecute(RenderingContext context)
     {
         if (!IsVisible.Value || Content.Value == null)
         {

+ 8 - 8
src/PixiEditor.ChangeableDocument/Changeables/Graph/Nodes/ImageLayerNode.cs

@@ -36,7 +36,7 @@ public class ImageLayerNode : LayerNode, IReadOnlyImageNode
         return true;
     }
 
-    protected override Image? OnExecute(KeyFrameTime frame)
+    protected override Image? OnExecute(RenderingContext context)
     {
         if (!IsVisible.Value || Opacity.Value <= 0 || IsEmptyMask())
         {
@@ -44,7 +44,7 @@ public class ImageLayerNode : LayerNode, IReadOnlyImageNode
             return Output.Value;
         }
 
-        var frameImage = GetFrameImage(frame).Image;
+        var frameImage = GetFrameImage(context.FrameTime).Image;
 
         Surface workingSurface;
         
@@ -113,16 +113,16 @@ public class ImageLayerNode : LayerNode, IReadOnlyImageNode
         }
     }
 
-    protected override bool CacheChanged(KeyFrameTime frameTime)
+    protected override bool CacheChanged(RenderingContext context)
     {
-        var frame = GetFrameImage(frameTime);
-        return base.CacheChanged(frameTime) || frame?.RequiresUpdate == true;
+        var frame = GetFrameImage(context.FrameTime);
+        return base.CacheChanged(context) || frame?.RequiresUpdate == true;
     }
 
-    protected override void UpdateCache(KeyFrameTime time)
+    protected override void UpdateCache(RenderingContext context)
     {
-        base.UpdateCache(time);
-        var imageFrame = GetFrameImage(time);
+        base.UpdateCache(context);
+        var imageFrame = GetFrameImage(context.FrameTime);
         if (imageFrame is not null && imageFrame.RequiresUpdate)
         {
             imageFrame.RequiresUpdate = false; 

+ 2 - 1
src/PixiEditor.ChangeableDocument/Changeables/Graph/Nodes/ImageSizeNode.cs

@@ -1,4 +1,5 @@
 using PixiEditor.ChangeableDocument.Changeables.Animations;
+using PixiEditor.ChangeableDocument.Rendering;
 using PixiEditor.DrawingApi.Core.Surface.ImageData;
 using PixiEditor.Numerics;
 
@@ -16,7 +17,7 @@ public class ImageSizeNode : Node
         Size = CreateOutput(nameof(Size), "SIZE", new VecI());
     }
     
-    protected override Image? OnExecute(KeyFrameTime frameTime)
+    protected override Image? OnExecute(RenderingContext context)
     {
         Size.Value = Image.Value?.Size ?? new VecI();
 

+ 2 - 1
src/PixiEditor.ChangeableDocument/Changeables/Graph/Nodes/ImageSpaceNode.cs

@@ -1,5 +1,6 @@
 using PixiEditor.ChangeableDocument.Changeables.Animations;
 using PixiEditor.ChangeableDocument.Changeables.Graph.Interfaces;
+using PixiEditor.ChangeableDocument.Rendering;
 using PixiEditor.DrawingApi.Core.Surface.ImageData;
 using PixiEditor.Numerics;
 
@@ -17,7 +18,7 @@ public class ImageSpaceNode : Node
         Size = CreateFieldOutput(nameof(Size), "SIZE", ctx => ctx.Size);
     }
     
-    protected override Image? OnExecute(KeyFrameTime frameTime)
+    protected override Image? OnExecute(RenderingContext context)
     {
         return null;
     }

+ 2 - 1
src/PixiEditor.ChangeableDocument/Changeables/Graph/Nodes/MathNode.cs

@@ -1,6 +1,7 @@
 using PixiEditor.ChangeableDocument.Changeables.Animations;
 using PixiEditor.ChangeableDocument.Changeables.Graph.Interfaces;
 using PixiEditor.ChangeableDocument.Enums;
+using PixiEditor.ChangeableDocument.Rendering;
 using PixiEditor.DrawingApi.Core.Surface.ImageData;
 
 namespace PixiEditor.ChangeableDocument.Changeables.Graph.Nodes;
@@ -48,7 +49,7 @@ public class MathNode : Node
 
     private (double x, double y) GetValues(FieldContext context) => (X.Value(context), Y.Value(context));
     
-    protected override Image? OnExecute(KeyFrameTime frameTime)
+    protected override Image? OnExecute(RenderingContext context)
     {
         return null;
     }

+ 2 - 1
src/PixiEditor.ChangeableDocument/Changeables/Graph/Nodes/MergeNode.cs

@@ -1,5 +1,6 @@
 using PixiEditor.ChangeableDocument.Changeables.Animations;
 using PixiEditor.ChangeableDocument.Changeables.Graph.Interfaces;
+using PixiEditor.ChangeableDocument.Rendering;
 using PixiEditor.DrawingApi.Core.Surface.ImageData;
 using PixiEditor.Numerics;
 
@@ -28,7 +29,7 @@ public class MergeNode : Node, IBackgroundInput
         return new MergeNode();
     }
 
-    protected override Image? OnExecute(KeyFrameTime frame)
+    protected override Image? OnExecute(RenderingContext context)
     {
         if(Top.Value == null && Bottom.Value == null)
         {

+ 2 - 1
src/PixiEditor.ChangeableDocument/Changeables/Graph/Nodes/ModifyImageLeftNode.cs

@@ -1,5 +1,6 @@
 using PixiEditor.ChangeableDocument.Changeables.Animations;
 using PixiEditor.ChangeableDocument.Changeables.Graph.Interfaces;
+using PixiEditor.ChangeableDocument.Rendering;
 using PixiEditor.DrawingApi.Core.ColorsImpl;
 using PixiEditor.DrawingApi.Core.Surface;
 using PixiEditor.DrawingApi.Core.Surface.ImageData;
@@ -40,7 +41,7 @@ public class ModifyImageLeftNode : Node
         pixmap = Image.Value?.PeekPixels();
     }
 
-    protected override Image? OnExecute(KeyFrameTime frameTime)
+    protected override Image? OnExecute(RenderingContext context)
     {
         return Image.Value;
     }

+ 2 - 1
src/PixiEditor.ChangeableDocument/Changeables/Graph/Nodes/ModifyImageRightNode.cs

@@ -1,5 +1,6 @@
 using PixiEditor.ChangeableDocument.Changeables.Animations;
 using PixiEditor.ChangeableDocument.Changeables.Graph.Interfaces;
+using PixiEditor.ChangeableDocument.Rendering;
 using PixiEditor.DrawingApi.Core.ColorsImpl;
 using PixiEditor.DrawingApi.Core.Surface;
 using PixiEditor.DrawingApi.Core.Surface.ImageData;
@@ -25,7 +26,7 @@ public class ModifyImageRightNode : Node
         Output = CreateOutput<Image>(nameof(Output), "OUTPUT", null);
     }
 
-    protected override Image? OnExecute(KeyFrameTime frameTime)
+    protected override Image? OnExecute(RenderingContext renderingContext)
     {
         if (startNode.Image.Value is not { Size: var size })
         {

+ 17 - 9
src/PixiEditor.ChangeableDocument/Changeables/Graph/Nodes/Node.cs

@@ -1,6 +1,7 @@
 using System.Diagnostics;
 using PixiEditor.ChangeableDocument.Changeables.Animations;
 using PixiEditor.ChangeableDocument.Changeables.Graph.Interfaces;
+using PixiEditor.ChangeableDocument.Rendering;
 using PixiEditor.DrawingApi.Core.Surface.ImageData;
 using PixiEditor.Numerics;
 
@@ -33,32 +34,39 @@ public abstract class Node : IReadOnlyNode, IDisposable
     public VecD Position { get; set; }
 
     private KeyFrameTime _lastFrameTime = new KeyFrameTime(-1);
+    private ChunkResolution? _lastResolution;
+    private VecI? _lastChunkPos;
 
-    public Image? Execute(KeyFrameTime frameTime)
+    public Image? Execute(RenderingContext context)
     {
-        if(!CacheChanged(frameTime)) return CachedResult;
+        if(!CacheChanged(context)) return CachedResult;
         
-        CachedResult = OnExecute(frameTime);
-        UpdateCache(frameTime);
+        CachedResult = OnExecute(context);
+        UpdateCache(context);
         return CachedResult;
     }
 
-    protected abstract Image? OnExecute(KeyFrameTime frameTime);
+    protected abstract Image? OnExecute(RenderingContext context);
     public abstract bool Validate();
     
-    protected virtual bool CacheChanged(KeyFrameTime frameTime)
+    protected virtual bool CacheChanged(RenderingContext context)
     {
-        return !frameTime.Equals(_lastFrameTime) || inputs.Any(x => x.CacheChanged);
+        return !context.FrameTime.Equals(_lastFrameTime)
+               || context.Resolution != _lastResolution
+               || context.ChunkToUpdate != _lastChunkPos
+               || inputs.Any(x => x.CacheChanged);
     }
     
-    protected virtual void UpdateCache(KeyFrameTime time)
+    protected virtual void UpdateCache(RenderingContext context)
     {
         foreach (var input in inputs)
         {
             input.UpdateCache();
         }
         
-        _lastFrameTime = time;
+        _lastFrameTime = context.FrameTime;
+        _lastResolution = context.Resolution;
+        _lastChunkPos = context.ChunkToUpdate;
     }
 
     public void RemoveKeyFrame(Guid keyFrameGuid)

+ 2 - 1
src/PixiEditor.ChangeableDocument/Changeables/Graph/Nodes/OutputNode.cs

@@ -1,5 +1,6 @@
 using PixiEditor.ChangeableDocument.Changeables.Animations;
 using PixiEditor.ChangeableDocument.Changeables.Graph.Interfaces;
+using PixiEditor.ChangeableDocument.Rendering;
 using PixiEditor.DrawingApi.Core.Surface.ImageData;
 
 namespace PixiEditor.ChangeableDocument.Changeables.Graph.Nodes;
@@ -22,7 +23,7 @@ public class OutputNode : Node, IBackgroundInput
         return new OutputNode();
     }
 
-    protected override Image? OnExecute(KeyFrameTime frame)
+    protected override Image? OnExecute(RenderingContext context)
     {
         return Input.Value;
     }

+ 2 - 1
src/PixiEditor.ChangeableDocument/Changeables/Graph/Nodes/SeparateColorNode.cs

@@ -1,5 +1,6 @@
 using PixiEditor.ChangeableDocument.Changeables.Animations;
 using PixiEditor.ChangeableDocument.Changeables.Graph.Interfaces;
+using PixiEditor.ChangeableDocument.Rendering;
 using PixiEditor.DrawingApi.Core.ColorsImpl;
 using PixiEditor.DrawingApi.Core.Surface.ImageData;
 
@@ -26,7 +27,7 @@ public class SeparateColorNode : Node
         A = CreateFieldOutput(nameof(A), "A", ctx => Color.Value(ctx).A / 255d);
     }
 
-    protected override Image? OnExecute(KeyFrameTime frameTime)
+    protected override Image? OnExecute(RenderingContext context)
     {
         return null;
     }

+ 2 - 1
src/PixiEditor.ChangeableDocument/Changeables/Graph/Nodes/SeparateVecDNode.cs

@@ -1,5 +1,6 @@
 using PixiEditor.ChangeableDocument.Changeables.Animations;
 using PixiEditor.ChangeableDocument.Changeables.Graph.Interfaces;
+using PixiEditor.ChangeableDocument.Rendering;
 using PixiEditor.DrawingApi.Core.Surface.ImageData;
 using PixiEditor.Numerics;
 
@@ -20,7 +21,7 @@ public class SeparateVecDNode : Node
         Vector = CreateFieldInput("Vector", "VECTOR", new VecD(0, 0));
     }
 
-    protected override Image? OnExecute(KeyFrameTime frameTime)
+    protected override Image? OnExecute(RenderingContext context)
     {
         return null;
     }

+ 2 - 1
src/PixiEditor.ChangeableDocument/Changeables/Graph/Nodes/StructureNode.cs

@@ -1,6 +1,7 @@
 using PixiEditor.ChangeableDocument.Changeables.Animations;
 using PixiEditor.ChangeableDocument.Changeables.Graph.Interfaces;
 using PixiEditor.ChangeableDocument.Enums;
+using PixiEditor.ChangeableDocument.Rendering;
 using PixiEditor.DrawingApi.Core.Surface.ImageData;
 using PixiEditor.Numerics;
 
@@ -33,7 +34,7 @@ public abstract class StructureNode : Node, IReadOnlyStructureNode, IBackgroundI
         Output = CreateOutput<Image?>("Output", "OUTPUT", null);
     }
 
-    protected abstract override Image? OnExecute(KeyFrameTime frameTime);
+    protected abstract override Image? OnExecute(RenderingContext context);
     public abstract override bool Validate();
 
     public abstract RectI? GetTightBounds(KeyFrameTime frameTime);

+ 4 - 4
src/PixiEditor.ChangeableDocument/Rendering/DocumentEvaluator.cs

@@ -9,12 +9,12 @@ public static class DocumentEvaluator
     public static OneOf<Chunk, EmptyChunk> RenderChunk(VecI chunkPos, ChunkResolution resolution,
         IReadOnlyNodeGraph graph, int frame, RectI? globalClippingRect = null)
     {
-        using RenderingContext context = new();
+        using RenderingContext context = new(frame, chunkPos, resolution);
         try
         {
             RectI? transformedClippingRect = TransformClipRect(globalClippingRect, resolution, chunkPos);
 
-            Image? evaluated = graph.Execute(frame);
+            Image? evaluated = graph.Execute(context);
             if (evaluated is null)
             {
                 return new EmptyChunk();
@@ -54,12 +54,12 @@ public static class DocumentEvaluator
     public static OneOf<Chunk, EmptyChunk> RenderChunk(VecI chunkPos, ChunkResolution resolution,
         IReadOnlyNode node, int frame, RectI? globalClippingRect = null)
     {
-        using RenderingContext context = new();
+        using RenderingContext context = new(frame, chunkPos, resolution);
         try
         {
             RectI? transformedClippingRect = TransformClipRect(globalClippingRect, resolution, chunkPos);
 
-            Image? evaluated = node.Execute(frame);
+            Image? evaluated = node.Execute(context);
             if (evaluated is null)
             {
                 return new EmptyChunk();

+ 17 - 10
src/PixiEditor.ChangeableDocument/Rendering/RenderingContext.cs

@@ -1,27 +1,34 @@
-using PixiEditor.ChangeableDocument.Changeables.Graph.Interfaces;
+using PixiEditor.ChangeableDocument.Changeables.Animations;
+using PixiEditor.ChangeableDocument.Changeables.Graph.Interfaces;
 using PixiEditor.ChangeableDocument.Changeables.Interfaces;
 using PixiEditor.DrawingApi.Core.ColorsImpl;
 using PixiEditor.DrawingApi.Core.Surface;
 using PixiEditor.DrawingApi.Core.Surface.PaintImpl;
+using PixiEditor.Numerics;
 using BlendMode = PixiEditor.ChangeableDocument.Enums.BlendMode;
 using DrawingApiBlendMode = PixiEditor.DrawingApi.Core.Surface.BlendMode;
 
 namespace PixiEditor.ChangeableDocument.Rendering;
-internal class RenderingContext : IDisposable
+public class RenderingContext : IDisposable
 {
     public Paint BlendModePaint = new () { BlendMode = DrawingApiBlendMode.SrcOver };
     public Paint BlendModeOpacityPaint = new () { BlendMode = DrawingApiBlendMode.SrcOver };
     public Paint ReplacingPaintWithOpacity = new () { BlendMode = DrawingApiBlendMode.Src };
 
-    public void UpdateFromMember(IReadOnlyStructureNode member)
-    {
-        Color opacityColor = new(255, 255, 255, (byte)Math.Round(member.Opacity.Value * 255));
-        DrawingApiBlendMode blendMode = GetDrawingBlendMode(member.BlendMode.Value);
+    public KeyFrameTime FrameTime { get; }
+    public VecI? ChunkToUpdate { get; }
+    public ChunkResolution? Resolution { get; }
 
-        BlendModeOpacityPaint.Color = opacityColor;
-        BlendModeOpacityPaint.BlendMode = blendMode;
-        BlendModePaint.BlendMode = blendMode;
-        ReplacingPaintWithOpacity.Color = opacityColor;
+    public RenderingContext(KeyFrameTime frameTime)
+    {
+        FrameTime = frameTime;
+    }
+    
+    public RenderingContext(KeyFrameTime frameTime, VecI chunkToUpdate, ChunkResolution resolution)
+    {
+        FrameTime = frameTime;
+        ChunkToUpdate = chunkToUpdate;
+        Resolution = resolution;
     }
 
     public static DrawingApiBlendMode GetDrawingBlendMode(BlendMode blendMode)

+ 0 - 5
src/PixiEditor.DrawingApi.Core/Surface/ImageData/Image.cs

@@ -45,11 +45,6 @@ namespace PixiEditor.DrawingApi.Core.Surface.ImageData
         {
             return DrawingBackendApi.Current.ImageImplementation.FromPixelCopy(info, pixels);
         }
-        
-        public Pixmap PeekPixels()
-        {
-            return DrawingBackendApi.Current.ImageImplementation.PeekPixels(this);
-        }
 
         public ImgData Encode()
         {

+ 0 - 1
src/PixiEditor.DrawingApi.Skia/Implementations/SkiaImageImplementation.cs

@@ -14,7 +14,6 @@ namespace PixiEditor.DrawingApi.Skia.Implementations
         private readonly SkObjectImplementation<SKData> _imgImplementation;
         private readonly SkiaPixmapImplementation _pixmapImplementation;
         private SkObjectImplementation<SKSurface>? _surfaceImplementation;
-        private SkiaPixmapImplementation _pixmapImplementation;
         private SkiaColorSpaceImplementation colorSpaceImpl;
         
         public SkiaImageImplementation(SkObjectImplementation<SKData> imgDataImplementation, SkiaPixmapImplementation pixmapImplementation)

+ 0 - 1
src/PixiEditor.DrawingApi.Skia/Implementations/SkiaShaderImplementation.cs

@@ -24,7 +24,6 @@ namespace PixiEditor.DrawingApi.Skia.Implementations
         public Shader? CreateFromSksl(string sksl, bool isOpaque, out string errors)
         {
             SKRuntimeEffect effect = SKRuntimeEffect.Create(sksl, out errors);
-            
             if (string.IsNullOrEmpty(errors))
             {
                 SKShader shader = effect.ToShader(isOpaque);