Class: Mahoujin::Graphics::Renderer

Inherits:
Object
  • Object
show all
Defined in:
lib/mahoujin/graphics/renderer.rb

Instance Method Summary collapse

Instance Method Details

#render(atom, iostream, style = nil) ⇒ Object


4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/mahoujin/graphics/renderer.rb', line 4

def render(atom, iostream, style = nil)
  @style = style || Graphics::Styles::Basic.new

  @layout = Graphics::Layout.new
  @layout.layout(atom, @style)

  Cairo::SVGSurface.new(iostream, atom.bbox.width, atom.bbox.height) do |surface|
    @ctx = Cairo::Context.new(surface)
    initialize_graphics_environment
    render_atom(atom)
  end
end