• 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
r4wp8
r3wp193
total:201

results window for this page: [start: 1 end: 100]

world-name: r4wp

Group: #Red ... Red language group [web-public]
kensingleton:
16-Nov-2012
As someone who is at say level 5 on the btiffin rebol scale what 
I am about to suggest may be stupid - if so be gentle :) Could we 
not create a different structure other than a series (an array or 
a matrix etc) that is 0 based and index driven and works like in 
most other languages for those who need that kind of usage?  Or could 
we introduce for series an index manipulation system such as this:s1/index: 
4, add s3/index 2, subtract s2/index 2, inc s3/index, dec s2/index, 
++ s1/index, s1/index: s1/index + off etc.
Gregg:
26-Mar-2013
Clearly. From a testing and coverage perspective, it would be great 
to have a matrix (and an easy way to generate it) to see how complete 
each type is, or make sure you have everything in place when building 
a new type.
DocKimbel:
26-Mar-2013
SAME? is not implemented yet, we need first a matrix of datatypes 
and consider each case one by one, then implement it.
PeterWood:
26-Mar-2013
Yes - Red/docs/generate-reds-api.r just extract docstrings ... but 
it shouldn't be hard to generate the datatype matrix.
PeterWood:
26-Mar-2013
The dataype comparison matrix is on my todo list but I haven't found 
time to start on it yet.
Group: Ann-Reply ... Reply to Announce group [web-public]
Gregg:
23-Mar-2013
Ah, now that I click them--and remember--I get it. My gut said that 
Available Words would give me a matrix with the languages at the 
top and a list of words available in each.
Group: Rebol School ... REBOL School [web-public]
Geomol:
21-Dec-2012
sz: 200x400
img: make image! sz
img/alpha: 255

draw img compose [
	pen none
	fill-pen linear (as-pair 0 sz/y / 2) -50.5 70.5 90.0 1.0 1.0
			45.45.47 9.9.11 108.113.117
	circle (as-pair sz/x - 115 sz/y / 2) 70.5
	fill-pen 1.0.5
	circle (as-pair sz/x - 115 sz/y / 2) 68.5

	reset-matrix

 fill-pen linear (as-pair sz/x - 115 sz/y / 2) -60.5 30.5 45.0 1.0 
 1.0
			161.164.169 161.164.169 89.94.100

 box (as-pair sz/x - 115 - 26 sz/y / 2 - 26) (as-pair sz/x - 115 + 
 26 sz/y / 2 + 26) 10.0
	fill-pen 1.0.5

 box (as-pair sz/x - 115 - 22 sz/y / 2 - 22) (as-pair sz/x - 115 + 
 22 sz/y / 2 + 22) 6.0

	reset-matrix

 fill-pen linear (as-pair 0 sz/y / 2 - 26) -50.5 100.5 90.0 1.0 1.0
			1.0.5.255 200.214.226.224 200.214.226.128
	shape [
		move 154x200
		arc 16x200 68.0 68.0
		arc 154x200 -149.0 68.0
	]
]

view layout [
	backdrop 1.0.5
	image img
]
Group: !REBOL3 ... General discussion about REBOL 3 [web-public]
Cyphre:
22-Jul-2013
Regarding the "origin" of coordinates. IIRC this was discussed many 
times. In the end the decission was to have it the "non scientific" 
way. Also you can always apply transformation matrix in draw dialect 
to have your coordinates as needed.

world-name: r3wp

Group: RAMBO ... The REBOL bug and enhancement database [web-public]
Gregg:
8-Nov-2006
You have to draw the line somewhere. I think we'd have to discuss 
it on a case-by-case basis, because you can't always substitute one 
value for another, e.g. strings, files, and urls. So, even though 
it seems like two any-string! values could be compared safely, that 
might not work in our favor in real life. We could create a matrix 
and examples for duscussion; I'd be hesitant to change it without 
deeper thought.
Group: Core ... Discuss core issues [web-public]
Gregg:
10-Jun-2005
You might also check out Ladislav's matrix functions: http://www.fm.vslib.cz/~ladislav/rebol/#section-6
Group: Script Library ... REBOL.org: Script library and Mailing list archive [web-public]
yeksoon:
19-Jan-2005
eg. the descriptive text of rebol 

--

