Class: Rabbit::ImageManipulable::SVG
- Defined in:
- lib/rabbit/image/svg.rb
Constant Summary
Constants included from ModuleLoader
Instance Attribute Summary
Attributes inherited from Base
#height, #original_height, #original_width, #width
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from Base
#[], #[]=, #initialize, #keep_ratio, #keep_ratio=, #resize
Methods included from ModuleLoader
extend_object, #find_loader, #loaders, #push_loader, #unshift_loader
Constructor Details
This class inherits a constructor from Rabbit::ImageManipulable::Base
Class Method Details
.match?(filename) ⇒ Boolean
15 16 17 18 19 |
# File 'lib/rabbit/image/svg.rb', line 15 def match?(filename) File.open(filename) do |f| /<svg|<!DOCTYPE\s+svg/ =~ f.read(200) end end |
Instance Method Details
#draw(canvas, x, y, params = {}) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/rabbit/image/svg.rb', line 22 def draw(canvas, x, y, params={}) if @handle and canvas.rsvg_available? default_params = { :width => width, :height => height, } canvas.draw_rsvg_handle(@handle, x, y, default_params.merge(params)) else super end end |
#pixbuf ⇒ Object
34 35 36 |
# File 'lib/rabbit/image/svg.rb', line 34 def pixbuf @pixbuf ||= to_pixbuf(width, height) end |