World: r3wp
[SVG Renderer] SVG rendering in Draw AGG
older newer | first last |
shadwolf 23-Jun-2005 [14] | can be found on http://shadwolf.free.fr/svg-demo-shadwolf.r |
Ashley 23-Jun-2005 [15] | Thanks for taking this up and running with it guys, you're making great progress (far better than I could have). Feel free to take ownership of the code and refactor it as needed. Two minor improvements are: unless closed? [insert tail shape reduce ['move 0x0]] which is Gabriele's fix to the shape close problem, and: feel: make feel [ redraw: func [face act pos] [ if act = 'draw [insert clear face/effect/draw load-svg face/data face/size] ] ] which cleans the sample feel code up a bit. I'd also remove "VID" from the title of this group as DRAW AGG is tied to View. ;) |
shadwolf 23-Jun-2005 [16x3] | okay I have imporved matrix support it seems to be good for scale-x: 1 scale-y: 1 if cyphre can see the code of the matrix gestion and makes some fix optimisation it could allow us to advance more with the rest of the SVG word format |
groupe title rename done | |
matrix intervention of cyphre could be very educationnal and help me a lot to see what I'm messing in my code | |
Vincent 23-Jun-2005 [19] | Thanks Ashley: there's still a lot of work to do - as SVG is quite flexible |
shadwolf 23-Jun-2005 [20x2] | yes it' quite a nightmare for a AGG newbie as I'm ... |
for example the implementation of the LIneargradient I dont have any idea about how to translate it to AGG | |
DideC 24-Jun-2005 [22] | I suppose 'fill-pen is what you need. Can render gradient in many way. |
shadwolf 24-Jun-2005 [23x8] | yes DideC you are right the most problem will be to create tht tree structure to store all the LinearGradient définition and there childs then retrieve the approprieted informations |
drawing primitives have a xlink:href field that point to the appropiate main lineargradient (countainer) | |
I'm working hard on the translation of the linearGradient informations from SVG files to AGG | |
and I have some asks | |
how to apply a matrix tranformation only over a grendient definition ? | |
I think I handle web the creation of the rebol list of linear gradient | |
if you wants to write the "in" AGG/draw code that is based on my rebol linear gradient list there is the code and a sample file from InkScape | |
http://shadwolf.free.fr/svg-demo02.zip | |
Ashley 25-Jun-2005 [31] | Noticed you found some conversion numbers (where from?? ;) ), so here's a simple func to make use of them: to-unit: func [s [string!]] [ switch/default skip tail s -2 [ "pt" [1.25 * to decimal! copy/part s -2 + length? s] "pc" [15 * to decimal! copy/part s -2 + length? s] "mm" [3.543307 * to decimal! copy/part s -2 + length? s] "cm" [35.43307 * to decimal! copy/part s -2 + length? s] "in" [90 * to decimal! copy/part s -2 + length? s] "px" [to decimal! copy/part s -2 + length? s] ][ to decimal! s ] ] |
shadwolf 26-Jun-2005 [32x11] | Ashley yes !!! You noticed right I found them deep hided in the SVG format documentation on W3C dedicated pages to SVG format .... |
I copy past the conversion units into the script becaus I know that could be usefull but AS I was working on lineargradient and as it's a complicated part of the format SVG I had no time to make a conversion algorithm I glad to see that you make it :) | |
the page where I found the conversion rules | |
http://www.w3.org/TR/SVG/coords.html | |
see chapter 7.10 | |
I read most of the documentation but then make the link to AGG data structure is rather difficult | |
linearGradient for example are splitted the first one contain the coordonates systeme and tranfromation informations the second one countains the colors involved and their order in the gradient | |
so you avac primitive(fill:url) ->LinearGRadient (coords) -> LinearGradient (colors order) | |
where do I plug the to-unit function ? | |
in svg-size | |
?? | |
Ashley 26-Jun-2005 [43] | Yes, to-unit is called from svg-size; and also from "path d", stroke-width, fill-width, etc ... probably anywhere in SVG where we "expect" an integer or decimal! ;) |
shadwolf 29-Jun-2005 [44] | okay good stuf in it Vincent and I are planning to use the xml-to-object.r script from Brian Wisti to enbetter and make a more sophisticate support for our actual work upon SVG parsing translation and rendering into a VID window |
BrianW 29-Jun-2005 [45] | shadwolf, I'm not the author - just a guy who made it available in the Rebol library :-) |
shadwolf 29-Jun-2005 [46x3] | it says author hahah ;) |
opkay so we are planning on the opportinity to use a REBOL tree object! structure to represente SVG datas :) | |
this in the goal to improve drastically the performance and be more performant on some key issues like recursivity etc... | |
shadwolf 30-Jun-2005 [49x15] | I make a base code but now I have to find a good code to exploit the relevent datas from the object tree |
this means to interogate the content of the objet a gived level | |
then construc path to get data then translate this data to a draw equivalent exploitable datas | |
and fill the draw block with this data | |
my point is to make a recursif capapble code | |
for example my object is set into xml global variable | |
I I want to interrogate the first shape description on the top level ( out of group blocks) I have to build a path like that xml/svg/path/1/d | |
or maybe build the path xml/svg/path then attribute to a temporary var the foreach ob xml/svg/path [ ob processing ] | |
so to build the path we start xml/svg "/ " g or path if g we seek 3 thing transform field and path field or sub g field | |
I give you the code maybe this will be more clear | |
shadwolf.free.fr/svg-demo-shad04.r | |
oups sorry | |
wrong adress | |
http://shadwolf.free.fr/svg-demo-shad03.r | |
in this file we have xml-to-object function load-svg function (mostly empty there is where to put the data conversion and draw block construction) and the widget that start the program | |
older newer | first last |