Method: Rectangle#fill_rectangle

Defined in:
lib/curses/geometry/rectangle.rb

#fill_rectangle(x1, y1, x2, y2) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/curses/geometry/rectangle.rb', line 9

def fill_rectangle(x1, y1, x2, y2)
  min_x, max_x  = x1 < x2 ? [x1,x2] : [x2,x1]
  min_y, max_y  = y1 < y2 ? [y1,y2] : [y2,y1]

  setpos(min_x, min_y)   
  min_y.upto(max_y) do |y|
    setpos(y, min_x)
    min_x.upto(max_x) do |x|
      addch(get_fill_glyph)
    end
  end
end