diff --git a/lib/squib/api/image.rb b/lib/squib/api/image.rb index 2d64d26..b64d486 100644 --- a/lib/squib/api/image.rb +++ b/lib/squib/api/image.rb @@ -27,10 +27,10 @@ module Squib # @param width: the pixel width that the image should scale to. SVG scaling is done with vectors, so the scaling should be smooth. When set to `:native`, uses the DPI and units of the loaded SVG document. # @param height: the pixel width that the image should scale to. SVG scaling is done with vectors, so the scaling should be smooth. When set to `:native`, uses the DPI and units of the loaded SVG document. # @api public - def svg(range: :all, file: nil, x: 0, y: 0, width: :native, height: :native) + def svg(range: :all, file: nil, id: nil, x: 0, y: 0, width: :native, height: :native) range = rangeify(range) file = fileify(file) - range.each{ |i| @cards[i].svg(file, x, y, width, height) } + range.each{ |i| @cards[i].svg(file, id, x, y, width, height) } end end diff --git a/lib/squib/graphics/image.rb b/lib/squib/graphics/image.rb index 09bc7ec..e256350 100644 --- a/lib/squib/graphics/image.rb +++ b/lib/squib/graphics/image.rb @@ -8,14 +8,14 @@ module Squib cc.paint(alpha) end - def svg(file, x, y, width, height) + def svg(file, id, x, y, width, height) svg = RSVG::Handle.new_from_file(file) width = svg.width if width == :native height = svg.height if height == :native tmp = Cairo::ImageSurface.new(width, height) tmp_cc = Cairo::Context.new(tmp) tmp_cc.scale(width.to_f / svg.width.to_f, height.to_f / svg.height.to_f) - tmp_cc.render_rsvg_handle(svg) + tmp_cc.render_rsvg_handle(svg, id) cairo_context.set_source(tmp, x, y) cairo_context.paint end