Class: Wireframe::Image
- Inherits:
-
Object
- Object
- Wireframe::Image
- Defined in:
- lib/wireframe/image.rb
Instance Method Summary collapse
- #draw ⇒ Object
-
#initialize(coordinates) ⇒ Image
constructor
A new instance of Image.
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
#draw ⇒ Object
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 |