public override void Apply(ComputedStyle style, Value value)
        {
            // Get the background image (always created if needed):
            PowerUI.Css.BackgroundImage image = GetBackground(style);

            if (value == null)
            {
                image.Clipping = BackgroundClipping.BorderBox;
            }
            else
            {
                switch (value.Text)
                {
                case "text":
                    image.Clipping = BackgroundClipping.Text;
                    break;

                case "padding-box":
                    image.Clipping = BackgroundClipping.PaddingBox;
                    break;

                case "content-box":
                    image.Clipping = BackgroundClipping.ContentBox;
                    break;

                default:
                    image.Clipping = BackgroundClipping.BorderBox;
                    break;
                }
            }

            // Request a layout:
            image.RequestLayout();
        }
        public override void Apply(ComputedStyle style, Value value)
        {
            // Get the background image:
            PowerUI.Css.BackgroundImage image = GetBackground(style);

            if (value == null)
            {
                image.SizeX = null;
                image.SizeY = null;
            }
            else if (value.Type == Css.ValueType.Text)
            {
                if (value.Text == "auto" || value.Text == "initial")
                {
                    // Same as the default:
                    image.SizeX = null;
                    image.SizeY = null;
                }
                else if (value.Text == "cover")
                {
                    // Same as 100% on both axis:
                    image.SizeX = new Css.Value("100%", Css.ValueType.Percentage);
                    image.SizeY = new Css.Value("100%", Css.ValueType.Percentage);
                }
            }
            else
            {
                // It's a vector:
                image.SizeX = value[0];
                image.SizeY = value[1];
            }

            // Request a layout:
            image.RequestLayout();
        }
Ejemplo n.º 3
0
        public override void Apply(ComputedStyle style, Value value)
        {
            // Get the background image:
            PowerUI.Css.BackgroundImage background = GetBackground(style);

            if (value == null)
            {
                background.Filtering = FilterMode.Point;
            }
            else
            {
                switch (value.Text)
                {
                case "bilinear":
                    background.Filtering = FilterMode.Bilinear;
                    break;

                case "trilinear":
                    background.Filtering = FilterMode.Trilinear;
                    break;

                default:
                    background.Filtering = FilterMode.Point;
                    break;
                }
            }

            if (background.Image != null && background.Image.Image != null)
            {
                background.Image.Image.filterMode = background.Filtering;
            }

            // Request a layout:
            background.RequestLayout();
        }
        public override void Apply(ComputedStyle style, Value value)
        {
            // Get the background image:
            PowerUI.Css.BackgroundImage image = GetBackground(style);

            if (value == null || value.Text == "" || value.Text == "none")
            {
                if (image.Image != null)
                {
                    image.Image.GoingOffDisplay();
                    image.Image = null;
                }

                // Reverse any isolation:
                image.Include();
            }
            else
            {
                image.Image = new ImagePackage(value.Text, image.Element.Document.basepath);
                image.Image.Get(image.ImageReady);
            }

            // Request a layout:
            image.RequestLayout();
        }