Anonymous user
Bitmap/Flood fill: Difference between revisions
→{{header|Processing Python mode}}: refactored image(img... to show() added an image_file global
m (→{{header|Wren}}: Minor simplification.) |
(→{{header|Processing Python mode}}: refactored image(img... to show() added an image_file global) |
||
Line 2,213:
<lang Python>from collections import deque
image_file = "image.png"
fill_color = color(250, 0, 0)
tolerance = 15
Line 2,220 ⟶ 2,221:
global img
size(600, 400)
img = loadImage(
fill(0, 0, 100)
textSize(18)▼
show()
def show():
image(img, 0, 0, width, height)
▲ textSize(18)
text("Tolerance = {} (Use mouse wheel to change)".format(tolerance),
100, height - 30)
text("Right click to reset", 100, height - 10)
def draw():
global allowed
if allowed:
allowed = False
Line 2,240 ⟶ 2,241:
global allowed, img
if mouseButton == RIGHT:
img = loadImage(
else:
img.loadPixels()
|