Search code examples
svgimagemagickmvg

ImageMagick MVG vs. SVG -- graphic context


I am currently porting some app of me from ImageMagick MVG to SVG output. I made heavily use of the "push graphic-context" command of MVG and now wonder, what's the equivalent to this in SVG?

What "push graphic-context" does is in short (copied from some other source):

When a graphic context is pushed, options set after the context is pushed 
(such as coordinate transformations, color settings, etc.) are saved to a 
new graphic context. This allows related options to be saved on a graphic 
context "stack" in order to support hierarchical nesting of options. When    
"pop graphic-context" is used to pop the current graphic context, the 
options in effect during the "push graphic-context" operation are restored.

Is the equivalent to use nested SVG documents, like the following example?

<svg>
    ...
    <svg>
        ...
    </svg>
    ...
</svg>

or should i use something else?

Thanks in advance!


Solution

  • You can use either <svg> or <g> elements for this, I'd recommend <g> elements unless you need a new viewport - in that case go for <svg>.