svg.pl -- Manipulating SVG xmls.

Read/write SVGs as xmls.

Pack info

author
- nicos angelopoulos
version
- 0.1 2021/1/19
See also
- http://stoics.org.uk/~nicos/sware/svg
- http://stoics.org.uk/~nicos/sware/svg/doc/html/svg.html
- pack(svg/examples/)
- pack(svg/scripts/)
 svg_size(+Svg, -Width, -Height)
Gets the size of an Svg.
Remove pt from units and converts to numbers (iff possible).
?- svg_size( pack('svg/examples/rea_smp-e10_fclr.svg'), W, H ).
W = 497,
H = 404.
author
- nicos angelopoulos
version
- 0.1 2018/2/20
See also
- svg/2.
 svg_tag_coords(+Svg, +Tag, -Coords)
 svg_tag_coords(+Svg, +Tag, +AsPos, -Coords)
Find the locations (X-Y, Coords) of all tags of type Tag in an Svg file.
Predicate simply looks for x=, y= into Atts of matching tags.
AsPos is a boolean (false when missing) that when set translates each X and Y to it positive value.
?- svg_tag_coords( pack('svg/examples/rea_smp-e10_fclr.svg'), text, Coords ), maplist( writeln, Coords ), fail.
197- -302.3
197- -230.3
446- -374.3
...
344- -14.3
197- -86.3
false.

?- svg_tag_coords( pack('svg/examples/rea_smp-e10_fclr.svg'), text, true, Coords ), maplist( writeln, Coords ), fail.
197-706.3
197-634.3
446-778.3
...
344-418.3
197-490.3
false.

?- svg_size( pack('svg/examples/rea_smp-e10_fclr.svg'), W, H ).
W = 497,
H = 404.
author
- nicos angelopoulos
version
- 0.1 2018/2/21
 svg_legend(+FilesAndOpts)
Adds legend to svg files. Atoms in Files and Opts are taken to be the files, and everything else is options. See option atoms/1 in options_append/4.

If no Files are given, then svgs from current directory are used. If one or more svg files with postfix fclr and a single svg with postfix (os_postfix/2) exist, then those are taken as the inputs, else all svgs are considered.

Opts

?- svg_legend( ['rea_smp-e10_fclr.svg',theme=edges(['E32636'-red_edges,'8DB600'-green_edges]) ] ).
author
- nicos angelopoulos
version
- 0.1 2016/12/10
- 0.2 2017/8/21, added placement: at (by passing distances, more or less properly)
- 0.3 2018/2/27, major restructuring disentangle from gbn_svg_legend.pl
See also
- gbn_svg_legend/1
To be done
- provide some generic legend generator from say clr-text paired inputs
 svg(+SvgF, -Svg)
svg(+SvgF, +Svg)
svg(-SvgF, +Svg)
Load and write Svg files (SvgF) to and from terms (Svg).
An unbound Svg triggers loading, else terms are written to file.
An unbound SvgF passes Svg into SvgF.
?- svg( pack('svg/examples/rea_smp-e10_fclr.svg'), Svg ).
Svg = svg([width='497pt', height='404pt', viewBox='0.00 0.0...]....)
author
- nicos angelopoulos
version
- 0.1 2021/1/19
 svg_version(-Version, -Date)
Current version and release date for the library.
?- svg_version( V, D ).
V = 0:1:0,
D = date(2021, 2, 19).

Undocumented predicates

The following predicates are exported, but not or incorrectly documented.

 svg_change_dim(Arg1, Arg2, Arg3, Arg4)