【问题标题】:Xamarin.Forms FFImageLoading SVGs to ESRI RunTimeImageXamarin.Forms FFImageLoading SVG 到 ESRI RunTimeImage
【发布时间】:2018-06-15 15:14:03
【问题描述】:

将 SVG 转换为 RunTimeImage

基本上,我正在尝试找到一种在流被包裹在SVGImageSource 之前访问流的方法,这样我就可以将字节数组输入到 Esri 提供的 ArcGis RunTimeImage 中。

SVG 保存在 PCL 中。

【问题讨论】:

  • FFImageLoading 是开源的。如果你想改变它的行为,你可以分叉它,做一个 PR,或者只是创建你自己的本地副本
  • 感谢您的建议。我可能暂时只使用图像的 png 版本。如果可能的话,我宁愿不必维护软件包的版本。

标签: .net svg xamarin.forms ffimageloading esri-arc-engine


【解决方案1】:

我暂时无法弄清楚这一点,但以下代码摘录是围绕使用图像的 png 版本访问您的 android 项目的可绘制文件夹的工作。

            int resourceId = Android.App.Application.Context.Resources.GetIdentifier("atlaspinorange", "drawable", "Atlas.Locations");
        var icon = Android.Graphics.BitmapFactory.DecodeResource(Android.App.Application.Context.Resources, resourceId);
        var stream = new System.IO.MemoryStream();
        icon.Compress(Android.Graphics.Bitmap.CompressFormat.Png, 50, stream);
        byte[] byteArray = stream.ToArray();
        var image = new Esri.ArcGISRuntime.UI.RuntimeImage(byteArray);
        mapView.LocationDisplay.CourseSymbol = new Esri.ArcGISRuntime.Symbology.PictureMarkerSymbol(image);
        mapView.LocationDisplay.DefaultSymbol = new Esri.ArcGISRuntime.Symbology.PictureMarkerSymbol(image);

【讨论】:

    【解决方案2】:

    你在找这个吗

    ImageService.Instance.LoadCompiledResource("yourFile.svg").WithCustomDataResolver(new SvgDataResolver(200,200)).AsPNGStreamAsync();
    

    ?

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-02-01
      • 1970-01-01
      • 2018-07-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-11-14
      • 2017-11-28
      相关资源
      最近更新 更多