477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
|
# File 'lib/r2dsvg/r2dsvg_module.rb', line 477
def read(s, title=@title)
@loaded = false
@window.clear
svg, _ = RXFHelper.read(s)
doc = Svgle.new(svg, callback: self, debug: @debug)
instructions = Render.new(doc, debug: @debug).to_a
drawing = DrawingInstructions.new @window, debug: @debug
puts ('instructions: ' + instructions.inspect).debug if @debug
@width, @height = %i(width height).map{|x| doc.root.attributes[x].to_i }
@window.set title: title, width: @width, height: @height
threads = []
threads << Thread.new do
doc.root.xpath('//script').each {|x| eval x.text.unescape }
drawing.render instructions
end
threads.join
@loaded = true
@doc = doc
end
|