Method: HDLRuby::Viz::Node#print_svg
- Defined in:
- lib/HDLRuby/hruby_viz.rb
#print_svg(n) ⇒ Object
Generate a print description SVG text for node +n+
3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 |
# File 'lib/HDLRuby/hruby_viz.rb', line 3772 def print_svg(n) # The shape representing the instance. res = "<rect fill=\"#B0E2FF\" stroke=\"#000\" " + "stroke-width=\"#{@scale/12.0}\" " + "x=\"#{n.xpos*@scale}\" y=\"#{(n.ypos)*@scale}\" " + "width=\"#{n.width*@scale}\" height=\"#{n.height*@scale}\" " + "/>\n" # Its text. res += "<text id=\"text#{n.name}\" " + "style=\"text-anchor: middle; dominant-baseline: middle;\" " + "font-family=\"monospace\" font-size=\"1px\" " + "x=\"#{(n.xpos + n.width/2.0)*@scale}\" "+ "y=\"#{(n.ypos + n.height/2.0)*@scale}\">" + n.to_s + "</text>\n" # Its text resizing. res += Viz.svg_text_fit("text#{n.name}",(n.width-1)*@scale, 0.6*@scale) return res end |