andyhill Posted April 27, 2020 Posted April 27, 2020 Using UniCanvas I build many polygons and flood fill some. I am having issues with this polygon and FloodFill (not others) - please advise - Thanks 387/134 385/133 380/132 375/133 373/135 371/139 371/144 373/150 377/161 383/171 385/175 385/176 385/177 385/179 386/187 390/194 394/195 400/195 400/194 399/190 398/185 396/178 394/169 391/159 387/134 // I suspect the winding direction of the polygon points // Right, Down p.X:= PlyArray[0].X+1; // PlyArray[0].X+2; PlyArray[0].X-1; PlyArray[0].X-2; p.Y:= PlyArray[0].Y + 1; // PlyArray[0].Y + 2; PlyArray[0].Y - 1; PlyArray[0].Y - 2; //p.X:= PlyArray[n].X+1; // PlyArray[n].X+2; PlyArray[n].X-1; PlyArray[n].X-2; //p.Y:= PlyArray[n].Y + 1; // PlyArray[n].Y + 2; PlyArray[n].Y - 1; PlyArray[n].Y - 2; // My Point "p" Is Inside the Polygon by a few pixels, if I make sure "p" has say 10px margin from the edges then in it fills, 2px margin it does not if PointInPolygon(p, PlyArray) = True then begin cArea.MoveTo(p.X, p.Y); HoldColour:= cArea.Brush.Color; HoldOpacity:= cArea.Brush.Opacity; cArea.Brush.Color:= FillColour; cArea.Brush.Opacity:= 0.25; cArea.FloodFill(p.X, p.Y); cArea.Brush.Color:= HoldColour; cArea.Brush.Opacity:= HoldOpacity; Quote
andyhill Posted April 28, 2020 Author Posted April 28, 2020 As I expected it is related winding and Anti-Aliasing. Quote
andyhill Posted May 2, 2020 Author Posted May 2, 2020 Please see image below, you will notice each polygon center has a small red circle indicator. Note the polygon that will not Flood Fill even though we are in the center of the polygon. As mentioned earlier it is an anti-aliasing issue. Please advise how to turn off anti-aliasing -or- better still how to resolve (set edge proximity) ? Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.