It's a messaging language ` 'rebel' not 'ree-ball' ` code is data 
and data is code ` CGI? Yes ` 40+ platforms ` only 250K-500K ` console 
or GUI ` Yes, just a single file ` commercial versions = same core 
+ ODBC, SSL, and more - shallow learning curve, amazing depth ` keep 
IT simple ` if you liked "The Matrix"...
--


is lengthy and not focus... it also do not need to be at the top 
of every page...maybe it should go below 'About'
Anton:
10-Feb-2005
By the way, something that I never really liked is the short rebol 
description at the top of rebol.org. "'rebel' not 'ree-ball'" <- 
kind of rude, telling the interested party how to pronounce "rebol" 
before they've even tried it.  "if you liked 'The Matrix'" is kind 
of childish (notwithstanding the fact that I didn't think The Matrix 
was such a great movie).
Sunanda:
15-Dec-2005
Back in February (!), Anton wrote:

<<By the way, something that I never really liked is the short rebol 
description at the top of rebol.org.>>

OLD TEXT: <<It's a messaging language. 'rebel' not 'ree-ball'.

 code is data and data is code. CGI? Yes. 40+ platforms. only 250K-500K.

 console or GUI. Yes, just a single file. commercial versions = same 
 core + ODBC, SSL, and more -

 shallow learning curve, amazing depth. keep IT simple. if you liked 
 "The Matrix"...>>

We may be slow, but we get there:   http://www.rebol.org

The banner text has been updated to ready pretty much what Anton 
suggested.

Thanks Anton!
Group: View ... discuss view related issues [web-public]
Gabriele:
10-Jan-2005
it translates the coordinate space by 2x2 (by changing the tranformation 
matrix)
Gabriele:
10-Jan-2005
so basically it adds 2x2 to each coordinate, until you change the 
matrix again.
Group: PDF-Maker ... discuss Gabriele's pdf-maker [web-public]
Gabriele:
23-Aug-2010
(or you can think of all transformations as matrix multiplications, 
then everything becomes simple :)
Group: AGG ... to discus new Rebol/View with AGG [web-public]
Ryan:
3-Jan-2005
speed & ease of use are very important. Perhaps splitting interface 
into a low level speed way, and the high level easy way would be 
the wisest decision. Matrix is cool, but its not obvious to use to 
those that have yet worked on that level.
Tomc:
22-Feb-2005
will native matrix operations be exposed with AGG?  if so which ones?
Cyphre:
23-Feb-2005
yes,  AGG will support 2D affine transformation matrices. So you 
can apply translation, rotation, scaling and inversion on  the actual 
matrix.
Cyphre:
23-Feb-2005
You will be able to define the matrix content directy using block! 
of 6 values.(this is more for advanced users or useful with some 
kind of vectorial format conversions)
Cyphre:
23-Feb-2005
You will be able to use also matrix stack and PUSH/POP different 
statest of matrix. This will allow nested(hierarchical)  transformations.
Tomc:
23-Feb-2005
so how about matrix multiplication and transpose -- non-graphics 
specialized maths
Pekr:
23-Feb-2005
general matrix operation? I am not sure it belongs to AGG, but we 
asked for it long time ago :-)
shadwolf:
23-Jun-2005
so actually I'm working on <G></G> block  and I yet support in <g> 
block path definition but I need to be able to support the transform 
matrix how can i do this in DRAW AGG ?
Vincent:
23-Jun-2005
shadwolf: there's the 'matrix command for 2x3 matrix in draw/AGG 
: the syntax is
  matrix [a b c d e f]
where the equivalent 3x3 matrix is:
  | a c e |
  | b d f |
  | 0 0 1 |

if I'm correct , "matrix(2.082761,0.529757,-0.491943,1.944909,4.543758,-12.39301)" 
translates to
matrix [2.082761 0.529757 -0.491943 1.944909 4.543758 -12.39301]
shadwolf:
27-Jun-2005
I don't really understand how to use matrix (global ones and local 
ones) I'm try to make a SVG renderer so matrix are some times declared 
first globally for all the content of a group <g></g> and into the 
primitives of those block so how to add the matrix in the AGG code
shadwolf:
27-Jun-2005
for example actually I use push [ matrix [] Matrix [] shape[] reset-matrix 
shape [] shape [] shape [] ] I pass on the declaration of the fill 
pen line width and other settup calls to easier resum what I'm doing 
:)
shadwolf:
27-Jun-2005
So in my mind this means first matrix in the pile is the global one 
second matrix apply to the following shape then reset-matrix disable 
this second matrix for all the remainning shapes that follow this 
reset -matrix call and o they are affected only by the global one.
shadwolf:
27-Jun-2005
but maybe the good implementation is more like this push [matrix 
[] push [matrix [] shape [] ] shape [] shape [] shape [] ] or push 
[ matrix [] push [ matrix [] shape [] reset-matrix ] shape [] shape[] 
shape[] ]
shadwolf:
27-Jun-2005
matrix in SVG are in this format matrix [a b c d e f ] (decimal!) 
and this represent a transform  matrix of this from 
[ a c e]
[ b d f ] 

