Creating solid color pictures

<sxg>

  <!-- width and height declarations -->

  <picture id="orange">
    <type>rgb</type>
    <r>1</r>
    <g>.5</g>
  </picture>

  <!-- ... -->

</sxg>

An rgb-type picture creates a solid color picture (using RENDER's CreateSolidFill command). Its r, g, b, and a elements specify the value of the red, green, blue, and alpha channels, respectively. Each value ranges between 0 (minimum) and 1 (maximum). r, g, b's defaults to 0, minimum intensity. a defaults to 1, maximum intensity. This example creates a color picture with a full red intensity and 50% green intensity, with a label of orange.

Defining a background color

<sxg>

  <!-- -->

  <picture id="background">
    <type>rgb</type>
    <r>0</r>
    <g>0</g>
    <b>0</b>
  </picture>

  <!-- ... -->

</sxg>

A solid color picture with a name of background carries a special meaning. It makes it possible to specify width and height scaling factors but still support rendering an SXG image of any size, by filling the extra padding with the background color. The SXG image's size gets rounded down until its size is an even multiple of its specified width and height factors. The final image's size matches the desired size, with the rendered image centered and the background color providing the few pixels' worth of padding on the outside of the image.

Using theme colors

<!-- -->

<picture id="orange">
  <type>rgb</type>
  <color>grey</color>
  <r>1.5</r>
  <g>.5</g>
</picture>

Instead of specifying an explicit color, the color element copies a predefined color from the current display theme. This example copies the predefined color named grey. Combining the optional r, g, b, and a elements has the effect of multiplying the predefined color's channel by the given value. The multiplication factor may exceed 1, but the final value is limited to 1, maximum intensity,

Using predefined locations and dimensions

  <fill>
    <x>2</x>
    <y>y</y>
    <width>10</width>
    <height>10</height>
  </fill>

  <!-- -->

  <location id="a">
    <x>2</x>
    <y>2</y>
  </location>

  <dimension id="medium">
    <width>10</width>
    <height>10</height>
  </location>

  <fill>
    <location>a</location>
    <dimension>medium</dimension>
  </fill>

Often the same coordinate gets referenced from multiple rendering elements. The location element assigns a label identifier to a coordinate, and the location gets referenced in rendering widget anywhere where x and y must be specified. By assigning a location label to all key coordinates, it makes it easier to tweak the placement of multiple related rendering instructions.

One special usage of a location element is the defined hotspot location in an SXG file for a cursor. This specifies the cursor's hotspot.

Similarly, the dimension element lists predefined widths and heights that can be referenced accordingly.