svg
KUIML supports inline svg graphics. Only core svg elements and attributes are supported (circle, ellipse, line, path, polygon, polyline, rect, radialGradient, linearGradient). Filters, effects and drop shadows are not supported.
Note that you cannot add other widgets inside an svg tag (just like svg embedded into HTML): all non-svg tags inserted into an svg elements are simply ignored.
Attributes brief detailed show all inherited
Examples
As svg is a vector format you can scale it freely without losing sharpness. Also the fact that it can be embedded directly in KUIML makes it possible to create skins consisting of a single .xml file with all included (except extra fonts, if used).
- <!-- cog image -->
- <svg width="75" height="75" viewBox="-1 0 16 16" opacity="1">
- <path stroke="#000000" fill="#FF0000" d="M14 8.77v-1.6l-1.94-.64-.45-1.09.88-1.84-1.13-1.13-1.81.91-1.09-.45-.69-1.92h-1.6l-.63 1.94-1.11.45-1.84-.88-1.13 1.13.91 1.81-.45 1.09L0 7.23v1.59l1.94.64.45 1.09-.88 1.84 1.13 1.13 1.81-.91 1.09.45.69 1.92h1.59l.63-1.94 1.11-.45 1.84.88 1.13-1.13-.92-1.81.47-1.09L14 8.75v.02zM7 11c-1.66 0-3-1.34-3-3s1.34-3 3-3 3 1.34 3 3-1.34 3-3 3z" />
- </svg>

Using as "icons"
You can create TEMPLATEs with svg and easily (re)use them in your designs, here's an example.
- <!-- create an svg "icon" -->
- <TEMPLATE id="MY_SVG_COG" color="#777777" size="20" opacity="1">
- <svg width="$size$" height="$size$" viewBox="0 0 16 16" opacity="$opacity$"><path stroke="$color$" fill="$color$" d="M14 8.77v-1.6l-1.94-.64-.45-1.09.88-1.84-1.13-1.13-1.81.91-1.09-.45-.69-1.92h-1.6l-.63 1.94-1.11.45-1.84-.88-1.13 1.13.91 1.81-.45 1.09L0 7.23v1.59l1.94.64.45 1.09-.88 1.84 1.13 1.13 1.81-.91 1.09.45.69 1.92h1.59l.63-1.94 1.11-.45 1.84.88 1.13-1.13-.92-1.81.47-1.09L14 8.75v.02zM7 11c-1.66 0-3-1.34-3-3s1.34-3 3-3 3 1.34 3 3-1.34 3-3 3z"/></svg>
- </TEMPLATE>
- <!-- re-use it -->
- <ROW spacing="10">
- <MY_SVG_COG />
- <MY_SVG_COG size="25" color="#5555CC" />
- <MY_SVG_COG size="40" color="#DD0000" opacity=".5" />
- </ROW>

Built-in icons
There are plenty of svg icons inside LM Skin. To see them go to "Skin scanner" -> "Icons".

Animating svg
Using TIMER and changing innerSVG attribute on the fly you can create some animation.
- <!-- create an svg "icon" -->
- <svg id="my_svg" width="50" height="50" viewBox="-1 0 16 16" opacity="1">
- <path stroke='#000000' fill='#00CC00' d='M14 8.77v-1.6l-1.94-.64-.45-1.09.88-1.84-1.13-1.13-1.81.91-1.09-.45-.69-1.92h-1.6l-.63 1.94-1.11.45-1.84-.88-1.13 1.13.91 1.81-.45 1.09L0 7.23v1.59l1.94.64.45 1.09-.88 1.84 1.13 1.13 1.81-.91 1.09.45.69 1.92h1.59l.63-1.94 1.11-.45 1.84.88 1.13-1.13-.92-1.81.47-1.09L14 8.75v.02zM7 11c-1.66 0-3-1.34-3-3s1.34-3 3-3 3 1.34 3 3-1.34 3-3 3z' transform='rotate(0 8 8)' />
- </svg>
- <!-- a timer and an action -->
- <TIMER id="forever_timer" refresh_time_ms="20" />
- <!-- change svg content (rotation value) on timer -->
- <ACTION_TRIGGER event_id="forever_timer.elapsed"
- script="
- string s = "<path stroke='#000000' fill='#00CC00' d='M14 8.77v-1.6l-1.94-.64-.45-1.09.88-1.84-1.13-1.13-1.81.91-1.09-.45-.69-1.92h-1.6l-.63 1.94-1.11.45-1.84-.88-1.13 1.13.91 1.81-.45 1.09L0 7.23v1.59l1.94.64.45 1.09-.88 1.84 1.13 1.13 1.81-.91 1.09.45.69 1.92h1.59l.63-1.94 1.11-.45 1.84.88 1.13-1.13-.92-1.81.47-1.09L14 8.75v.02zM7 11c-1.66 0-3-1.34-3-3s1.34-3 3-3 3 1.34 3 3-1.34 3-3 3z' transform='rotate("+angle+" 7.1 8.1)' />";
- my_svg.innerSVG = s;
- angle += 4;
- if (angle>=360) angle=0;
- " requires="my_svg.innerSVG" />
- <!-- keep rotation value here -->
- <SCRIPT script="double angle = 0;" />

If you plan something serious like drawing FFT display for an eq consider using CANVAS for drawing. It's easier on CPU.
Comments
Please, authorize to view and post comments.