svg command can now specify an ID
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user