Esempio n. 1
0
        public static Canvas Paint(Layout.LayoutBox layoutRoot, Layout.Rect bounds)
        {
            var displayList = BuildDisplayList(layoutRoot);
            var canvas      = new Canvas((int)bounds.Width, (int)bounds.Height);

            foreach (var item in displayList)
            {
                canvas.PaintItem(item);
            }
            return(canvas);
        }
Esempio n. 2
0
        private static void RenderBorders(List <DisplayCommand> list, Layout.LayoutBox layoutBox)
        {
            var color = GetColor(layoutBox, "border-color");

            if (color == null)
            {
                return;
            }

            var borderBox = layoutBox.Dimensions.BorderBox();
            var rect      = new Layout.Rect()
            {
                X        = borderBox.X
                , Y      = borderBox.Y
                , Width  = layoutBox.Dimensions.Border.Left
                , Height = borderBox.Height
            };

            list.Add(new SolidColor(color, rect));

            rect = new Layout.Rect()
            {
                X        = borderBox.X + borderBox.Width - layoutBox.Dimensions.Border.Right
                , Y      = borderBox.Y
                , Width  = layoutBox.Dimensions.Border.Right
                , Height = borderBox.Height
            };
            list.Add(new SolidColor(color, rect));

            rect = new Layout.Rect()
            {
                X        = borderBox.X
                , Y      = borderBox.Y
                , Width  = borderBox.Width
                , Height = layoutBox.Dimensions.Border.Top
            };
            list.Add(new SolidColor(color, rect));

            rect = new Layout.Rect()
            {
                X        = borderBox.X
                , Y      = borderBox.Y + borderBox.Height - layoutBox.Dimensions.Border.Bottom
                , Width  = borderBox.Width
                , Height = layoutBox.Dimensions.Border.Bottom
            };
            list.Add(new SolidColor(color, rect));
        }
Esempio n. 3
0
 public SolidColor(Css.Color color, Layout.Rect rect)
 {
     Color = color;
     Rect  = rect;
 }