c# - 如何在 blazor 中放大和裁剪 SVG 到特定坐标
问题描述
我在我的方法中从用户那里得到坐标 a1,y1,x2,y2,rotationangle,outputwidth 和 outputheight。我需要使用这些坐标裁剪 svg 但在裁剪之前我需要在这些坐标上放大 svg 然后裁剪
`double width = xaxis2 - xaxis1; double height = yaxis2 - yaxis1;
Rectangle CropArea = new Rectangle(
Convert.ToInt32(xaxis1),
Convert.ToInt32(yaxis1),
Convert.ToInt32(width),
Convert.ToInt32(height)
);
Bitmap originalImage = new Bitmap(filePath);
using (Bitmap bitMap = new Bitmap(CropArea.Width,
CropArea.Height))
{
using (Graphics g = Graphics.FromImage(bitMap))
{
g.DrawImage(originalImage, new Rectangle(0, 0,
bitMap.Width, bitMap.Height), CropArea, GraphicsUnit.Pixel);
}
}`
解决方案
推荐阅读
- c# - Input.GetAxis("Mouse X"), Input.GetAxis("Mouse Y") 总是返回 0
- r - 使用示例数据框在 R 中创建人工数据框
- pact - AMQ 消息 V3.0 合约中的 stringType 匹配器进行文字匹配而不是类型匹配
- sql - 从新旧表参考更新表列
- python - 带有三引号的 Jupyter Notebook Python 自动文档字符串生成
- xml - 什么是
和 ? 有没有人知道这个? - scala - 如何仅将空数据帧标题写入 csv 文件?
- postgresql - 触发器创建时出现“SET 处或附近的语法错误”
- python - 数据框列值组合?
- compilation - 如果在 symtab 中提到符号但在 readelf 输出的 dynsym 中没有提到符号,这意味着什么?