[ 0 0 1] so I really don't know if this is the same for a matrix 
in draw AGG.  As the gap is not very  hudge this means for me that 
the AGG matrix i close to be handled the same as the SVG ones ...
shadwolf:
27-Jun-2005
according to the SVG documentation a = scale X b =  skew X c = skew 
Y d = scale Y e = translate X f =  translate Y. For example in blender.svg 
file the group global matrix is  matrix [1.462522 0.0 0.0 1.462522 
-11.43136 -22.46338] (this is made with raw datas from the file no 
more compute than retrieving and converting the datas from dtring! 
to decimal!) So according to the informations I read in the SVG doc 
this matrix represent a scale X/Y of 1.46  and a translation X/Y 
of -11.43 and -22.46.  I'm working with a premaid scaling environnement 
applyed to the coord of the shapes maybe I need to apply this scale 
to the a b and e f value of the SVG matrix when I build the matrix 
 in AGG.
shadwolf:
27-Jun-2005
(scaling and position comming from the implementation of the matrix 
global and local and maybe the application of the scalling global 
system ...)
shadwolf:
2-Jul-2005
I'm steel  waiting for an answer for my matrix problem ....
shadwolf:
2-Jul-2005
I'm still waiting dor an answer to my matrix problem ... In the mean 
time I rewriting the whole code to make it recusrsif ans easier to 
understand and upgrade
Cyphre:
5-Jul-2005
MATIX=MATRIX
shadwolf:
5-Jul-2005
sorry I make a mistake the code with the matrix support is http://shadwolf.free.fr/svg-demo-shadwolf02.r
shadwolf:
5-Jul-2005
I have inserted the matrix transformation into my new code
Cyphre:
13-Jul-2005
Shadwolf: I analyzed your SVG example with nested MATRIX command 
and found little bug in matrix calculation. Thanks for pointing this 
out! I know the solution so it will be fixed in the next Rebol View 
build.
Cyphre:
13-Jul-2005
Note: The bug is related only to MATRIX command. TRANSFORM/TRANSLATE/ROTATE/SCALE 
works ok.
shadwolf:
14-Jul-2005
Cyphre Great !!!! I'm happy to have found a difficult bug regarding 
MATRIX in AGG/DRAW :) I hope this will be solved as soon as possible. 
I all cases tahnk you to have take the time to scout my problems 
:)
shadwolf:
14-Jul-2005
instead of using matrix i can translate it into scale rotate and 
translate value so ...
shadwolf:
14-Jul-2005
SVG matrix (a b c d e f) -> AGG scale [a d] rotate [b c] translate 
[e f] can I do this ???
shadwolf:
14-Jul-2005
matrix is 3X3
shadwolf:
20-Jul-2005
Don't know if transform REBOL/AGG command can do this 

