The following example creates an image of a circle with a grey border, filled with a small black-and-white checkerboard pattern.
<sxg> <width>32</width> <height>32</height> <widthmm>10</widthmm> <heightmm>10</heightmm> <widthfactor>2</widthfactor> <heightfactor>2</heightfactor> <picture id="grey"> <type>rgb</type> <r>.5</r> <g>.5</g> <b>.5</b> </picture> <picture id="checkerboard"> <size> <type>mmrounded</type> <factor>.5</factor> </size> <width>2</width> <height>2</height> </picture> <pixmap id="circle_mask"> <size>scaled</size> <width>32</width> <height>32</height> <mask /> <gc id="circle_mask_gc" /> </pixmap> <render id="checkerboard"> <repeat>normal</repeat> <fill> <rectangle> <x>0</x> <y>0</y> <width>2</width> <height>2</height> </rectangle> </fill> <fill> <r>1</r> <g>1</g> <b>1</b> <rectangle> <x>0</x> <y>0</y> <width>1</width> <height>1</height> </rectangle> <rectangle> <x>1</x> <y>1</y> <width>1</width> <height>1</height> </rectangle> </fill> </render> <gc id="circle_mask_gc"> <function>set</function> <arcs> <fill /> <arc> <x>2</x> <y>2</y> <width>28</width> <height>28</height> <angle1>0</angle1> <angle2>360</angle2> </arc> </arcs> </gc> <render id="main"> <composite> <op>src</op> <mask> <pixmap>circle_mask</pixmap> <x>0</x> <y>0</y> </mask> <src> <picture>checkerboard</picture> <x>0</x> <y>0</y> </src> <x>0</x> <y>0</y> <width>32</width> <height>32</height> </composite> </render> <gc id="circle_mask_gc"> <function>clear</function> <fill> <x>0</x> <y>0</y> <width>32</width> <height>32</height> </fill> <function>set</function> <line_width>4</line_width> <arcs> <arc> <x>2</x> <y>2</y> <width>28</width> <height>28</height> <angle1>0</angle1> <angle2>360</angle2> </arc> </arcs> </gc> <render id="main"> <composite> <op>over</op> <mask> <pixmap>circle_mask</pixmap> <x>0</x> <y>0</y> </mask> <src> <picture>grey</picture> <x>0</x> <y>0</y> </src> <x>0</x> <y>0</y> <width>32</width> <height>32</height> </composite> </render> </sxg>
This SXG file defines its nominal size as 10x10 millimeters, using a virtual 32x32 coordinate space. First, a 2x2 pseudo-millimeter-sized picture gets entirely filled with a black color, then two 1x1 white rectangles get drawn, forming the checkerboard pattern.
A mask pixmap gets created, for the full 32x32 virtual coordinate space, and is filled with a circle. This is used as a mask to compose the checkerboard pattern into the main picture.
The mask pixmap is modifying by clearing a 28x28 circle inside it, leaving the mask as only a 4 virtual pixel-wide border. This mask then gets used to compose the grey color on top of the main picture.