コード例 #1
0
 public override void FloodFill(FloodFillContext context)
 {
     Initialize(context);
     MakeContur();
     Fill();
     RedrawPolygon();
 }
コード例 #2
0
ファイル: CurrentTester.cs プロジェクト: idenx/FloodFiller
 public CurrentTester(FloodFillContext context, PartitionDrawer partitioner)
 {
     Initialize(context, partitioner);
     CreateFloodFiller();
     algorithmsCount = floodFiller.strategiesList.Count;
     testResults = new float[algorithmsCount];
 }
コード例 #3
0
ファイル: AELfloodfiller.cs プロジェクト: idenx/FloodFiller
 public override void FloodFill(FloodFillContext context)
 {
     Initialize(context);
     yRows = new List<float>[monitorHeight];
     MakeAndSortAEL(yRows);
     Draw();
 }
コード例 #4
0
        public override void FloodFill(FloodFillContext context)
        {
            Initialize(context);

            PointF currentPoint;
            int currentY;
            Rectangle bounds = data.GetPolygonBounds();
            int currentColor;
            int xMin = bounds.Left, xMax = bounds.Right;
            foreach (KeyValuePair<Point, Point> edge in data.GetAllEdges())
            {
                for (EdgePixelsIterator iterator = new EdgePixelsIterator(edge); !iterator.End(); iterator.Next())
                {
                    currentPoint = iterator.Current();
                    if (!currentPoint.IsEmpty)
                    {
                        currentY = (int)(currentPoint.Y - 0.5);
                        for (int currentX = (int)Math.Ceiling(currentPoint.X); currentX < xMax; ++currentX)
                        {
                            currentColor = GetPixel(currentX, currentY);
                            if (currentColor != aBorderColor)
                            {
                                if (currentColor == aBackColor)
                                    SetPixel(currentX, currentY, fillColor);
                                else
                                    SetPixel(currentX, currentY, backColor);
                            }
                        }
                    }
                }
            }
        }
コード例 #5
0
ファイル: FloodFillDrawer.cs プロジェクト: idenx/FloodFiller
 public void FloodFill(Image currentImage, Color fillColor, Color polygonColor, Color backColor, Point fillStartPoint)
 {
     LastBitmap = currentImage.Clone() as Bitmap;
     FloodFillContext context = new FloodFillContext(currentImage as Bitmap, data, fillStartPoint, polygonColor, fillColor, backColor);
     CreateWorker(context.bitmap);
     floodFillerStrategy.SlowMode = _EnableSlowing;
     worker.RunWorkerAsync(context);
 }
コード例 #6
0
ファイル: WithFlag.cs プロジェクト: idenx/FloodFiller
 public override void FloodFill(FloodFillContext context)
 {
     Initialize(context);
     var graphics = System.Drawing.Graphics.FromImage(bmp);
     foreach (KeyValuePair<Point, Point> edge in data.GetAllEdges())
     {
         graphics.DrawLine(new Pen(backColor), edge.Key, edge.Value);
         DrawLineDDA(edge.Key, edge.Value);
     }
     Fill();
 }
コード例 #7
0
 public override void FloodFill(FloodFillContext context)
 {
     Initialize(context);
     FloodFillHelper(context.FillStartPoint.X, context.FillStartPoint.Y);
 }
コード例 #8
0
ファイル: CurrentTester.cs プロジェクト: idenx/FloodFiller
 private void Initialize(FloodFillContext context, PartitionDrawer partitioner)
 {
     this.context = context;
     this.context.bitmap = context.bitmap.Clone() as Bitmap;
     this.partitioner = partitioner;
 }
コード例 #9
0
ファイル: CurrentTester.cs プロジェクト: idenx/FloodFiller
 public void RefreshData(FloodFillContext context, PartitionDrawer partitioner)
 {
     Initialize(context, partitioner);
 }
コード例 #10
0
        public override void FloodFill(FloodFillContext context)
        {
            Initialize(context);

            PointF currentPoint;
            int currentY;
            Rectangle bounds = data.GetPolygonBounds();
            int currentColor;
            int xMin = bounds.Left, xMax = bounds.Right;
            int yMin = bounds.Top, yMax = bounds.Bottom;
            float K = GetPartitionLineCoefK(), B = GetPartitionLineCoefB();
            int startX, endX;

            foreach (KeyValuePair<Point, Point> edge in data.GetAllEdges())
            {
                for (EdgePixelsIterator iterator = new EdgePixelsIterator(edge); !iterator.End(); iterator.Next())
                {
                    currentPoint = iterator.Current();
                    if (!currentPoint.IsEmpty)
                    {
                        currentY = (int)(currentPoint.Y - 0.5);
                        if (K != float.MaxValue)
                        {
                            if ((K * currentPoint.X + B - currentPoint.Y) * (K * xMin + B - yMin) > 0)
                            {
                                startX = (int)Math.Ceiling(currentPoint.X);
                                endX = (int)Math.Ceiling((currentPoint.Y - B) / K);
                            }
                            else
                            {
                                startX = (int)Math.Ceiling((currentPoint.Y - B) / K);
                                endX = (int)Math.Ceiling(currentPoint.X);
                            }
                        }
                        else
                        {
                            if (currentPoint.X < partitionBegin.X)
                            {
                                startX = (int)Math.Ceiling(currentPoint.X);
                                endX = partitionBegin.X;
                            }
                            else
                            {
                                startX = partitionBegin.X;
                                endX = (int)Math.Ceiling(currentPoint.X);
                            }
                        }
                        for (int currentX = startX; currentX < endX; ++currentX)
                        {
                            currentColor = GetPixel(currentX, currentY);
                            if (currentColor != aBorderColor)
                            {
                                if (currentColor == aBackColor)
                                    SetPixel(currentX, currentY, fillColor);
                                else
                                    SetPixel(currentX, currentY, backColor);
                            }
                        }
                    }
                }
            }
            System.Drawing.Graphics.FromImage(bmp).DrawLine(new Pen(fillColor), partitionBegin, partitionEnd);
        }
コード例 #11
0
 public override void FloodFill(FloodFillContext context)
 {
     Initialize(context);
     stack.Push(context.FillStartPoint);
     FloodFillHelper();
 }