• Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

AltME groups: search

Help · search scripts · search articles · search mailing list

results summary

worldhits
r4wp4382
r3wp44224
total:48606

results window for this page: [start: 8401 end: 8500]

world-name: r3wp

Group: Script Library ... REBOL.org: Script library and Mailing list archive [web-public]
Barik:
6-Aug-2009
Hmm, I just realized library group was for the script library, not 
for library/load and DLL related questions. Oops.
Sunanda:
21-Aug-2009
Sorry, no there is not -- not online anyway.

You could download all the scripts and do a search locally with a 
few lines of REBOL code 
http://localhost/cgi-bin/download-librarian.r
(the scripts will all be in the /scripts/ folder)
Maxim:
26-Aug-2009
I'm almost done doing my lean rebol to JSON converter...  and its 
been tested using an html and javascript  test, so its output is 
valid.
Maxim:
26-Aug-2009
sunanda, you might want to add an "extension" section to rebol.org 
where we may contribute C/C++ code to rebol.org... what do you think?


for tutorials and small projects it might be very usefull as a tool 
to help out other people into understanding how to use the extension 
API.
Pekr:
26-Aug-2009
Guys, is there any strategy of how to distinguish R2 vs R3 script 
base? I know that there are header/library fields available, but 
apart from that, I expect almost zero compatibility between R2 and 
R3 script base, and users might be confused, why scripts don't work 
for them? Would R2 vs R3 script-base split be a good idea?
AdrianS:
26-Sep-2009
looks good - it might be useful to impose the actual dimensions of 
the three sizes for consistency. I suppose the submitted images could 
be scaled after uploading, but it might help the uploader to know 
the sizes so that he could take them into account and maybe crop 
the images, if needed.
Maxim:
13-Dec-2009
rebol.org should have a new tag added:

 R3


since R3 just about every R3 scripts are incompatible with R2 it 
would be nice to have reference to what R3 scripts are available 
on rebol.org.


I ask this cause I want to upload an R3 BNF -> Parse grammer converter 
and I see no way to make it explicit in the gui that its an R3 script.
Sunanda:
13-Dec-2009
Anyone can add any tag to scripts....Click the [edit tags] link when 
logged on and looking at a script.
   http://www.rebol.org/boiler.r?display=st-edit-tags-help
Maxim:
13-Dec-2009
exactly... but just adding that button in the menu (even if there 
are only on or two script which are tagged atm) will help raise awareness 
about the need to tag stuff and to add new r3 content to rebol.org.


that's just my two cents... right now... rebol.org fives the impression 
it doesn't support r3 at all.  maybe a little post on rebol weekly 
to promote the use of r3 tags and a quiet request to carl to blog 
about it on the r3 blog, where MANY people go for r3 news.
Maxim:
13-Dec-2009
its time to show the world that R3 is starting to be usefull, stable 
and now finally actually better than r2 in few ways.  


