Data update
This commit is contained in:
parent
4bb20c9b71
commit
cbaf4c4b64
12390 changed files with 318560 additions and 27248 deletions
|
|
@ -1,18 +1,18 @@
|
|||
floodFill = function(bmp, x, y, targetColor, replacementColor)
|
||||
// Check if pixel is outside the bounds
|
||||
if not(0 < x < bmp.width) or not(0 < y < bmp.height) then return
|
||||
|
||||
// Check the current pixel color
|
||||
currentColor = bmp.pixel(x, y)
|
||||
if currentColor != targetColor then return
|
||||
|
||||
// Replace the color
|
||||
bmp.setPixel x, y, replacementColor
|
||||
// Recursively apply to adjacent pixels
|
||||
floodFill(bmp, x + 1, y, targetColor, replacementColor)
|
||||
floodFill(bmp, x - 1, y, targetColor, replacementColor)
|
||||
floodFill(bmp, x, y + 1, targetColor, replacementColor)
|
||||
floodFill(bmp, x, y - 1, targetColor, replacementColor)
|
||||
// Check if pixel is outside the bounds
|
||||
if not(0 < x < bmp.width) or not(0 < y < bmp.height) then return
|
||||
|
||||
// Check the current pixel color
|
||||
currentColor = bmp.pixel(x, y)
|
||||
if currentColor != targetColor then return
|
||||
|
||||
// Replace the color
|
||||
bmp.setPixel x, y, replacementColor
|
||||
// Recursively apply to adjacent pixels
|
||||
floodFill(bmp, x + 1, y, targetColor, replacementColor)
|
||||
floodFill(bmp, x - 1, y, targetColor, replacementColor)
|
||||
floodFill(bmp, x, y + 1, targetColor, replacementColor)
|
||||
floodFill(bmp, x, y - 1, targetColor, replacementColor)
|
||||
end function
|
||||
clear
|
||||
img = file.loadImage("Unfilledcirc.png")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue