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


50
51
52
# File 'lib/gd2/canvas.rb', line 50

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

Instance Method Details

#draw(image, mode) ⇒ Object


54
55
56
57
# File 'lib/gd2/canvas.rb', line 54

def draw(image, mode)
  ::GD2::GD2FFI.send(draw_sym, image.image_ptr, @p1.x.to_i, @p1.y.to_i, @p2.x.to_i, @p2.y.to_i, mode.to_i)
  nil
end

#draw_symObject


59
60
61
# File 'lib/gd2/canvas.rb', line 59

def draw_sym
  :gdImageRectangle
end