Its gotten past the fun "prototype" stage and is now at the usefull 
"it works" stage, even if still alpha/beta
Chris:
13-Dec-2009
But not in a way that looks weird when R2 and R3 roles are flipped.
Sunanda:
13-Dec-2009
It'd make some sense to add an [R2] tag to all existing scripts (we 
can do that automatically) and/or [R3//untested] tag.

But let's get some [R3] scripts first,  so we have  a_need_ to make 
the distinction.


A couple of my scripts should be tagged as [R3] -- I just never got 
a round tuit:
   http://www.rebol.org/art-display-article.r?article=j26z
Sunanda:
13-Dec-2009
If you add a new script, yoy can add a (say)
  library: [r3: 'tested]
tag, and that will be picked up and used in the tag index.


The problem with updating the tags in the headers of existing scripts 
is that it is long-winded: you need to physically upload a new version.

Better just to retag via the [edit tags] link.
Janko:
29-Dec-2009
I am enhancing the rebol Haru PDF binding again , in the meantime 
I added support for getting position of current "text cursor" (which 
was the problem back then).. I needed it to detect when to go to 
new-page with pdf. Now I also added support for images (jpg and png). 
I am using Git so code is here: http://github.com/jankom/RebHaruPDF
.. it's still heavy in progress and there is a nicer OO interface 
than the one in sample_images.r (that is using the lowest level direct 
functions from binding because I am testing if it works at all with 
it)
WuJian:
18-Jan-2010
Good...

frames must already be saved in GIF format (UnFREEz does no converting), 
and that they should be the same dimensions
If there  is a function in REBOL. It could be more convenient.

make-animated-gif:  func[images[block!] /size image-size [pair!] 
/delay [integer!] /loop]......................
Group: !Uniserve ... Creating Uniserve processes [web-public]
Terry:
7-Oct-2005
the httpd is trying to serve up a page, and i wouldn't let it.??
Terry:
7-Oct-2005
One can get all fancy playing with ports and protocols, but in the 
end, there's alot to be said for DBI
Graham:
8-Oct-2005
Ahh.. your left hand was one row down and shifted to the right
Terry:
8-Oct-2005
Ok, the problem with POST data was with domain forwarding, and not 
with Uniserve.. GET works fine, POST didn't.
Volker:
25-Oct-2005
reliable - ask graham. And its donckimbel and he sounds satisfied 
with it.
DideC:
25-Oct-2005
1) Yes, by the use of an encap-fs script and some little changes 
in your script.
Philippe:
28-Oct-2005
Hello, you could find a simple bench study I've made for my job about 
Uniserve vs Apache, on the Rebol Documentation Project (see http://www.rebdocproj.org/article.php3?id_article=181). 
It's in french, but with some charts.  Uniserve is very close to 
Apache 1.3 (and 2.0, not published).
Dockimbel:
21-Jan-2006
No, but next release includes an 'encap-fs library and an example 
of encapping Uniserve with all dependencies and modules.
Terry:
4-Feb-2006
Still have this context issue though.. goes like this.. 


If I have a service, and in that service i have a "on-received' event.. 
and I put a function within that event (aka, in the on-received function 
itself.. then it works fine.. but if I try to add the same function 
to an external file, so that, when I trigger the on-received function, 
it does a DO to the external file, that function now DOESN'T work? 
 Some kind of context issue, and how do you work around it?  If i 
have a 1000 pieces of code that needs to be processed with each event, 
do i need to bury the whole thing in the service?
Terry:
4-Feb-2006
And if I LOAD the external file, you would think it would bind it 
all globally, but it doesn't?
Terry:
4-Feb-2006
Again, this is a service.. 

on-received: func [data][
raw-input: copy to-string data 
if raw-input = "test" [print "works"]
]


But if I put the if raw-input = "test" [print "works"] line in a 
seperate file.. ie  process.r ,and do it like this.. 

on-received: func [data][
raw-input: copy to-string data 
do %./process.r
]


It doesn't work.. In fact, it seems difficult to put global functions 
that are truly global, anywhere.
Terry:
4-Feb-2006
Probably on the same note, it's hard to encap Uniserve, given the 
folder structure and the way services are loaded etc.
Graham:
4-Feb-2006
and change your process.r script to look at the arguments.
Terry:
4-Feb-2006
So simply put.. how can I process an incoming message using an external 
page of code, and be able to respond from that page?  

I may need to create an "OUTPUT" value (the response) and then use 
the 'write-client' function once Im back in the service ON-RECEIVED 
function?
Terry:
4-Feb-2006
Ok.. so now I can run the external script by placing waiting till 
i finsh the external, and get back to the 'on-received' function... 
but I have a number of functions that I use to process my external 
script.. 
Do I need to load those functions with every on-received event???
Terry:
4-Feb-2006
For example:  
If I place this function just after the "install-service [ "

testFunk: func [it][print it]


and if at anytime i DO an external script that uses that function, 
it doesn't work
Terry:
5-Feb-2006
Here's an example.. prototype ( a javascript framework uses prototype.js 
 and that file uses includes to add other JS files.. like this.. 

<%= include 'ajax.js', 'dom.js', 'form.js', 'event.js', 'position.js' 
%>

the problem seems to be here somewhere?
Terry:
10-Apr-2006
It was offline.. it's back, and updated too.
Philippe:
10-May-2006
Doc, when will you release a beta of Cheyenne and a new version of 
Uniserve ?
Dockimbel:
13-May-2006
:-). I could release a new Uniserve version, but there's no much 
new protocols added yet. Uniserve also deserves some better docs. 
Cheyenne is still under development, my priority is to finish it 
asap. I'll release a beta as soon as I have a stable and almost feature-complete 
version. Cheyenne is meant to be a end-user product, so it needs 
some polishing and enhancement before giving it to users.
Dockimbel:
13-May-2006
Basically yes, but with the RSP module, it becomes a fast and flexible 
web application framework !
Louis:
13-May-2006
If this list doesn't fulfill all your needs, here's the additionnal 
features planned for the 1.0 release :

    * RSP: REBOL Server Pages support.
    * General CGI support (run any CGI script).

    * Chunk-encoding transferts support (streamed data transferts).
    * Standard compression methods support: gzip, deflate, bzip2.

    * Byte-ranges request support (ability to request files in parts 
    and resume broken downloads).

    * mod-rewrite module for powerful request URL transformations (without 
    the regexp complexity!).

    * mod-map-url module for direct URL to REBOL functions or objects 
    mapping.
    * SSL support.
    * Advanced GUI client for local and remote administration.
Dockimbel:
13-May-2006
Not yet, I can only work on Cheyenne and other REBOL projects on 
my spare time, I'm currently almost full time on a big project for 
a customer (until end of july). I expect to make a first beta release 
of Cheyenne before that.
Will:
31-Aug-2006
Mike, I started using Apache and rebol as cgi, this is not suited 
for performances as on every call to the cgi, a new instance of rebol 
is  initialized, run and closed.

I thought about using fastcgi, but never came to a working solution.
Now I use uniserve as main webserver, here some advantages:

-it is fast! On my local machine I get +- 600 req/sec for static 
pages and a max of 160req/sec for dynamic rsp pages

-it is written in rebol, I could easly(less than 10 lines code) add 
a rewrite engine

-child process are persistent, this mean you can keep state of your 
web applications, implement caching, keep a pool of connection to 
databases open (in apache + rebol/cgi you'd have to open and close 
the connection for every request)
-it is written by Dock whom I may be the biggest fan ;-)

btw I'm running an unreleased version (have bought commercial support) 
 that support http 1.1, stuff like If-Modified etc..

If you have more specific questions, I'll be glad to try and answer.
MikeL:
31-Aug-2006
Thanks Will.   I would like to see how to put together a simple web 
form application that posts to a Uniserve script and provides an 
acceptance message.  When I looked at Uniserve I couldn't see how 
this simple thing could be done and how / which services to use. 
  Do you have a "Hello World" level example that follows that post/reply 
approach?
MikeL:
1-Sep-2006
When I can get that simple part working then I want to add Make-Doc, 
my-sql-protocol and Andrew's ML dialect as services so I can get 
some leverage from these.
Graham:
1-Sep-2006
I'm using Cheyenne with RSP, and Firebird.
Will:
1-Sep-2006
Mike, her you can find latest released uniserve and there is also 
the NTLM:
http://softinnov.org/
Will:
1-Sep-2006
and if you want to test for speed, you can ab (apache benchmark) 
http://wwd.francobianchi.ch/words.cgi;-)
MikeL:
1-Sep-2006
Thanks Will - I have uniserve running and can serve up static webpages 
and the sample cgi that Doc provided. How do I allow RSP or ML to 
be loaded so that a page that uses them does not have to run as CGI 
and flag .rsp or .rhtml files as handled by RSP.
Oldes:
1-Sep-2006
Found a way - to modify on-received function in the task-master to 
send the task port with data to the service using on-task-done and 
than closing the task if needed from the service:-) If there is some 
other way how it should be done, let me know.
Oldes:
1-Sep-2006
Yes, I like it. I already transfered my MicroChat server to Uniserve 
kernel and Irc bot as well:-)
Oldes:
1-Sep-2006
Why, it's good as it is and who knows how will look ports in R3
Dockimbel:
4-Sep-2006
I have a much more recent version of UniServe almost ready to release, 
but docs are not updated and some of the protocols are still alpha. 
But with the current interest in UniServe, I'm thinking about releasing 
a beta version here this week.
Oldes:
4-Sep-2006
You can move the yellow boxes:-) and all you say is visible here 
as well - http://www.informacezbrna.cz/
Group: SVG Renderer ... SVG rendering in Draw AGG [web-public]
shadwolf:
23-Jun-2005
My actual source code that render path and <g> bloack transformation 
matrix
shadwolf:
23-Jun-2005
REBOL [
	Title:		"SVG Demo"
	Owner:		"Ashley G. Trüter"
	Version:	0.0.1
	Date:		21-Jun-2005
	Purpose:	"Loads and displays a resizeable SVG file."
	History: {
		0.0.1	Initial release
	}
	Notes: {
		Tested on very simple SVG icons
		Only a few basic styles / attributes / commands supported

  Does not handle sizes in units other than pixels (e.g. pt, in, cm, 
  mm, etc)

  SVG path has an optional close command, "z" ... AGG shape equivalent 
  auto-closes

  load-svg function needs to be totally refactored / optimized ... 
  *sample only*
	}
]

