C# 使用GDI+获取不规则图形中所有像素点(扣图)
作者:互联网
最开始一个个像素遍历,然后速度很慢,后发现了一种新方法Region.IsVisible
GraphicsPath path = new GraphicsPath() { };
path.AddPolygon(new PointF[] {new PointF(100,100),new PointF(300,300), new PointF(900, 100) , new PointF(900, 700) , new PointF(100, 700) });
Region r = new Region(path);
List<test> list = new List<test>();
for (int i = 0; i < 960; i++)
{
for (int j = 0; j < 720; j++)
{
if (r.IsVisible(i, j))
{
pointList2.Add(new Point(i, j));
}
}
}
标签:PointF,C#,Region,int,扣图,path,new,100,像素点 来源: https://www.cnblogs.com/GongYao/p/16491064.html