示例#1
0
        public override void OnComputeBox(Renderman renderer, Css.LayoutBox box, ref bool widthUndefined, ref bool heightUndefined)
        {
            if (document is SVGDocument)
            {
                return;
            }

            // Occurs on inline SVG's.

            // Set the size:
            Context.SetSize((int)box.InnerWidth, (int)box.InnerHeight);

            UnityEngine.Texture tex = Context.Texture;

            if (tex == null)
            {
                return;
            }

            // Update the background raw image:
            BackgroundImage img = RenderData.BGImage;

            if (img == null)
            {
                img = new Css.BackgroundImage(RenderData);
                RenderData.BGImage = img;
            }

            // Update the bg image:
            img.UpdateImage(tex);
        }
示例#2
0
        /// <summary>Call this if the current property requires a background image object.</summary>
        public BackgroundImage GetBackground(ComputedStyle style)
        {
            RenderableData  rd    = style.RenderData;
            BackgroundImage image = rd.BGImage;

            if (image == null)
            {
                rd.BGImage = image = new BackgroundImage(rd);
            }

            return(image);
        }