【发布时间】:2019-02-11 13:38:56
【问题描述】:
我目前正在开发一个修改当前位于 PCL 项目中的图片的应用程序。我目前在转换 DataTypes 时遇到问题。
我目前正在尝试弄清楚如何将 ImageSource 转换为位图。我在互联网上阅读了一些答案,但它们似乎对我不起作用。
我使用 DependencyService 调用特定于平台的代码,并将 ImageSource 作为参数传递。
函数签名如下所示:
public ImageSource BlurImage(ImageSource ImageSource)
{
return null;
}
这个函数应该首先从 ImageSource 创建一个位图,一旦完成所有逻辑,它应该转换回 ImageSource。
谁能解释一下我应该如何将 ImageSource 转换为位图,反之亦然?
提前致谢, 汤姆
【问题讨论】:
-
你的
imageSource、冗长的string或.png之类的文件是什么? -
@CGPA6.4 imageSource 是一个 ImageSource DateType。在调用平台相关代码之前,我从 PCL 项目中的 Image.Source 中检索到它
-
您最初是如何创建 ImageSource 的?您应该使用该原始图像,而不是 ImageSource
-
原始Image作为资源在PCL项目中,使用如下:
csharp blurImage.Source = ImageSource.FromResource("Guassian.Assets.Images.Test.JPG");这个blurImage在Xaml中使用,源稍后作为参数传递
标签: c# android xamarin bitmap imagesource