Ejemplo n.º 1
0
        public LayoutMetrics ToClr()
        {
            return(new LayoutMetrics
            {
                ActualHeight = ActualHeight,
                ActualWidth = ActualWidth,

                LayoutSlot = LayoutSlot.ToClr(),
                VisualOffset = VisualOffset.ToClr(),
                LayoutClip = LayoutClip.ToClr(),

                HiddenDesire = HiddenDesire.ToClr(),
                DesiredSize = DesiredSize.ToClr(),
                RenderSize = RenderSize.ToClr(),

                AbsoluteXform = AbsoluteXform,
                LayoutXform = LayoutXform,
                LocalXform = LocalXform,
                RenderXform = RenderXform,

                TotalOpacity = TotalOpacity,
                TotalIsRenderVisible = TotalIsRenderVisible,
                TotalIsHitTestVisible = TotalIsHitTestVisible,
                TotalRenderProjection = TotalRenderProjection,
            });
        }
Ejemplo n.º 2
0
        private void UpdatePaint()
        {
            if (_paint != null)
            {
                return;
            }

            var foreground = Brush
                             .GetColorWithOpacity(Foreground, Colors.Transparent)
                             .Value;

            var shader = Foreground is GradientBrush gb
                                ? gb.GetShader(LayoutSlot.LogicalToPhysicalPixels())
                                : null;

            _paint = TextPaintPool.GetPaint(
                FontWeight,
                FontStyle,
                FontFamily,
                FontSize,
                CharacterSpacing,
                foreground,
                shader,
                BaseLineAlignment.Baseline,
                TextDecorations
                );
        }