Ejemplo n.º 1
0
        public IMask Load(bool[,] mask, string id, bool inverseMask = false, Color?debugDrawColor = null, string saveMaskToFile = null)
        {
            IBitmap      image  = _bitmapLoader.Load(mask.GetLength(0), mask.GetLength(1));
            List <Point> points = new List <Point>(image.Width * image.Height);

            for (int row = 0; row < mask.GetLength(1); row++)
            {
                for (int col = 0; col < mask.GetLength(0); col++)
                {
                    if (mask[col, row])
                    {
                        if (!inverseMask)
                        {
                            points.Add(new Point(col, row));
                        }
                    }
                    else if (inverseMask)
                    {
                        points.Add(new Point(col, row));
                    }
                }
            }
            image.SetPixels(Colors.Black, points);
            return(load(null, image, false, debugDrawColor, saveMaskToFile, id));
        }