我确信它很容易,但似乎找不到任何有答案的人.我有一个图像,我需要从该图像中切出一个圆或甚至其他形状.我需要这个代码在.net c#中.我在课堂上这样做,所以它不是wpf或winform.我需要传递x和y pos以及圆的大小.
其他选择是AForge,ImageStatistics.我需要得到一个圆圈(图像的一部分)并获得StdDev.
谢谢您的帮助.安德鲁
- 更新到chris帖子.
这是c#中的chris帖子.不像他那么干净,但却是一个开始.
public System.Drawing.Image x(string sourceFile, int circleUpperLeftX, int circleUpperLeftY, int circleDiameter)
{
Bitmap SourceImage = new Bitmap(System.Drawing.Image.FromFile(sourceFile));
Rectangle CropRect = new Rectangle(circleUpperLeftX, circleUpperLeftY, circleDiameter, circleDiameter);
Bitmap CroppedImage = SourceImage.Clone(CropRect, SourceImage.PixelFormat);
TextureBrush TB = new TextureBrush(CroppedImage);
Bitmap FinalImage = new Bitmap(circleDiameter, circleDiameter);
Graphics G = Graphics.FromImage(FinalImage);
G.FillEllipse(TB, 0, 0, circleDiameter, circleDiameter);
return FinalImage;
}
Run Code Online (Sandbox Code Playgroud) 从 uno 平台 WASM 客户端,我尝试调用 ASP.NET Core REST 演示:
[HttpGet]
public IEnumerable<WeatherForecast> Get()
{
var rng = new Random();
return Enumerable.Range(1, 5).Select(index => new WeatherForecast
{
Date = DateTime.Now.AddDays(index),
TemperatureC = rng.Next(-20, 55),
Summary = Summaries[rng.Next(Summaries.Length)]
})
.ToArray();
}
Run Code Online (Sandbox Code Playgroud)
当 wasm 客户端调用其余部分时,我得到 TypeError: Failed to fetch 但这工作得很好 UWP 和控制台应用程序。
客户端正在使用
public async Task<string> RefreshDataAsync(string x)
{
var _client = new HttpClient();
var response = await _client.GetStringAsync(@"http://localhost:58658/weatherforecast");
return response;
}
Run Code Online (Sandbox Code Playgroud)
WASM uno 平台是否支持 REST API 调用?