class DrawSvg::Canvas
TODO: consider making Canvas
an Item
. TODO: Add Rotation. TODO: performance.
Constants
- DEFAULT_SCALE
Attributes
height[R]
img[R]
items[R]
scale[RW]
width[R]
Public Class Methods
new(width, height, output=nil, opts={})
click to toggle source
# File lib/drawsvg.rb, line 59 def initialize width, height, output=nil, opts={} @width, @height, @output, @opts = width, height, output, opts @scale = Scale.new(@opts.delete(:scale) || DEFAULT_SCALE) @img = SVGImageCalls.new @location = Point[0, 0] @items = [] draw end
Public Instance Methods
absolute_location()
click to toggle source
# File lib/drawsvg.rb, line 70 def absolute_location @location end
draw()
click to toggle source
# File lib/drawsvg.rb, line 67 def draw raise NotImplementedError end
to_svg()
click to toggle source
# File lib/drawsvg.rb, line 73 def to_svg svg = PrintStatusImg.new(Rasem::SVGImage.new(@width, @height, @output)) @img.replay_on svg @items.each {|i| i.to_svg svg } svg.close svg.output end