;	The following commands are available for path data:
;
;		M = moveto
;		L = lineto
;		H = horizontal lineto
;		V = vertical lineto
;		C = curveto
;		S = smooth curveto
;		Q = quadratic Belzier curve
;		T = smooth quadratic Belzier curveto
;		A = elliptical Arc
;		Z = closepath

;print: none	; comment out this line to enable debug messages

load-svg: function [svg-file [file! string!] size [pair!]] [

 id defs x y to-color to-byte draw-blk append-style svg-size scale-x 
 scale-y
][
	xml: either string? svg-file [parse-xml svg-file] [

  unless %.svg = suffix? svg-file [to error! "File has an invalid suffix!"]
		parse-xml read svg-file
	]

 unless xml/3/1/1 = "svg" [to error! "Could not find SVG header!"]

 ;unless find ["id" "xmlns"] xml/3/1/2/1 [to error! "Could not find 
 ID header!"]

 ;unless xml/3/1/3/1/1 = "defs" [to error! "Could not find DEFS header!"]

	id: xml/3/1/2
	defs: xml/3/1/3


	;
	;	--- Parse SVG id
	;

	svg-size: either find ["32pt" "48pt" "72pt"] select id "width" [
		switch select id "width" [
			"72pt"	[120x120]
			"48pt"	[80x80]
			"32pt"	[60x60]
		]
	][

  as-pair to integer! any [select id "width" "100"] to integer! any 
  [select id "height" "100"]
	]

	x: to integer! any [select id "x" "0"]
	y: to integer! any [select id "y" "0"]

	scale-x: size/x / svg-size/x
	scale-y: size/y / svg-size/y

	;
	;	--- Helper functions
	;


 to-color: func [s [string!]] [	; converts a string in the form "#FFFFFF" 
 to a 4-byte tuple
		to tuple! load rejoin ["#{" next s "00}"]
	]


 to-byte: func [s [string!]] [	; converts a string with a value 0-1 
 to an inverted byte
		255 - to integer! 255 * to decimal! s
	]

	;
	;	--- Parse SVG defs
	;

	draw-blk: copy []

	append-style: function [
		command [string!] blk [block!]
	][
		x xy pen-color fill-color line-width mode size radius shape
		closed? matrix transf-command
	][
		xy: 0x0
		size: 0x0
		line-width: 1
		matrice: make block! []
		radius: none
		transf-command: none
		
		
		foreach [attr val] blk [
			switch attr [
				"transform" [print "tranform have been found" 
						;probe val halt 
						val: parse val "(),"
						transf-command: first val
						probe transf-command
						switch transf-command [
							"matrix" [ 
								foreach word val [
									if not find word "matrix"
									[ 
										insert tail matrice to-decimal word
									]
								]
							
							]
						]
				]
				"style" [
					foreach [attr val] parse val ":;" [
						switch/default attr [
						
							"font-size" [ ]
							"stroke" [
								switch/default first val [
									#"#" [pen-color: to-color val]
									#"n" [pen-color: none]
								][
									print ["Unknown stroke:" val]
								]
							]
							"stroke-width" [line-width: to decimal! val]
							"fill" [
								fill-color: switch/default first val [
									#"#" [to-color val]
									#"n" [none]
								][
									print ["Unknown fill value:" val]
									none
								]
							]
							"fill-rule" [
								mode: switch/default val [
									"evenodd"	['even-odd]
								][
									print ["Unknown fill-rule value:" val]
									none
								]
							]

       "stroke-opacity" [pen-color: any [pen-color 0.0.0.0] pen-color/4: 
       to-byte val]

       "fill-opacity" [fill-color: any [fill-color 0.0.0.0] fill-color/4: 
       to-byte val]
							"stroke-linejoin" [
								insert tail draw-blk switch/default val [
									"miter"		[compose [line-join miter]]
									"round"		[compose [line-join round]]
									"bevel"		[compose [line-join bevel]]
								][
									print ["Unknown stroke-linejoin value:" val]
									none
								]
							]
							"stroke-linecap" [
								insert tail draw-blk 'line-cap
								insert tail draw-blk to word! val
							]
						][
							print ["Unknown style:" attr]
						]
					]
				]
				"x"			[xy/x: scale-x * val]
				"y"			[xy/y: scale-y * val]
				"width"		[size/x: scale-x * val]
				"height"	[size/y: scale-y * val]
				"rx"		[print "rx"]
				"ry"		[radius: to decimal! val]
				"d"	[
					shape: copy []
					x: none
					closed?: false
					foreach token load val [
						switch/default token [
							M	[insert tail shape 'move]
							C	[insert tail shape 'curve]
							L	[insert tail shape 'line]
							z	[closed?: true]
						][

       unless number? token [print ["Unknown path command:" token]]

       either x [insert tail shape as-pair x scale-y * token x: none] [x: 
       scale-x * token]
						]
					]
				]
			]
		]
		insert tail draw-blk compose [
			pen (pen-color)
			fill-pen (fill-color)
			fill-rule (mode)
			line-width (line-width * min scale-x scale-y)
		]
		switch command [
			"rect" [
				insert tail draw-blk compose [box (xy) (xy + size)]
				if radius [insert tail draw-blk radius]
			]
			"path" [
				unless closed? [print "Path closed"]
				either transf-command <> none  [
					switch transf-command [

      "matrix" [insert tail draw-blk compose/only [ (to-word transf-command) 
      (matrice) shape (shape) reset-matrix]]
					]
				][
					insert tail draw-blk compose/only [shape (shape)]
			 	]
				]

   "g" [ print "Write here how to handle G insertion to Draw block" 

    insert tail draw-blk probe compose/only [reset-matrix (to-word transf-command) 
    (matrice)]
				
				]
			]
	]	
  
	probe defs
	foreach blk defs [
		switch first blk [
			"rect"	[append-style first blk second blk]
			"path"	[append-style first blk second blk]
			"g"		[
						print "key word" probe first blk  
						print "matrix and style in G" probe second blk  
						append-style first blk second blk 
						;print "what to draw in G" probe third blk
						foreach blk2 third blk [
							probe blk2
							switch first blk2[ 
								"path" [append-style first blk2 second blk2]
							]
						]
					]
		]
	]
	
	
probe draw-blk
	draw-blk
]

view make face [
	offset:	100x100
	size:	200x200
	action:	request-file/filter/only "*.svg"
	text:	rejoin ["SVG Demo [" last split-path action "]"]
	data:	read action
	color:	white
	effect:	compose/only [draw (load-svg data size)]
	edge: font: para: none
	feel: make feel [
		detect: func [face event] [
			if event/type = 'resize [
				insert clear face/effect/draw load-svg face/data face/size
				show face
			]
			if event/type = 'close [quit]
		]
	]
	options: [resize]
]
shadwolf:
23-Jun-2005
REBOL [
	Title:		"SVG Demo"
	Owner:		"Ashley G. Trüter"
	Version:	0.0.1
	Date:		21-Jun-2005
	Purpose:	"Loads and displays a resizeable SVG file."
	History: {
		0.0.1	Initial release
	}
	Notes: {
		Tested on very simple SVG icons
		Only a few basic styles / attributes / commands supported

  Does not handle sizes in units other than pixels (e.g. pt, in, cm, 
  mm, etc)

  SVG path has an optional close command, "z" ... AGG shape equivalent 
  auto-closes

  load-svg function needs to be totally refactored / optimized ... 
  *sample only*
	}
]

;	The following commands are available for path data:
;
;		M = moveto
;		L = lineto
;		H = horizontal lineto
;		V = vertical lineto
;		C = curveto
;		S = smooth curveto
;		Q = quadratic Belzier curve
;		T = smooth quadratic Belzier curveto
;		A = elliptical Arc
;		Z = closepath

;print: none	; comment out this line to enable debug messages

load-svg: function [svg-file [file! string!] size [pair!]] [

 id defs x y to-color to-byte draw-blk append-style svg-size scale-x 
 scale-y
][
	xml: either string? svg-file [parse-xml svg-file] [

  unless %.svg = suffix? svg-file [to error! "File has an invalid suffix!"]
		parse-xml read svg-file
	]

 unless xml/3/1/1 = "svg" [to error! "Could not find SVG header!"]

 ;unless find ["id" "xmlns"] xml/3/1/2/1 [to error! "Could not find 
 ID header!"]

 ;unless xml/3/1/3/1/1 = "defs" [to error! "Could not find DEFS header!"]

	id: xml/3/1/2
	defs: xml/3/1/3


	;
	;	--- Parse SVG id
	;

	svg-size: either find ["32pt" "48pt" "72pt"] select id "width" [
		switch select id "width" [
			"72pt"	[120x120]
			"48pt"	[80x80]
			"32pt"	[60x60]
		]
	][

  as-pair to integer! any [select id "width" "100"] to integer! any 
  [select id "height" "100"]
	]

	x: to integer! any [select id "x" "0"]
	y: to integer! any [select id "y" "0"]

	scale-x: size/x / svg-size/x
	scale-y: size/y / svg-size/y

	;
	;	--- Helper functions
	;


 to-color: func [s [string!]] [	; converts a string in the form "#FFFFFF" 
 to a 4-byte tuple
		to tuple! load rejoin ["#{" next s "00}"]
	]


 to-byte: func [s [string!]] [	; converts a string with a value 0-1 
 to an inverted byte
		255 - to integer! 255 * to decimal! s
	]

	;
	;	--- Parse SVG defs
	;

	draw-blk: copy []

	append-style: function [
		command [string!] blk [block!]
	][
		x xy pen-color fill-color line-width mode size radius shape
		closed? matrix transf-command
	][
		xy: 0x0
		size: 0x0
		line-width: 1
		matrice: make block! []
		radius: none
		transf-command: none
		
		
		foreach [attr val] blk [
			switch attr [
				"transform" [print "tranform have been found" 
						;probe val halt 
						val: parse val "(),"
						transf-command: first val
						probe transf-command
						switch transf-command [
							"matrix" [ 
								foreach word val [
									if not find word "matrix"
									[ 
										insert tail matrice to-decimal word
									]
								]
							
							]
						]
				]
				"style" [
					foreach [attr val] parse val ":;" [
						switch/default attr [
						
							"font-size" [ ]
							"stroke" [
								switch/default first val [
									#"#" [pen-color: to-color val]
									#"n" [pen-color: none]
								][
									print ["Unknown stroke:" val]
								]
							]
							"stroke-width" [line-width: to decimal! val]
							"fill" [
								fill-color: switch/default first val [
									#"#" [to-color val]
									#"n" [none]
								][
									print ["Unknown fill value:" val]
									none
								]
							]
							"fill-rule" [
								mode: switch/default val [
									"evenodd"	['even-odd]
								][
									print ["Unknown fill-rule value:" val]
									none
								]
							]

       "stroke-opacity" [pen-color: any [pen-color 0.0.0.0] pen-color/4: 
       to-byte val]

       "fill-opacity" [fill-color: any [fill-color 0.0.0.0] fill-color/4: 
       to-byte val]
							"stroke-linejoin" [
								insert tail draw-blk switch/default val [
									"miter"		[compose [line-join miter]]
									"round"		[compose [line-join round]]
									"bevel"		[compose [line-join bevel]]
								][
									print ["Unknown stroke-linejoin value:" val]
									none
								]
							]
							"stroke-linecap" [
								insert tail draw-blk 'line-cap
								insert tail draw-blk to word! val
							]
						][
							print ["Unknown style:" attr]
						]
					]
				]
				"x"			[xy/x: scale-x * val]
				"y"			[xy/y: scale-y * val]
				"width"		[size/x: scale-x * val]
				"height"	[size/y: scale-y * val]
				"rx"		[print "rx"]
				"ry"		[radius: to decimal! val]
				"d"	[
					shape: copy []
					x: none
					closed?: false
					foreach token load val [
						switch/default token [
							M	[insert tail shape 'move]
							C	[insert tail shape 'curve]
							S   [insert tail shape 'curv]
							L	[insert tail shape 'line]
							Q   [insert tail shape 'qcurve]
							T   [insert tail shape 'qcurv]
							z	[closed?: true]
							H   [insert tail shape 'hline]
							V   [insert tail shape 'vline]
							A   [insert tail shape 'arc]
						][

       unless number? token [print ["Unknown path command:" token]]

       either x [insert tail shape as-pair x scale-y * token x: none] [x: 
       scale-x * token]
						]
					]
				]
			]
		]
		insert tail draw-blk compose [
			pen (pen-color)
			fill-pen (fill-color)
			fill-rule (mode)
			line-width (line-width * min scale-x scale-y)
		]
		switch command [
			"rect" [
				insert tail draw-blk compose [box (xy) (xy + size)]
				if radius [insert tail draw-blk radius]
			]
			"path" [
				unless closed? [print "Path closed"]
				either transf-command <> none  [
					switch transf-command [

      "matrix" [insert tail draw-blk compose/only [ (to-word transf-command) 
      (matrice) shape (shape) reset-matrix]]
					]
				][
					insert tail draw-blk compose/only [shape (shape)]
			 	]
				]

   "g" [ print "Write here how to handle G insertion to Draw block" 

    insert tail draw-blk probe compose/only [reset-matrix (to-word transf-command) 
    (matrice)]
				
				]
			]
	]	
  
	probe defs
	foreach blk defs [
		switch first blk [
			"rect"	[append-style first blk second blk]
			"path"	[append-style first blk second blk]
			"g"		[
						print "key word" probe first blk  
						print "matrix and style in G" probe second blk  
						append-style first blk second blk 
						;print "what to draw in G" probe third blk
						foreach blk2 third blk [
							probe blk2
							switch first blk2[ 
								"path" [append-style first blk2 second blk2]
							]
						]
					]
		]
	]
	
	
probe draw-blk
	draw-blk
]

view make face [
	offset:	100x100
	size:	200x200
	action:	request-file/filter/only "*.svg"
	text:	rejoin ["SVG Demo [" last split-path action "]"]
	data:	read action
	color:	white
	effect:	compose/only [draw (load-svg data size)]
	edge: font: para: none
	feel: make feel [
		detect: func [face event] [
			if event/type = 'resize [
				insert clear face/effect/draw load-svg face/data face/size
				show face
			]
			if event/type = 'close [quit]
		]
	]
	options: [resize]
]
shadwolf:
23-Jun-2005
REBOL [
	Title:		"SVG Demo"
	Owner:		"Ashley G. Trüter"
	Version:	0.0.1
	Date:		21-Jun-2005
	Purpose:	"Loads and displays a resizeable SVG file."
	History: {
		0.0.1	Initial release
	}
	Notes: {
		Tested on very simple SVG icons
		Only a few basic styles / attributes / commands supported

  Does not handle sizes in units other than pixels (e.g. pt, in, cm, 
  mm, etc)

  SVG path has an optional close command, "z" ... AGG shape equivalent 
  auto-closes

  load-svg function needs to be totally refactored / optimized ... 
  *sample only*
	}
]

;	The following commands are available for path data:
;
;		M = moveto
;		L = lineto
;		H = horizontal lineto
;		V = vertical lineto
;		C = curveto
;		S = smooth curveto
;		Q = quadratic Belzier curve
;		T = smooth quadratic Belzier curveto
;		A = elliptical Arc
;		Z = closepath

;print: none	; comment out this line to enable debug messages

load-svg: function [svg-file [file! string!] size [pair!]] [

 id defs x y to-color to-byte draw-blk append-style svg-size scale-x 
 scale-y
][
	xml: either string? svg-file [parse-xml svg-file] [

  unless %.svg = suffix? svg-file [to error! "File has an invalid suffix!"]
		parse-xml read svg-file
	]

 unless xml/3/1/1 = "svg" [to error! "Could not find SVG header!"]

 ;unless find ["id" "xmlns"] xml/3/1/2/1 [to error! "Could not find 
 ID header!"]

 ;unless xml/3/1/3/1/1 = "defs" [to error! "Could not find DEFS header!"]

	id: xml/3/1/2
	defs: xml/3/1/3


	;
	;	--- Parse SVG id
	;

	svg-size: either find ["32pt" "48pt" "72pt"] select id "width" [
		switch select id "width" [
			"72pt"	[120x120]
			"48pt"	[80x80]
			"32pt"	[60x60]
		]
	][

  as-pair to integer! any [select id "width" "100"] to integer! any 
  [select id "height" "100"]
	]

	x: to integer! any [select id "x" "0"]
	y: to integer! any [select id "y" "0"]

	scale-x: size/x / svg-size/x
	scale-y: size/y / svg-size/y

	;
	;	--- Helper functions
	;


 to-color: func [s [string!]] [	; converts a string in the form "#FFFFFF" 
 to a 4-byte tuple
		to tuple! load rejoin ["#{" next s "00}"]
	]


 to-byte: func [s [string!]] [	; converts a string with a value 0-1 
 to an inverted byte
		255 - to integer! 255 * to decimal! s
	]

	;
	;	--- Parse SVG defs
	;

	draw-blk: copy []

	append-style: function [
		command [string!] blk [block!]
	][
		x xy pen-color fill-color line-width mode size radius shape
		closed? matrix transf-command
	][
		xy: 0x0
		size: 0x0
		line-width: 1
		matrice: make block! []
		radius: none
		transf-command: none
		
		
		foreach [attr val] blk [
			switch attr [
				"transform" [print "tranform have been found" 
						;probe val halt 
						val: parse val "(),"
						transf-command: first val
						probe transf-command
						switch transf-command [
							"matrix" [ 
								foreach word val [
									if not find word "matrix"
									[ 
										insert tail matrice to-decimal word
									]
								]
							
							]
						]
				]
				"style" [
					foreach [attr val] parse val ":;" [
						switch/default attr [
						
							"font-size" [ ]
							"stroke" [
								switch/default first val [
									#"#" [pen-color: to-color val]
									#"n" [pen-color: none]
								][
									print ["Unknown stroke:" val]
								]
							]
							"stroke-width" [line-width: to decimal! val]
							"fill" [
								fill-color: switch/default first val [
									#"#" [to-color val]
									#"n" [none]
								][
									print ["Unknown fill value:" val]
									none
								]
							]
							"fill-rule" [
								mode: switch/default val [
									"evenodd"	['even-odd]
								][
									print ["Unknown fill-rule value:" val]
									none
								]
							]

       "stroke-opacity" [pen-color: any [pen-color 0.0.0.0] pen-color/4: 
       to-byte val]

       "fill-opacity" [fill-color: any [fill-color 0.0.0.0] fill-color/4: 
       to-byte val]
							"stroke-linejoin" [
								insert tail draw-blk switch/default val [
									"miter"		[compose [line-join miter]]
									"round"		[compose [line-join round]]
									"bevel"		[compose [line-join bevel]]
								][
									print ["Unknown stroke-linejoin value:" val]
									none
								]
							]
							"stroke-linecap" [
								insert tail draw-blk 'line-cap
								insert tail draw-blk to word! val
							]
						][
							print ["Unknown style:" attr]
						]
					]
				]
				"x"			[xy/x: scale-x * val]
				"y"			[xy/y: scale-y * val]
				"width"		[size/x: scale-x * val]
				"height"	[size/y: scale-y * val]
				"rx"		[print "rx"]
				"ry"		[radius: to decimal! val]
				"d"	[
					shape: copy []
					x: none
					closed?: false
					if all [x not number? token] [

          insert tail shape x * either token = 'V [scale-y][scale-x]
  						    x: none
					]
					foreach token load val [
						switch/default token [
							M	[insert tail shape 'move]
							C	[insert tail shape 'curve]
							S   [insert tail shape 'curv]
							L	[insert tail shape 'line]
							Q   [insert tail shape 'qcurve]
							T   [insert tail shape 'qcurv]
							z	[closed?: true]
							H   [insert tail shape 'hline]
							V   [insert tail shape 'vline]
							A   [insert tail shape 'arc]
						][

       unless number? token [print ["Unknown path command:" token]]

       either x [insert tail shape as-pair x scale-y * token x: none] [x: 
       scale-x * token]
						]
					]
				]
			]
		]
		insert tail draw-blk compose [
			pen (pen-color)
			fill-pen (fill-color)
			fill-rule (mode)
			line-width (line-width * min scale-x scale-y)
		]
		switch command [
			"rect" [
				insert tail draw-blk compose [box (xy) (xy + size)]
				if radius [insert tail draw-blk radius]
			]
			"path" [
				unless closed? [print "Path closed"]
				either transf-command <> none  [
					switch transf-command [

      "matrix" [insert tail draw-blk compose/only [ (to-word transf-command) 
      (matrice) shape (shape) reset-matrix]]
					]
				][
					insert tail draw-blk compose/only [shape (shape)]
			 	]
				]

   "g" [ print "Write here how to handle G insertion to Draw block" 

    insert tail draw-blk probe compose/only [reset-matrix (to-word transf-command) 
    (matrice)]
				
				]
			]
	]	
  
	probe defs
	foreach blk defs [
		switch first blk [
			"rect"	[append-style first blk second blk]
			"path"	[append-style first blk second blk]
			"g"		[
						print "key word" probe first blk  
						print "matrix and style in G" probe second blk  
						append-style first blk second blk 
						;print "what to draw in G" probe third blk
						foreach blk2 third blk [
							probe blk2
							switch first blk2[ 
								"path" [append-style first blk2 second blk2]
							]
						]
					]
		]
	]
	
	
probe draw-blk
	draw-blk
]

view make face [
	offset:	100x100
	size:	200x200
	action:	request-file/filter/only "*.svg"
	text:	rejoin ["SVG Demo [" last split-path action "]"]
	data:	read action
	color:	white
	effect:	compose/only [draw (load-svg data size)]
	edge: font: para: none
	feel: make feel [
		detect: func [face event] [
			if event/type = 'resize [
				insert clear face/effect/draw load-svg face/data face/size
				show face
			]
			if event/type = 'close [quit]
		]
	]
	options: [resize]
]
shadwolf:
23-Jun-2005
so my version of the script supports in the SVG <g> block with in 
this block header   transform matrix and in block <G> path with or 
without in it tranform matrix. I have a little problem with this 
point. Then I add the support for path d field coded in the format 
of INKSCAPE SVG PLAIN TEXT (the SVG light weight version available 
under inkscape )
shadwolf:
23-Jun-2005
New D field for "path" flag  processing and translation made by Vincent
Ashley:
23-Jun-2005
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
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
shadwolf:
23-Jun-2005
matrix intervention of cyphre could be very educationnal and help 
me a lot to see what I'm messing in my code
shadwolf:
24-Jun-2005
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
shadwolf:
24-Jun-2005
and I have some asks
shadwolf:
24-Jun-2005
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
shadwolf:
26-Jun-2005
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  :)
shadwolf:
26-Jun-2005
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
Ashley:
26-Jun-2005
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
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
shadwolf:
29-Jun-2005
this in the goal to improve drastically the performance and be more 
performant  on some key issues like recursivity etc...
shadwolf:
30-Jun-2005
and fill the draw block with this data
shadwolf:
30-Jun-2005
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
shadwolf:
30-Jun-2005
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
shadwolf:
30-Jun-2005
and the windows where the draw block is shown
shadwolf:
2-Jul-2005
this script support recursive G block (objects /list) and path (object 
list)
shadwolf:
2-Jul-2005
what is not supported are radial / linear Gradient (content and border), 
transformations (local/global I'm still pending for informations 
on it) and all other shapes than path  (like rect  for example)
Ashley:
2-Jul-2005
I've spent quite a bit of time looking at Inkscape (http://www.inkscape.org/) 
and it seems to be the only / best SVG game in town (their command-line 
driven SVG to PNG conversion seems to be particularly well regarded). 
Looking forward to their 0.42 release as it supports OS/X as well.


The Clip Art site that they link to (http://www.openclipart.org/) 
is also a treasure trove of Public Domain files (which solves the 
GPL concerns I had with many of the dedicated KDE / Gnome icon sets). 
I'm also looking forward to their release 15 which seems to be just 
around the corner.


Lots of good news in the SVG world, I wonder how long before mainstream 
browsers start supporting it? (without plugins).
shadwolf:
2-Jul-2005
Inkscape is the successor project of sodipodi (for example you can 
see reference to sodipodi into teh SVG output files ...) Sodipodi 
was abandonned by the dev team so some of them retakes it and continue 
the adventure with inkscape
shadwolf:
2-Jul-2005
I like particularly the capability of generating light weight SVG 
files (plein text) the drawing tools are simple powerfull very well 
thinked and pretty good
shadwolf:
2-Jul-2005
Handling SVG as REBOL object! tree makes it really really easier 
to set recursivity and code writing ( as all can be exploded into 
small fonctions I hope the resulting code once terminated won't be 
so deficult to read
shadwolf:
2-Jul-2005
but you know now my way to work I prefer easy and powerfull /flexible 
code than hudge monolitic code ;)
shadwolf:
2-Jul-2005
maybe they saw a boggus open door in this plugin and disable it's 
support (this can be the case for a 1.0.4)
shadwolf:
2-Jul-2005
so you have to remaining choice (3 in fact ) 1) using IE  but then 
your not my pal any more, 2) installing Inkscape and relate it to 
svg file 3) help me finishing the SVG viewer using REBOL !!! ;))
shadwolf:
2-Jul-2005
but what I need are high level information and formation on draw 
agg and this I know very little people that can respond in this point 
 :)
shadwolf:
2-Jul-2005
this could be a good promotion point to insert SVG rendering into 
the rebplug for firefox once it's completed and optimised ;)
shadwolf:
2-Jul-2005
my actual code is about  587 lines of code and it's not ended
shadwolf:
2-Jul-2005
still lot of work on it gradients  and transform handling can be 
very code consummer
shadwolf:
2-Jul-2005
I improve some more the rendering now the file gnome-keyboard-dev.svg 
is fully and perfectly rendererd. I put a red pen-fill color for 
identify all primitives that needs fill:url related gradient
shadwolf:
11-Jul-2005
and I'm close to have found a solution to one of my problems regarding 
to the transformation matrix
shadwolf:
22-Jul-2005
Features still on the work table are:
- SVG Transformation translation (mostly matrix)
- SVG Gradient translation (linear partern radiant)

- SVG drawing primitives (some drawing primitives are not supported 
actually ) 

- SVG Animation translation (don't know if this is a usefull and 
suitable fonctionnality tellme what do you think about it)
shadwolf:
1-Jan-2006
For ppl interrested in  SVG rendering engine. My  tonight work  and 
 test on the engine   is resumed in the AGG topic. To resume before 
matrix bug as causing bad scale and bad position.  Now we have good 
position but still bad scale  i post screen cap samples and we can 
see that the evolution is good  betwin View 1.3.1 and 1.3.2
shadwolf:
1-Jan-2006
transform problem are on their way to be solve gradient too by cyphre 
and  Carl those  two things are the most blockant problems until 
they are not completly solved we can't expect to have a full working 
SVG rendering engine  -> most of SVG  imagines use transform effects 
and gradients this means    that if we want to get a pretty good 
and reliable SVG engine we have to fixe those two issue. SVR rendering 
engine is a good and hudge test upon AGG integration to REBOL/View 
and it allows us to embetter it !!! 


Once we get a fully working engine with basic human understandable 
algorithm i will start the  optimisation process using  parse (but 
to be franck i don't  know how parse will react in front svg row 
data or how will be the time to dev this parse based SVG engine ... 
 in all cases I think the actual engine have teached me a lot arrounf 
the SVG to AGG adaptation process so i hope the translation to parse 
and parse/rules will not be too hard and too long)
shadwolf:
1-Jan-2006
well last thing i can say is that SVG rendering  engine is very high 
on my task  list ( task number one) i worked on the adding of some 
other new drawing primitive  (image rect, circles). I will continue 
to  work on the close support of all SVG datas that can have a meaning 
in AGG context. SVG rendering engine is  a   2   weeks of work only!!! 
... until i fall on the gradient and transforms problems so this 
ensure us advancing on this project will be very fast once we solve 
bugs in REBOL/View related to AGG (wich is in progress actually)
shadwolf:
2-Jan-2006
ty ashley   ^^ time i wasn't giving notice of my progress but mainly 
because Gradeint and transform problem where dependent on AGG an 
not on my  script.
shadwolf:
2-Jan-2006
for me to be honnest the advantages of  using SVG instead of images 
 are a lot this is a quick list of my thoughts on what can be done 
with  SVG format.
 - easier embeding of graphical content
- resizing auto ith not grphics quality loss
- cheap but sharp skining 

 - graphical content of an  User  Interface  very low because rebol 
 is pretty able to  work with compression of text content ( compress/decompress)

A little sample to enlight this  compressed SVG file with blender 
logo ->  less than 500 octets (any size can be applyed with no graphic 
loss (aliasing, color loose, blur, pixelisation etc..) )  a fixed 
jped for same content will use  around  50ko. This means less datas 
in memory to as graphic pixel tables are very heavy in VM memory

- Dynamic graphical content. some thing like text scrolling or efffect 
like Flash ones but with  a  reduction of  1000  of the data and 
memory use SVG use a labeling system for  each graphical content 
that compose the image we can provided a tiny system to handle easy 
animation and show/hide of graphical content using raw rebol commands 
-> this will make pretty easier the realisation of dynamic animations 
in rebol ViD content and  as any REBOL/View face is DRaw/AGG capable 
the effects that we can create isn the futur with this idea will 
have no limits  -> this means too to have a pretty fast and ell designed 
SVG engine (that's my actual path on research)
Ashley:
2-Jan-2006
One other big advantage is that there is a lot of high-quality SVG 
in the public domain, and it's growing fast.
shadwolf:
24-Jan-2006
surfing around on internet i found another common application for 
SVG -> graphs representation. The idea is inspired by  a ruby project 
http://www.germane-software.com/software/SVG/SVG::Graph/#N10034. 
To do this in rebol we need teh ability to save data in an image 
PNG. The way we can use a thing like this could be to use a simple 
rebol draw based dialect to write  the graphs if we are in REBOL/view 
application the  graph is isealy shown if we need to show the  graph 
in webrowser we can have  2  external sources SVG  and PNG.  For 
importing graphs from another application the SVG is the best way. 
 So our REBOL::SVG::GRAPH would be able to import graphi content 
from a SVG file, output SVG and PNG files, render graphs to REBOL/view 
draw pane, propose a simple way to implement graphs  using a rebol 
dialect.
shadwolf:
1-Feb-2006
if some one is interressed to make it and need informations i'm ready 
to help  ^^
shadwolf:
1-Feb-2006
as svg or as png in a simple and easy way
shadwolf:
1-Feb-2006
you have that in php and in ruby or php for example why not rebol 
starting from the point that rebol dialectal ability is incredible 
it's a pitty to not take advantage of it  and show ppl hat rebol 
can apport on this particular application and this gives a good way 
to compare rebol to the other scripting language
Pekr:
20-Jun-2006
would following news help us to get AGG - SVG compatible gradients? 
It regards AGG 2.4, new branch of AGG, and I am sure we will get 
it ported to REBOL too ...


New utility class template is added, gradient_lut. It allows you 
to easily create a color LUT for gradients from a set of color stops 
as they are defined in SVG, section Gradients and Patterns.
Normand:
1-Jul-2006
If any person is interested in developping graphs in Rebol they may 
find the following links of interest: www.combinatorica.com which 
have the source code in mathematica for calculating graphs and depicting 
them.  There is also the C library at www.graphviz.org and the many 
little languages drivers.
shadwolf:
10-Nov-2006
okay  thank you for the  link  in my  idea  my  SVG/REBOL graph render 
should be easy to  use and render basical graphs  using  a psecial 
graph dialect  but  ofcourse it  will be enhanced afterward...
8401 / 4860612345...8384[85] 8687...483484485486487