I not enoght skilled in AGG to answer ... I will try to use transform 
instead of matrix
Cyphre:
21-Jul-2005
shadwolf: you cannot use partial matrix blocks on SCALE/ROTATE/TRANSLATE 
commands.
Cyphre:
21-Jul-2005
The problem of converting back already defined transformtion matrix 
is that you don't actually know what opearations(rotate,scale,translate 
etc.)  has been applied on the matrix values. ie transformation matrix 
is ireversible.
Cyphre:
21-Jul-2005
So I think there is no method how to 'extract' translation, rotation 
and scale from matrix content(correct me if I'm wrong)
JaimeVargas:
21-Jul-2005
I agree with you, there needs to be some sort of record on how the 
operations occured. I think there is big number of combinations (rotation, 
translation and scale). That could produce the same matrix, so decomposition 
is not easy if the only think know is the Matrix itself.
Cyphre:
21-Jul-2005
yes, that's why the new DRAW dialect has PUSH [ ] command. It 'stores' 
the current transformation matrix into internal matrix stack. You 
can apply other transformations in the PUSH block or even reset the 
current matrix but after 'leaving' the PUSH command block you have 
active back the 'stored' matrix. Very handy for nested transformations.
Group: Announce ... Announcements only - use Ann-reply to chat [web-public]
shadwolf:
5-Aug-2005
so test it send bugs report to rambo and we will get a pretty good 
version

It's yet very good to have a working alpha version for MacOSX after 
only 1 month of the Win32 1.3  stable release. Even in the 1.3 stable 
version for win 32  we have remaining bugs like agg matrix key word 
or gradient effect converion from SVG
Group: SDK ... [web-public]
amacleod:
2-Mar-2009
using rebface I get a sytax error for the following:


 if s/x > cell_sizes/:c/x [cell_sizes/:c: s cell_matrix/:c: reduce 
 [r c]]

Syntax Error: Invalid word -- :c:
amacleod:
2-Mar-2009
Used poke


if s/x > cell_sizes/:c/x [poke cell_sizes c s poke cell_matrix c 
reduce [r c]]

seems to work...
Group: !RebGUI ... A lightweight alternative to VID [web-public]
shadwolf:
30-Jun-2005
for lineargradient SVG gives us a transform information (can be matrix, 
rotation,scale , skew, etc...) then we have an offset  x1 X2 y1 y2 
then we have  color informations spread method
shadwolf:
7-Jul-2005
for the momment I have some problem to sum local and global matrix 
and to translate gradient effect
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
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
how to apply a matrix tranformation only over a grendient definition 
?
shadwolf:
2-Jul-2005
I still not soleve my matrix problems so until now I don't implement 
it into  the actual code
shadwolf:
4-Jul-2005
Chanlog:
* Cleaner Code (near 200 lines saved)
* support new draw primitives Ellipse,  Path Arc, rect 
* recursiv G block parsing have been improved

Still not supported
* transformation information (matrix,scale, rotate, skew) 
* gradient information (linear, radiant etc...)
* circle, text, line, polyline, polygones
shadwolf:
11-Jul-2005
I'm hard working on the matrix support ..
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
Group: rebcode ... Rebcode discussion [web-public]
Rebolek:
1-Dec-2005
I rewrote my old 3d demo to rebcode to see the speed difference. 
But I found that normal rebol can draw 120+ triangles without slowing 
down and because I became bored adding more objects I stopped testing 
it :) Anyway, rebcode optimalised (just three or four functions - 
matrix multiplication, inversion and 3d to 2d conversion - are rewritten 
to rebcode, it can be optimalized more) version is here - http://krutek.info/rebol/ratrix.r
. z-buffer does not work very well as you can see.
Rebolek:
1-Dec-2005
hm, from my tests, matrix operations are just 3x faster, 3d to 2d 
conversion is cca. 11x faster. But old rebol-only version can show 
120+ triangles without problem so in this simple demo, rebcode is 
not needed :)
Rebolek:
1-Dec-2005
Volker: there's camera code, but there's probably bug in invert matrix 
function so the camera does not work right now. I'm trying to find 
some informations on that topic and to fix it.
Rebolek:
2-Dec-2005
Just a small update: I've fixed matrix inversion so it's possible 
to move camera now. It's not possible to rotate camera but I'm working 
on it.
Group: Tech News ... Interesting technology [web-public]
Volker:
18-May-2006
But a parralel processed image looks the same all the time, or the 
processing of a big matrix. Still deterministic. Whatever happens 
inside the box.
Gabriele:
3-Feb-2007
you see, humans currently do live inside the Matrix. it was created 
by sellers, not by machines, to extract money, not electricity. but 
the principle is the same.
Gabriele:
3-Feb-2007
AI is a radical change, and as such, it could shake things enough 
to let people out of the Matrix.
Gregg:
18-Feb-2008
Petr, you've never heard of VB? :-) QuickBASIC, under DOS, had an 
IDE back in 1985. PowerBASIC (used to be TurboBASIC from Borland) 
is still around and has inline asm and a killer compiler. GFA BASIC 
had matrix math built in, and TrueBASIC had some very cool libraries, 
like 3D graphing, as part of the system. After VB there have been 
a lot of "BASIC-like" lanugaguges, but some of them aren't really 
BASIC.
shadwolf:
2-Sep-2008
lcd monitors use a neon like lamp to enligh the background of the 
LCD matrix and some time that neon tube lamp dies it can be changed 
easyly
Group: !REBOL3-OLD1 ... [web-public]
Geomol:
11-Apr-2006
The alternative, doing vector- and matrix-math just using decimals, 
can easily be ever uglier.
Geomol:
11-Apr-2006
Graham, I've made a RAMBO proposal for vector and matrix.
Geomol:
11-Apr-2006
All different kinds of 3D manipulation will look simple, like scaling, 
rotation, reflection, etc. All those are well-defined matrix-operations. 
And supporting multi-dimensional vectors and matrices might pull 
a lot of science people to REBOL.
Geomol:
11-Apr-2006
Reaching second element on second row in a 2-dimensional matrix:
M/2x2
Karol:
11-Apr-2006
since pairs are only integers not decimals vector and matrix could 
be replacement for draw dialect coordinates, AGG has subpixel accuracy
Karol:
11-Apr-2006
but with matrix we can     a: make matrix! [ [ 0 1] [ 2.2 3.1]]  
a/2/1
Group: Postscript ... Emitting Postscript from REBOL [web-public]
Graham:
7-Apr-2006
PostScript normally uses units of "points" for placing graphics on 
the page. I find it more convenient to work with centimeters. I got 
the following snippet of PostScript code from a public domain program 
called "GLE" which I believe is available at any large ftp site; 
I recommend this graphics program. By examining the PostScript output 
of that program I collected the following piece of PostScript code:


