+ return wxString::FromCDouble(f, 2);
+}
+
+// Return the colour representation as HTML-like "#rrggbb" string and also
+// returns its alpha as opacity number in 0..1 range.
+wxString Col2SVG(wxColour c, float *opacity)
+{
+ if ( c.Alpha() != wxALPHA_OPAQUE )
+ {
+ *opacity = c.Alpha()/255.;
+
+ // Remove the alpha before using GetAsString(wxC2S_HTML_SYNTAX) as it
+ // doesn't support colours with alpha channel.
+ c = wxColour(c.GetRGB());
+ }
+ else // No alpha.
+ {
+ *opacity = 1.;
+ }
+
+ return c.GetAsString(wxC2S_HTML_SYNTAX);
+}
+
+wxString wxPenString(wxColour c, int style = wxPENSTYLE_SOLID)
+{
+ float opacity;
+ wxString s = wxT("stroke:") + Col2SVG(c, &opacity) + wxT("; ");
+