It is necessary to take n points of type Point “draw” a closed filled polygon. And if a certain point on the "canvas" is drawn, then the corresponding element of the array bool[,] becomes true .
I give the code, which, I think, should perform this task. But of course it only seems to me and as a result I get an empty “canvas”.
//точки масива List<Point> ps = new List<Point>(); ps.Add(new Point(10, 0)); ps.Add(new Point(0, 0)); ps.Add(new Point(0, 10)); //не понял для чего GraphicsPath требует byte [] types List<byte> ppt = new List<byte>(); ppt.Add(0); ppt.Add(0); ppt.Add(0); //System.Drawing.Drawing2D.GraphicsPath GraphicsPath gp = new GraphicsPath(ps.ToArray(), ppt.ToArray()); //попытка замкнуть контур gp.Flatten(); //переменная, ради которой было произведено все вышенаписанное bool[,] bmp = new bool[11, 11]; for (int x = 0; x < 11; x++) for (int y = 0; y < 11; y++) if (gp.IsVisible((float)x, (float)y)) bmp[x, y] = true; else bmp[x, y] = false; //следующий код только для визуализации Bitmap visual = new Bitmap(11, 11); for (int x = 0; x < 11; x++) for (int y = 0; y < 11; y++) if (bmp[x, y]) visual.SetPixel(x, y, Color.Red); visual.Save("bmp.png"); Thought to do so . But it seems to me that in C # this bike was invented a long time ago.
You can, of course, and so draw a polygon
Graphics g = Graphics.FromImage(img); Point[] points=...; g.DrawPolygon(blackPen, points); But something tells me that working with Image img = new Bitmap(x,y) load the comp more strongly than bool [,] img = new bool [x,y]