Example #1
0
            internal override Visual?GetVisualRoot(CompositionContext context)
            {
                bool layerHasMasks = false;

#if !NoClipping
                layerHasMasks = _context.Layer.Masks.Any();
#endif

                if (!Transforms.TryCreateShapeVisualTransformChain(_context, out var rootNode, out var contentsNode))
                {
                    // The layer is never visible.
                    return(null);
                }

                var shapeContext = new ShapeContext(_context);

                contentsNode.Shapes.Add(TranslateShapeLayerContents(shapeContext, _context.Layer.Contents));

                return(layerHasMasks
                    ? Masks.TranslateAndApplyMasksForLayer(_context, rootNode)
                    : rootNode);
            }
Example #2
0
            internal override Visual?GetVisualRoot(CompositionContext context)
            {
                bool layerHasMasks = false;

#if !NoClipping
                layerHasMasks = _context.Layer.Masks.Any();
#endif

                if (!Transforms.TryCreateShapeVisualTransformChain(_context, out var rootNode, out var contentsNode))
                {
                    // The layer is never visible.
                    return(null);
                }

                var shapeContext = new ShapeContext(_context);

                contentsNode.Shapes.Add(TranslateShapeLayerContents(shapeContext, _context.Layer.Contents));

                Visual result = layerHasMasks ? Masks.TranslateAndApplyMasksForLayer(_context, rootNode) : rootNode;

                var dropShadowEffect = _context.Effects.DropShadowEffect;

                if (dropShadowEffect is not null)
                {
                    result = Effects.ApplyDropShadow(_context, result, dropShadowEffect);
                }

                var gaussianBlurEffect = _context.Effects.GaussianBlurEffect;

                if (gaussianBlurEffect is not null)
                {
                    result = Effects.ApplyGaussianBlur(_context, result, gaussianBlurEffect);
                }

                return(result);
            }