| Summary of MVG Primitives and Syntax |
| ==================================== |
| |
| MVG ignores all white-space between commands. This allows |
| multiple MVG commands per line. It is common convention to |
| terminate each MVG command with a new line to make MVG easier |
| to edit and read. This syntax description uses indentation in |
| MVG sequences to aid with understanding. Indentation is |
| supported but is not required. |
| |
| Metafile wrapper syntax (to support stand-alone MVG files) |
| ---------------------------------------------------------- |
| |
| push graphic-context |
| viewbox 0 0 width height |
| [ any other MVG commands ] |
| pop graphic-context |
| |
| |
| Pattern syntax (saving and restoring context) |
| --------------------------------------------- |
| |
| push pattern id x,y width,height |
| push graphic-context |
| [ drawing commands ] |
| pop graphic-context |
| pop pattern |
| |
| an example is (%s is a identifier string) |
| |
| push defs |
| push pattern %s 10,10 20,20 |
| push graphic-context |
| fill red |
| rectangle 5,5 15,15 |
| pop graphic-context |
| push graphic-context |
| fill green |
| rectangle 10,10 20,20 |
| pop graphic-context |
| pop pattern |
| pop defs |
| |
| For image tiling use |
| |
| push pattern id x,y width,height |
| image Copy ... |
| pop pattern |
| |
| Note you can use the pattern for either the fill or stroke like |
| |
| stroke url(#%s) |
| |
| or |
| |
| fill url(#%s) |
| |
| Clip-path syntax |
| ---------------- |
| |
| The clip path defines a clipping area, where only the contained |
| area will be drawn upon. Areas outside of the clipping area are |
| masked. |
| |
| push defs |
| push clip-path %s |
| push graphic-context |
| rectangle 10,10 20,20 |
| pop graphic-context |
| pop clip-path |
| pop defs |
| clip-path url(#%s) |
| |
| Individual Drawing Primitives |
| ============================= |
| |
| affine sx,rx,ry,sy,tx,ty |
| arc x0,y0 x1,y1 a0,a1 |
| bezier x0,y0 ... xn,yn |
| circle originX,originY perimX,perimY |
| clip-path url(#%s) (%s is the name of the clip path) |
| clip-rule (evenodd|nonzero) |
| clip-units (userSpace|userSpaceOnUse|objectBoundingBox) |
| color x,y (point|replace|floodfill|filltoborder|reset) |
| decorate (none|underline|overline|line-through) |
| ellipse centerX,centerY radiusX,radiusY arcStart,arcEnd |
| fill colorspec |
| fill-opacity opacity[%] |
| fill-rule (evenodd|nonzero) |
| font fontname |
| font-family familyname (e.g. "helvetica") |
| font-size pointsize |
| font-stretch (all|normal|ultra-condensed|extra-condensed|condensed| |
| semi-condensed|semi-expanded|expanded|extra-expanded| |
| ultra-expanded) |
| font-style (all|normal|italic|oblique) |
| font-weight (all|normal|bold|100|200|300|400|500|600|700|800|900) |
| gradient-units (userSpace|userSpaceOnUse|objectBoundingBox) |
| gravity (NorthWest|North|NorthEast|West|Center|East|SouthWest| |
| South|SouthEast) |
| image (Add|Atop|Bumpmap|Clear|CopyBlue|CopyGreen|CopyOpacity|CopyRed| |
| Copy|Difference|In|Minus|Multiply|Out|Over|Plus|Subtract|Xor) |
| dest_x,dest_y dest_width,dest_height 'filename' |
| line startX,startY endX,endY |
| matte x,y (point|replace|floodfill|filltoborder|reset) |
| offset ??? |
| opacity value[%] |
| path 'SVG-compatible path arguments' |
| point x,y |
| polygon x1,y1, x2,y2, x3,y3, ..., xN,yN |
| polyline x1,y1, x2,y2, x3,y3, ..., xN,yN |
| pop clip-path |
| pop defs |
| pop gradient |
| pop graphic-context |
| pop pattern |
| push clip-path %s (%s is the name of the clip path) |
| push defs |
| push gradient id linear x1,y1 x2,y2 |
| push gradient id radial cx,cy fx,fy r |
| push graphic-context |
| push pattern id x,y width,height |
| rectangle upperLeftX,upperLeftY lowerRightX,lowerRightY |
| rotate angle |
| roundrectangle upperLeftX,upperLeftY lowerRightX,lowerRightY cornerWidth,cornerHeight |
| scale x,y |
| skewX angle |
| skewY angle |
| stop-color colorspec offset |
| stroke colorspec |
| stroke-antialias truth-value (0 or 1) |
| stroke-dasharray (none|comma-delimited-numeric-list) |
| stroke-dashoffset dashoffset |
| stroke-linecap (butt|round|square) |
| stroke-linejoin (butt|miter|round|square) |
| stroke-miterlimit limit |
| stroke-opacity opacity[%] |
| stroke-width linewidth |
| text x,y "some text" |
| text-antialias (0|1) |
| text-undercolor colorspec |
| translate x,y |
| viewbox x1 y1 x1 y2 (e.g. "viewbox 0 0 640 480") |
| |