Draw-to-SVG Converter

A RISC OS utility to convert Drawfiles to SVG


Description

This converts vector-graphic Drawfiles on RISC OS to SVG. It can handle:

  • path objects with identical, non-triangular start and end caps, which are converted directly to SVG paths,

  • path objects with triangular caps or different start and end caps, which are each converted to a capless path overlayed with another path to draw the caps,

  • (transformed) text objects, which are converted to Draw paths, and then to SVG paths — or directly to <text> elements if you choose (thanks to James Bursa's patch; fixed to handle &, < and >),

  • group objects, which become <g> elements (optional, as of 2000-09-24), and

  • (transformed) sprite objects (but only partially), which become grey (transformed) rectangles (it should be easy to change these into <image> elements manually).

You can also control:

  • whether the outer <svg> has x and y attributes,

  • whether the input file type is checked,

  • whether the output file type is set,

  • the scale of the output, by either a factor, or to fit a particular width/height,

  • the SVG width of ‘Drawfile-thin’ lines,

  • the dimensions of a margin, added after any scaling,

  • a background which covers the margin too.

Some optimisations include:

  • reducing the need to specify all style properties by being aware of defaults, and

  • compressing paths by using relative co-ordinates.

draw2svg is a command-line program, but a WIMP front-end with interactive help is now provided. (The back end is still required.) There is also a configuration file to use it with David Ruck's !ComndCTRL.

Other things to do include:

  • converting text objects to <text> elements, using the text-to-path method only as a back-up plan — partially done, but I'd like to improve on it,

  • handling JPEG objects,

  • handling embedded images by converting them to <image> elements and extracting (and converting) the images, or by trying to convert the images to paths, or by working out URIs of the converted images.

Requirements

  • Shared Unix Library — Merge into your own set-up with your usual tool, e.g. by running !Boot, selecting System, and dropping the new !System into the window.

Updates

  • 1.03-1 has been relinked to fix a bug that restricted the drag area for saving files.

Tested platforms

Do let me know if you find some hideous bug, please!

RISC OS 3.11; ARM3
RISC OS 3.11; Red Squirrel 0.6
RISC OS 4.02 patch 5; ARM610
RISC OS 4.02 patch 5; StrongARM
RISC OS 5.01; XScale
RISC OS 5.20; XScale RPCEmu

Erm… okay

〈your (RISC OS) platform here?〉

Draw2SVG has problems on your machine? Describe them (problems and machine type) to me, and include a couple of test files to demonstrate, if you can. These could be made available to others who can provide test results on other platforms.


Files

File Size Last modified Description Requirements and recommendations
Source (Git) GNU Make ISO C99 Binodeps
152¼KiB 2019-02-20 back end – to be merged with !Boot, ARMv7 RISC OS
Source (SVN) GNU Make ISO C99 Binodeps
148½KiB 2019-02-20 front end – WIMP application, ARMv7 RISC OS