class Magick::RVG::Image

def add_composite_primitive(gc)

def add_composite_primitive(gc)
    if @align == 'none'
        # Let RMagick do the scaling
        scale = 1.0
        width, height = @width, @height
    elsif @meet_or_slice == 'meet'
        scale = [@width/@image.columns, @height/@image.rows].min
        width, height = @image.columns, @image.rows
    else
        # Establish clipping path around the current viewport
        name = __id__.to_s
        gc.define_clip_path(name) do
            gc.path("M#{@x},#{@y} l#{@width},0 l0,#{@height} l-#{@width},0 l0,-#{@height}z")
        end
        gc.clip_path(name)
        scale = [@width/@image.columns, @height/@image.rows].max
        width, height = @image.columns, @image.rows
    end
    tx, ty = align_to_viewport(scale)
    gc.composite(@x+tx, @y+ty, width*scale, height*scale, @image)
end