matrix currentmatrix /originmat exch def /umatrix {originmat matrix 
concatmatrix setmatrix} def [28.3465 0 0 28.3465 10.5 100.0] umatrix


What this basically does is rescale the page so that now all following 
commands will work as if the centimeter is the basic unit of length. 
This places (0,0) near the bottom left of the page and (21,24) near 
the top right of the page.


If you don't do this, then (0,0) is the bottom left corner of the 
page and (612,792) is the top right corner of the page (if you are 
using an 8 1/2 inch by 11 inch sheet of paper). These are the default 
PostScript units; 72 of these to an inch. 28.3465 to a centimeter, 
thus the numbers above in the last line of PostScript code.
Geomol:
7-Apr-2006
I can't find the switch y-axis thing right now. Maybe a matrix is 
needed?
Geomol:
13-Apr-2006
and matrix
Graham:
17-Apr-2006
I remember driving my dot matrix printer like that.
xavier:
31-Jan-2007
is there someone who have an idea for printing in rebol on a dot 
matrix printer ? i have to pilot it for printing a pre formated bill 
for dental care.  If anybody see what i mean..  I was wondering about 
how to do it in rebol, by passing by a markup langage but i dont 
know how it work.  if anybody got an idea...
xavier:
31-Jan-2007
and a dot matrix printer is not supposed to be connected by something 
else then the lpt port
xavier:
31-Jan-2007
it must be possible to describe a document for a dot matrix printer 
with that
Geomol:
10-Apr-2007
Have you played with MATRIX and text in DRAW?
Henrik:
10-Apr-2007
I haven't figured out how MATRIX works
Geomol:
10-Apr-2007
Short explanation: matrix [1 0 0 1 0 0]
is neutral and doesn't do anything.
matrix [1 0 0 1.5 0 0]
scale the y-direction by 1.5.
Geomol:
10-Apr-2007
matrix [1 0 0 1 100 0]
translate in the x-direction by 100 pixels.
Geomol:
10-Apr-2007
So the most basic stuff (scaling and moving) goes like this:
matrix [scale-x 0 0 scale-y move-x move-y]
Result depend on what you put in those 4 positions.
Geomol:
10-Apr-2007
If you wanna do more than one transformation, they can be combined 
into one matrix command.
Group: DevCon2007 ... DevCon 2007 [web-public]
Pekr:
10-May-2007
we need to connect Carl back to Matrix, to have his brain under our 
control :-))
Group: Games ... talk about using REBOL for games [web-public]
Maxim:
17-Jan-2007
yes... this is like programming the matrix.
Maxim:
17-Jan-2007
but its doable.  every game out there is an implementation of this 
concept... with preset rules, preset AI, and loaded graphics.  basically, 
all that is needed (like in the matrix) is to define the construct 
(laws of physics and rule set which can be exposed and perceived 
by the agents).
Group: Printing ... [web-public]
BrianH:
4-Sep-2008
At the start, postscript printers cost thousands of dollars but dot 
matrix printers cost a couple hundred. If MS had gone with Postscript, 
printing would have been stillborn outside of large companies.
1 / 201[1] 23