Method: GraphHelper#draw_rectangle
- Defined in:
- lib/graph_helper.rb
#draw_rectangle(x1, y1, x2, y2, r, g, b) ⇒ Object
This function draw an aliased rectangle The upper left and bottom right border positions are used as first 4 arguments. The last 3 parameters are used to set the border color
67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/graph_helper.rb', line 67 def draw_rectangle(x1, y1, x2, y2, r, g, b) b, g, r = validate_color(b, g, r) c_rectangle = allocate_color(@picture,r, g, b) x1=x1-0.2 y1=y1-0.2 x2=x2+0.2 y2=y2+0.2 draw_line(x1,y1,x2,y1,r,g,b) draw_line(x2,y1,x2,y2,r,g,b) draw_line(x2,y2,x1,y2,r,g,b) draw_line(x1,y2,x1,y1,r,g,b) end |