-(require 'image-mode)
-
-(defgroup svg-clock nil
- "svg-clock"
- :group 'applications)
-
-(defcustom svg-clock-size t
- "Size (width and height) of the clock.
-Either an integer which gives the clock size in pixels, or t
-which makes the clock fit to its window automatically."
- :type '(choice (integer :tag "Fixed Size" :value 250)
- (const :tag "Fit to window" t))
- :group 'svg-clock)
-
-(defvar svg-clock-timer nil)
-
-(defconst svg-clock-template
- "<?xml version=\"1.0\"?>
-<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"
-\"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">
-<svg xmlns=\"http://www.w3.org/2000/svg\"
- width=\"%SIZE%\" height=\"%SIZE%\" >
- <defs>
- <symbol id=\"tick\">
- <line x1=\"50\" y1=\"2\" x2=\"50\" y2=\"4\"
- style=\"stroke:%FG%;stroke-width:1\"/>
- </symbol>
- <symbol id=\"ticklong\">
- <line x1=\"50\" y1=\"2\" x2=\"50\" y2=\"9\"
- style=\"stroke:%FG%;stroke-width:2\"/>
- </symbol>
- <symbol id=\"hand-hour\">
- <line x1=\"50\" y1=\"22\" x2=\"50\" y2=\"54\"
- style=\"stroke:%FG%;stroke-width:3\"/>
- </symbol>
- <symbol id=\"hand-minute\">
- <line x1=\"50\" y1=\"12\" x2=\"50\" y2=\"55\"
- style=\"stroke:%FG%;stroke-width:3\"/>
- </symbol>
- <symbol id=\"hand-second\">
- <line x1=\"50\" y1=\"10\" x2=\"50\" y2=\"59\"
- style=\"stroke:%FG%;stroke-width:0.5\"/>
- </symbol>
- <g id=\"minute-ticks-a\">
- <use xlink:href=\"#tick\"
- transform=\"rotate(6, 50, 50)\" />
- <use xlink:href=\"#tick\"
- transform=\"rotate(12, 50, 50)\" />
- <use xlink:href=\"#tick\"
- transform=\"rotate(18, 50, 50)\" />
- <use xlink:href=\"#tick\"
- transform=\"rotate(24, 50, 50)\" />
- </g>
- <g id=\"minute-ticks-b\">
- <use xlink:href=\"#minute-ticks-a\"
- transform=\"rotate(0, 50, 50)\" />
- <use xlink:href=\"#minute-ticks-a\"
- transform=\"rotate(30, 50, 50)\" />
- <use xlink:href=\"#minute-ticks-a\"
- transform=\"rotate(60, 50, 50)\" />
- <use xlink:href=\"#minute-ticks-a\"
- transform=\"rotate(90, 50, 50)\" />
- <use xlink:href=\"#minute-ticks-a\"
- transform=\"rotate(120, 50, 50)\" />
- <use xlink:href=\"#minute-ticks-a\"
- transform=\"rotate(150, 50, 50)\" />
- </g>
-
- <g id=\"5-minute-ticks\">
- <use xlink:href=\"#ticklong\" />
- <use xlink:href=\"#ticklong\" transform=\"rotate(30, 50, 50)\" />
- <use xlink:href=\"#ticklong\" transform=\"rotate(60, 50, 50)\" />
- </g>
-
- <g id=\"clock\">
- <use xlink:href=\"#5-minute-ticks\"
- transform=\"rotate(0, 50, 50)\" />
- <use xlink:href=\"#5-minute-ticks\"
- transform=\"rotate(90, 50, 50)\" />
- <use xlink:href=\"#5-minute-ticks\"
- transform=\"rotate(180, 50, 50)\" />
- <use xlink:href=\"#5-minute-ticks\"
- transform=\"rotate(270, 50, 50)\" />
-
- <use xlink:href=\"#minute-ticks-b\"
- transform=\"rotate(0, 50, 50)\" />
- <use xlink:href=\"#minute-ticks-b\"
- transform=\"rotate(180, 50, 50)\" />
-
- <use xlink:href=\"#hand-second\"
- transform=\"rotate(%SECOND%, 50, 50)\">
- </use>
- <use xlink:href=\"#hand-minute\"
- transform=\"rotate(%MINUTE%, 50, 50)\">
- </use>
- <use xlink:href=\"#hand-hour\"
- transform=\"rotate(%HOUR%, 50, 50)\">
- </use>
-
- <circle cx=\"50\" cy=\"50\" r=\"3\" fill=\"%FG%\"/>
- </g>
- </defs>
- <use xlink:href=\"#clock\"
- transform=\"scale(%SCALE%, %SCALE%)\"/>
-</svg>"
- "The template for drawing the `svg-clock'.")
-
-(defvar svg-clock--actual-size 100
- "Actual size of the svg clock.")
-
-(defun svg-clock-color-to-hex (colour)
- "Return hex representation of COLOUR."
- (let ((values (color-values colour)))
- (format "#%02x%02x%02x" (nth 0 values) (nth 1 values) (nth 2 values))))