1:- module( svg, [ 2 svg/2, 3 svg_change_dim/4, 4 svg_legend/1, 5 svg_size/3, 6 svg_tag_coords/3, svg_tag_coords/4, 7 svg_version/2 8 ] ). 9 10:- use_module( library(lib) ). 11:- lib(source(svg),homonyms(true)). 12 13:- lib(os_lib). 14:- lib(debug_call). 15:- lib(pack_errors). 16 17% :- lib(stoics_lib:at_con/3). 18 19:- lib(svg_size/3). 20:- lib(svg_change_dim/3). 21:- lib(svg_tag_coords/3). 22:- lib(svg_legend/1). 23 24:- lib(end(svg)).
?- svg( pack('svg/examples/rea_smp-e10_fclr.svg'), Svg ). Svg = svg([width='497pt', height='404pt', viewBox='0.00 0.0...]....)
60svg( SvgOut, Svg ) :- 61 var( SvgOut ), 62 !, 63 Svg = SvgOut. 64svg( svg(Atts,Elems), Svg ) :- 65 !, 66 Svg = svg(Atts,Elems ). 67svg( SvgF, Svg ) :- 68 var( Svg ), 69 !, 70 absolute_file_name( SvgF, AbsF, [expand(true),solutions(first),file_errors(error),access(write)] ), 71 load_xml( AbsF, XmlSvg, [] ), 72 XmlSvg = [element(svg,Atts,Elems)], 73 Svg = svg(Atts,Elems). % fixme: or is it better to leave it as XML element ? or it better to seek the only element(g,_,_) ?? 74svg( SvgF, Svg ) :- 75 absolute_file_name( SvgF, AbsF, [expand(true),solutions(first),file_errors(error),access(write)] ), 76 Svg = svg(Atts,Elems), 77 Xml = [element(svg,Atts,Elems)], 78 open( AbsF, write, SvgO ), 79 % xml_write( SvgO, Xml, [dtd('http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'),layout(false)] ). 80 % xml_write( SvgO, Xml, [dtd('/tmp/svg11.dtd'),layout(false)] ). 81 % Type = svg(abc), 82 % xml_write( SvgO, Xml, [layout(false),doctype(Type)] ), 83 % fixme: add doctype 84 xml_write( SvgO, Xml, [layout(false)] ), 85 nl( SvgO ), 86 close( SvgO ).
?- svg_version( V, D ). V = 0:1:0, D = date(2021, 2, 19).
*/
99svg_version( 0:1:0, date(2021,1,19) )
Manipulating SVG xmls.
Read/write SVGs as xmls.
Pack info
*/