Class: GD2::Canvas::Rectangle

Inherits:
Object
  • Object
show all
Defined in:
lib/gd2/canvas.rb

Direct Known Subclasses

FilledRectangle

Instance Method Summary collapse

Constructor Details

#initialize(point1, point2) ⇒ Rectangle

Returns a new instance of Rectangle.



68
69
70
# File 'lib/gd2/canvas.rb', line 68

def initialize(point1, point2)
  @p1, @p2 = point1, point2
end

Instance Method Details

#draw(image, mode) ⇒ Object



72
73
74
75
# File 'lib/gd2/canvas.rb', line 72

def draw(image, mode)
  SYM[draw_sym].call(image.image_ptr, @p1.x, @p1.y, @p2.x, @p2.y, mode)
  nil
end

#draw_symObject



77
78
79
# File 'lib/gd2/canvas.rb', line 77

def draw_sym
  :gdImageRectangle
end