Class: Wireframe::Image

Inherits:
Object
  • Object
show all
Defined in:
lib/wireframe/image.rb

Instance Method Summary collapse

Constructor Details

#initialize(coordinates) ⇒ Image

Returns a new instance of Image.



3
4
5
6
7
8
9
10
11
12
# File 'lib/wireframe/image.rb', line 3

def initialize(coordinates)
  math = Math.new(coordinates)
  @height = math.height
  @width = math.width

  @canvas = Magick::Image.new(@width, @height) do
    self.background_color = 'white'
  end

end

Instance Method Details

#drawObject



14
15
16
17
18
19
20
21
22
23
# File 'lib/wireframe/image.rb', line 14

def draw
  gc = Magick::Draw.new      
  gc.stroke('black')

  draw_lines(gc)
  draw_box(gc)

  gc.draw(@canvas)
  @canvas.to_blob {self.format = "PNG"}
end