Class: Rabbit::ImageManipulable::SVG
- Defined in:
- lib/rabbit/image/svg.rb
Constant Summary
Constants included from ModuleLoader
Instance Attribute Summary
Attributes inherited from Base
#animation, #original_height, #original_width, #properties
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from Base
#[], #[]=, delegate, #height, #initialize, #keep_ratio=, #keep_ratio?, #relative_clip_height, #relative_clip_width, #relative_clip_x, #relative_clip_y, #resize, #width
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
32 33 34 35 36 37 38 39 40 |
# File 'lib/rabbit/image/svg.rb', line 32 def match?(filename) File.open(filename) do |f| begin /<svg|<!DOCTYPE\s+svg/ =~ f.read(200) rescue EncodingError false end end end |
Instance Method Details
#draw(canvas, x, y, params = {}) ⇒ Object
43 44 45 46 47 48 49 50 |
# File 'lib/rabbit/image/svg.rb', line 43 def draw(canvas, x, y, params={}) if @handle default_params = default_draw_params(x, y) canvas.draw_rsvg_handle(@handle, x, y, default_params.merge(params)) else super end end |
#pixbuf ⇒ Object
52 53 54 |
# File 'lib/rabbit/image/svg.rb', line 52 def pixbuf @handle.pixbuf end |