Luxor 'placeimage' with scaling

Hi, I think this is a rather simple question but somehow I am unable to figure this out… :sweat_smile:

So, I have some svg images where all of them have the same scales. I want to place them on some absolute coordinates with varying scales.

I know that it is possible to do this by playing with @layer, the code will be more or less looks like:

# imgs, coords, scales, are the data vectors 
Drawing(some_w, some_h, "test.svg")
for (i,img) in enumerate(imgs)
    origin()
    translate(coords[i])
    @layer begin
        scale(scales[i])
        placeimage(img, O)
    end
end

I guess my question is, is there any simpler way of doing this without changing the global scaling and then resetting it (then repeat)? Maybe something like placeimage(img, coor; scale=scale)? Thanks.

Not really. Luxor uses a simple “current state” model, rather than have keywords for transformations in every function. But you can easily add a helper function of your own:

svgplace(svg, pos; scalefactor = 1) = @layer begin 
    scale(scalefactor)
    placeimage(svg, pos)
end

@draw begin
    svgplace(svgimg, O, scalefactor=0.1)
    svgplace(svgimg, Point(100, 100), scalefactor=0.5)
end

This function would place the scaled svgimage at pos*scalefactor right?, (I could be wrong though). My goal is placing the scaled svgimage at pos (maybe my explanation was unclear, my bad). Hence why I also used origin and translate (kinda a roundabout way to placeimage at pos without being affected by the scalefactor).