buggy flood fill

This commit is contained in:
visionmercer 2026-05-01 13:58:36 +02:00
commit 218e54ce70
2 changed files with 120 additions and 7 deletions

View file

@ -179,6 +179,17 @@ sub canvas
' 4. Interaction Logic
if _mousex > boxX1 then
' Start Drawing Logic
if state.tool = 9 and (mouseclicked or rmouseclicked) then
_dest layers(2).ihandle
_source layers(2).ihandle
if mouseclicked then
floodfill canX,canY,state.fcolor
else
floodfill canX,canY,state.bcolor
end if
_dest 0
_source 0
end if
if state.tool = 7 or state.tool = 8 then
if mouseclicked then
polypoints(pointCount * 2) = canX
@ -238,16 +249,15 @@ sub canvas
if commit then
_dest layers(1).ihandle ' Final destination is always the drawing layer
if state.tool = 8 and pointCount > 2 then
redim finalP(pointCount * 2 - 1) as single
if (state.tool = 8 or state.tool=7) and pointCount > 2 then
redim finalP(pointCount * 2 - 1) as long
for p = 0 to (pointCount * 2) - 1: finalP(p) = polypoints(p): next
filledPolygon finalP(), drawCol ' Using tools.bm sub[cite: 2]
if state.tool =8 then filledPolygon finalP(), drawCol else Polygon finalP(), drawCol
else
' Merge the preview into the drawing layer[cite: 1]
' Merge the preview into the drawing layer
_putimage , layers(2).ihandle, layers(1).ihandle
end if
' Clear preview layer[cite: 1]
_dest layers(2).ihandle: cls , 0
state.isDrawing = 0
pointCount = 0
@ -275,6 +285,11 @@ function icon (index as long)
' Draw a small filled shape for the filled polygon icon
for fy = 10 to 20: line (10, fy)-(22, fy): next
_dest 0
icons(8) = _newimage(32, 32, 32): _dest icons(8)
' Simple "Bucket" icon
line (8, 10)-(24, 10): line -(26, 22): line -(6, 22): line -(8, 10)
line (10, 8)-(22, 8) ' Handle
_dest 0
' Fill the remaining slots with blank 32x32 images
dim j as integer
for j = 0 to 19