Exemplo n.º 1
0
        VgVisualElement CreateImage(VgVisualElement parentNode, SvgImageSpec imgspec)
        {
            VgVisualElement vgImg = new VgVisualElement(WellknownSvgElementName.Image, imgspec, _vgVisualDoc);

            using (VectorToolBox.Borrow(out SimpleRect rectTool))
                using (VxsTemp.Borrow(out var v1))
                {
                    ReEvaluateArgs a = new ReEvaluateArgs(_containerWidth, _containerHeight, _emHeight); //temp fix
                    vgImg._imgX = ConvertToPx(imgspec.X, ref a);
                    vgImg._imgY = ConvertToPx(imgspec.Y, ref a);
                    vgImg._imgW = ConvertToPx(imgspec.Width, ref a);
                    vgImg._imgH = ConvertToPx(imgspec.Height, ref a);
                    //
                    rectTool.SetRect(
                        vgImg._imgX,
                        vgImg._imgY + vgImg._imgH,
                        vgImg._imgX + vgImg._imgW,
                        vgImg._imgY);
                    vgImg.VxsPath = rectTool.MakeVxs(v1).CreateTrim();
                    //
                    AssignAttributes(imgspec);
                    //
                    return(vgImg);
                }
        }
Exemplo n.º 2
0
        VgVisualElement CreateTestRenderVx_FromImg2(string filename)
        {
            var spec = new SvgImageSpec()
            {
                ImageSrc = filename,
                Width    = new Css.CssLength(50, Css.CssUnitOrNames.Pixels),
                Height   = new Css.CssLength(50, Css.CssUnitOrNames.Pixels),
            };

            VgVisualDoc renderRoot = new VgVisualDoc(_vgVisualDocHost);

            VgVisualElement vgimg = new VgVisualElement(WellknownSvgElementName.Image, spec, renderRoot);

            vgimg.ImageBinder = _appHost.LoadImageAndBind(filename);
            return(vgimg);
        }