class Gtk2SVG::Render
Public Instance Methods
circle(e, attributes)
click to toggle source
# File lib/gtk2svg.rb, line 18 def circle(e, attributes) h = attributes x, y= %i(cx cy).map{|x| h[x].to_i } radius = h[:r].to_i * 2 [:draw_arc, [x, y, radius, radius], attributes, render_all(e)] end
ellipse(e, attributes)
click to toggle source
# File lib/gtk2svg.rb, line 28 def ellipse(e, attributes) h = attributes x, y= %i(cx cy).map{|x| h[x].to_i } width = h[:rx].to_i * 2 height = h[:ry].to_i * 2 [:draw_arc, [x, y, width, height], attributes, render_all(e)] end
image(e, attributes)
click to toggle source
# File lib/gtk2svg.rb, line 47 def image(e, attributes) h = attributes x, y, width, height = %i(x y width height).map{|x| h[x] ? h[x].to_i : nil } src = h[:'xlink:href'] [:draw_image, [x, y, width, height], src, attributes, render_all(e)] end
line(e, attributes)
click to toggle source
# File lib/gtk2svg.rb, line 39 def line(e, attributes) x1, y1, x2, y2 = %i(x1 y1 x2 y2).map{|x| attributes[x].to_i } [:draw_line, [x1, y1, x2, y2], attributes, render_all(e)] end
polygon(e, attributes)
click to toggle source
# File lib/gtk2svg.rb, line 57 def polygon(e, attributes) points = attributes[:points].split(/\s+/). \ map {|x| x.split(/\s*,\s*/).map(&:to_i)} [:draw_polygon, points, attributes, render_all(e)] end
polyline(e, attributes)
click to toggle source
# File lib/gtk2svg.rb, line 65 def polyline(e, attributes) points = attributes[:points].split(/\s+/). \ map {|x| x.split(/\s*,\s*/).map(&:to_i)} [:draw_lines, points, attributes, render_all(e)] end
rect(e, attributes)
click to toggle source
# File lib/gtk2svg.rb, line 73 def rect(e, attributes) puts 'inside rect' h = attributes x1, y1, width, height = %i(x y width height).map{|x| h[x].to_i } x2, y2, = x1 + width, y1 + height [:draw_rectangle, [x1, y1, x2, y2], attributes, render_all(e)] end
script(e, attributes)
click to toggle source
# File lib/gtk2svg.rb, line 84 def script(e, attributes) [:script] end
svg(e, attributes)
click to toggle source
# File lib/gtk2svg.rb, line 88 def svg(e, attributes) # jr051216 style[:fill] = style.delete :'background-color' h = attributes width, height = %i(width height).map{|x| h[x].to_i } [:draw_rectangle, [0, 0, width, height], attributes, render_all(e)] end
text(e, attributes)
click to toggle source
# File lib/gtk2svg.rb, line 98 def text(e, attributes) x, y = %i(x y).map{|x| attributes[x].to_i } [:draw_layout, [x, y], e.text, attributes, render_all(e)] end