示例#1
0
        public override void Apply(ref Bitmap bitmap, out Highlighter[] highlightersOut)
        {
            List <Highlighter> highlighters = new List <Highlighter>();

            // Process each tile
            Images.ImageReader reader = new Images.ImageReader(ref bitmap);

            for (int tileX = 0; tileX < bitmap.Width / vectorGridInterval * vectorGridInterval; tileX += vectorGridInterval)
            {
                for (int tileY = 0; tileY < bitmap.Height / vectorGridInterval * vectorGridInterval; tileY += vectorGridInterval)
                {
                    AnalyseTile(
                        ref reader,
                        new Rectangle(tileX, tileY, Math.Min(tileX + vectorGridInterval, bitmap.Width) - tileX, Math.Min(tileY + vectorGridInterval, bitmap.Height) - tileY),
                        ref highlighters);
                }
            }

            // Add a grid highlighter representing the grid we checked

            /*highlighters[1] = new GridHighlighter(new Rectangle(0, 0, bitmap.Width, bitmap.Height), vectorGridInterval);
             * (highlighters[1] as GridHighlighter).Pen.Width = 1;
             * (highlighters[1] as GridHighlighter).Pen.Color = Color.Gray;*/

            highlightersOut = highlighters.ToArray();

            // Release resources
            reader.Dispose();
        }