[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-kimageshop
Subject:    svg options for krita
From:       Jos van den Oever <jos () vandenoever ! info>
Date:       2016-08-26 8:45:20
Message-ID: 245370037.OE5F2z6r7D () joga
[Download RAW message or body]

Hi all,

This is a follow up of sprint discussions about how to support SVG in Krita.

SVG is a rather large specification. Implementing it from scratch is a large 
task. Just implementing reading and writing is a lot of work. So it's 
important to be clever.

For reading and writing, it's best to generate the code from a schema or reuse 
an existing library that can read and write SVG.

There are Relax NG schemas for SVG Tiny 1.2 and SVG Basic 1.1.

http://www.w3.org/TR/SVGTiny12/relaxng/
http://yupotan.sppd.ne.jp/relax-ng/svg11/

The schema for SVG Tiny 1.2 is normative. But it is not a complete solution. 
Thee schema does not go into all details, for example the color type is not 
defined but just a string in the schema, even though the specification has a 
detailed explanation for the type which could be expressed in Relax NG.

These can be starting points for generating code. A number of projects take 
input and generate code from that. My favorite one is Blasien, because it has 
the most beautiful C++ code and avoids most programming errors. Yet, all these 
generators are either tailored to one Relax NG schema or just a proof of 
concept.

Blasien
https://github.com/vandenoever/blasien
http://www.vandenoever.info/blog/2015/07/05/literal-xml-in-c++.html
 - does not currently handle multi-file relax-ng
 - only generates serializer
 - most compiletime checks
 - beautiful syntax

rng2cpp from Calligra
https://quickgit.kde.org/?p=calligra.git&a=tree&f=libs%2Fodf%2Fwriteodf
https://quickgit.kde.org/?p=calligra.git&a=tree&f=devtools%2Frng2cpp
 - predecessor to Blasien
 - used in production for OpenDocument in Calligra
 - does not currently handle multi-file relax-ng
 - only generates serializer

https://gitlab.com/odfplugfest/xmlmirror/commits/krita-svg
 - handles multi-file relax ng
 - generates json (see attach), not c++, so all c++ generation has to be added

These options would help to write high quality conversions between ODF and 
SVG.

That leaves rendering and editing. Krita has great code for editing vectors 
that can be adapted to read and write SVG with the generated code.

Another option is to use SVG-Edit. This is an SVG editor written in 
JavaScript.
https://svg-edit.github.io/svgedit/releases/svg-edit-2.8.1/svg-editor.html
The SVG is never converted to a runtime model. Just get the element with id 
'svgcontent' and save it. The browser takes care of loading the svg and 
rendering it.

This code can be used via QtWebKit. PhantomJS from Krita alumnus Ariya Hidayat 
shows that QtWebKit is still very much alive.
https://github.com/ariya/phantomjs/issues/14366

Another option is http://svgpp.org/. This library uses RapidXMLNS to provide a 
runtime SVG DOM. This DOM can be modified and re-rendered. The render must 
be provided by the application. This DOM is not typed, so care must be taken 
to not create invalid SVG.

I'll close this long mail with an inspirational link to a talk about 
WebRender.
https://air.mozilla.org/bay-area-rust-meetup-february-2016/

Cheers,
Jos







["svgtiny.json.bz2" (svgtiny.json.bz2)]

BZh91AY&SY#.߀Up?j` >T*I*`
	)E	,`A$BJJ(H* P"&LL0L02db`ɂdф``8ɓ&#&L \
#CTTLD0FM FLMRB	OCSPѦf =@Fz R&2LSIOh=My5
N /˗_~Km7t1*+
 	+$UFI\%LJ02DȲI62
a1i2̶
hC&*bY%Y2mm̘c4-ll&E
#*VIfH#$ʦKqBYBͶ͘iTY>1 \
L+Y6ڴVK5gfn$15/,T+Xok	6 \
#Ra&?LCͶ6ʟ~Zoen_w|ZYh⎊jK+\%.n% \QL \
&^7KO͚io+q9]90,3;Η+o&L֭Li--Zfev0V' \
wNzNKZ+GNRh:$,+y6[]JĘ=N9Ѽ+]tRtRm']J>P+q˗{.*yX'HIVb< \
  ;ԭ
WBG&ԥS&AR(0*>Ϗroצm}nv׏~:>\uTߔLԛasxF(F~eTb7
 N.9d0ԞUjЮ{2LjM$&5'y6\I:q-<^}LrnoOuN=3v>=Өˍ_8q7o<=t<BV=vیk1xjW\Yf<^ٌ4 \
LY;юTxY0Břd<M/T'YI,f2͔ZO66L1,VUF%b%Zm-ʦ#"ęk \
kR `V́V15V`U$iFSeRcZMj&֒ҵMDLa3e2ak05ej+YfU402dASZUMXV̓5cXSJ`f	UcYlFf%ZYXx$
 mm6Ė+(Kd2lZ`6C[6,MZ-+[53ZZ̚3!&ZablMZH̙S2,2LbwJڂJmo%^eG_i4EʤدJ
 GrލԮ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