Anonymous user
Bitmap/Flood fill: Difference between revisions
→{{header|Ruby}}
Line 2,600:
class RGBColour
def ==(
values ==
end
end
Line 2,609:
current_colour = self[pixel.x, pixel.y]
queue = Queue.new
queue.
until queue.empty?
p = queue.
next unless self[p.x, p.y] == current_colour
Line 2,621:
%i[north south].each do |direction|
n = neighbour(q, direction)
queue.
end
q = neighbour(q, :east)
Line 2,657:
JRubyArt is a port of Processing to the ruby language
<lang ruby># holder for pixel coords
Pixel = Struct.new(:x, :y)
|