//@Static /// <summary> /// Render layers. /// </summary> /// <param name="resourceCreator"> The resource-creator. </param> /// <param name="layerages"> The layerage. </param> /// <returns> The render image. </returns> public static ICanvasImage Render(ICanvasResourceCreator resourceCreator, IList <Layerage> layerages) { ICanvasImage previousImage = null; for (int i = layerages.Count - 1; i >= 0; i--) { Layerage currentLayerage = layerages[i]; ILayer currentLayer = currentLayerage.Self; if (currentLayer.Visibility == Visibility.Collapsed) { continue; } if (currentLayer.Opacity == 0) { continue; } //Layer ICanvasImage currentImage = currentLayer.GetActualRender(resourceCreator, currentLayerage.Children); if (currentImage == null) { continue; } if (previousImage == null) { previousImage = currentImage; continue; } //Blend if (currentLayer.BlendMode is BlendEffectMode blendMode) { previousImage = new BlendEffect { Background = currentImage, Foreground = previousImage, Mode = blendMode }; continue; } //Composite previousImage = new CompositeEffect { Sources = { previousImage, currentImage, } }; continue; } return(previousImage); }