Example #1
0
        public override Box CreateBox()
        {
            var result = HorizontalBox.Get();
            var margin = TEXConfiguration.main.BackdropMargin * TexContext.Scale * 2;
            var box    = baseAtom.CreateBox();

            if (this.margin)
            {
                box = VerticalBox.Get(HorizontalBox.Get(box, box.width + margin,
                                                        TexAlignment.Center), box.totalHeight + margin, TexAlignment.Center);
            }

            var bg = HorizontalRule.Get(box.height, box.width, 0, box.depth, true);

            if (color != Color.clear)
            {
                result.Add(AttrColorBox.Get(0, color));
            }
            result.Add(bg);
            if (color != Color.clear)
            {
                result.Add(AttrColorBox.Get(3, color));
            }

            result.Add(StrutBox.Get(-box.width, 0, 0, 0));
            result.Add(box);

            return(result);
        }
Example #2
0
        public override Box CreateBox(TexStyle style)
        {
            if (generatedBox != null)
            {
                return(generatedBox);
            }

            generatedBox = AttrColorBox.Get(this,
                                            EndAtom == null ? null : (AttrColorBox)EndAtom.CreateBox(style));
            return(generatedBox);
        }
Example #3
0
        public override Box CreateBox()
        {
            // radius will be implemented later

            var margin = this.margin ? TEXConfiguration.main.BackdropMargin * TexContext.Scale : 0;

            var box = baseAtom.CreateBox();

            var hbox = HorizontalBox.Get(box, box.width + margin * 2, TexAlignment.Center);

            if (thickness.x > 0)
            {
                var rule = HorizontalRule.Get(hbox.height, thickness.x, 0, hbox.depth);
                hbox.Add(0, rule);
                rule.Set(rule.width, rule.height + margin + thickness.w, rule.depth + margin + thickness.y, 0);
            }

            if (thickness.z > 0)
            {
                var rule = HorizontalRule.Get(hbox.height, thickness.z, 0, hbox.depth);
                hbox.Add(rule);
                rule.Set(rule.width, rule.height + margin + thickness.w, rule.depth + margin + thickness.y, 0);
            }

            var vbox = VerticalBox.Get(hbox, hbox.totalHeight + margin * 2, TexAlignment.Center);

            if (thickness.y > 0)
            {
                vbox.Add(HorizontalRule.Get(thickness.y, vbox.width, 0));
            }

            if (thickness.w > 0)
            {
                vbox.Add(0, HorizontalRule.Get(thickness.w, vbox.width, 0));
            }

            if (color != Color.clear)
            {
                vbox.Add(0, AttrColorBox.Get(0, color));
                vbox.Add(AttrColorBox.Get(3, color));
            }

            // readjust
            vbox.height = box.height + margin + thickness.w;
            vbox.depth  = box.depth + margin + thickness.y;
            return(vbox);
        }
Example #4
0
        public override Box CreateBox(TexStyle style)
        {
            var result = HorizontalBox.Get();
            var margin = TEXConfiguration.main.BackdropMargin * TexUtility.SizeFactor(style);
            var box    = baseAtom.CreateBox(style);

            box = VerticalBox.Get(HorizontalBox.Get(box, box.width + (horizontalMargin ? margin * 2 : 0), TexAlignment.Center), box.totalHeight + margin * 2, TexAlignment.Center);
            var endColor   = AttrColorBox.Get(0, color, null);
            var startColor = AttrColorBox.Get(0, color, endColor);
            var bg         = HorizontalRule.Get(box.height, box.width, 0, box.depth, true);

            result.Add(startColor);
            result.Add(bg);
            result.Add(endColor);

            result.Add(StrutBox.Get(-box.width, 0, 0, 0));
            result.Add(box);

            return(result);
        }
Example #5
0
 public override Box CreateBox()
 {
     return(AttrColorBox.Get(EndAtom == null ? 3 : mix, color));
 }