问题描述
我需要用抗锯齿填充复杂区域。
该区域由许多旋转的矩形(如向日葵花瓣)和一个中心圆组成。
区域不支持抗锯齿
所以我尝试了 FillPath 但没有填充矩形重叠的区域。 (异或)
// Has alpha so FillPath-ing multiple times doesn't help
Color color = Color.FromArgb(128,32,64,255);
Brush brush = new SolidBrush(color);
Region region = null;
//GraphicsPath bigPath = new GraphicsPath();
for (int i = 0; i < nPetals; i++)
{
GraphicsPath pat = new GraphicsPath();
Point p1,p2,p3,p4; // Actual code omitted
pat.Addpolygon(new[] { p1,p4 });
//bigPath.Addpolygon(new[] { p1,p4 });
if (region == null)
region = new Region(pat);
else region.Union(pat);
}
var pathCirc = new GraphicsPath();
pathCirc.AddEllipse(100,200,3,3);
region.Union(path);
g.FillRegion(brush,region); //Aliased
//g.FillPath(brush,bigPath); //XOR'ed
GraphicsPath.Addpolygon/AddEllipse() 有没有什么非 XOR 的方法?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)