r3wp [groups: 83 posts: 189283]
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r3wp

[AGG] to discus new Rebol/View with AGG

ChristianE
25-Jun-2005
[306]
my-font: make face/font [name: "Arial Black" size: 24] view layout 
[box effect [draw [font my-font pen black fill-pen yellow text "Text" 
vectorial]]]
[unknown: 5]
26-Jun-2005
[307x4]
That is sweet!  Thanks ChristianE
That is a lot different method than I thought from the notes
I noticed that it doesn't work for 'btn no matter what size I choose
Also would be nice to input text like that into a field so that its 
already formatted and then when one types in the field its AGG style 
text
ChristianE
26-Jun-2005
[311x3]
AGG rendered *editable* text, you mean? I guess that would require 
some reasonable work, and it would probably be very slow, since you'd 
have to write your own OFFSET-TO-CARET and CARET-TO-OFFSET.
For BTN, which already has an EFFECT block, you'd have to append 
the DRAW block:
font-a: make face/font [name: "Arial Black" size: 24]
font-b: make face/font [name: "Arial" size: 12]
view center-face layout [
    btn 120x48 with [
        append init [

            append effect compose [draw [font font-a pen black fill-pen yellow 
            text 16x8 "Button" vectorial]]
        ]
    ]
    btn 20x120 with [
        append init [

            append effect compose [draw [transform -90 0x0 0x90 1 1 font font-b 
            pen none fill-pen black text 0x2 "vertical text" vectorial]]
        ]
    ]
]
[unknown: 5]
26-Jun-2005
[314]
Wow that looks good!  This AGG stuff dramatically improves the type 
of GUI's were capable of.  I really need to dive into this stuff 
more.  I do think they should look for ways to add that capability 
to fields and text-lists etc..
shadwolf
27-Jun-2005
[315x18]
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
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 
:)
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.
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[] ]
with my actual implementation I see on screen the group well renderer 
(all the elements of the groupe are coherent) but the group items 
are not well positionned there is a gap betwin the not gouped part 
of the image and the grouped one (I'm working with the file blender.SVG)
the orange part of this draw is over the dark one but not in the 
good place ...
so I yet  don't have problems with draw layers but only with the 
position of the grouped part :)
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 ...
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.
scalling that is applyed to shapes coordinates is scale-x: size/x 
/ svg-size/x  scale-y: size/y / svg-size/y ( this allow resize handling)
I hope that I give anought inforamtion to allow you to help me regarding 
to my positionning problem.
to help you figure out my rendering problem I make a little composition 
image that shows on left the SVG image well rendered by inkscape 
and on the right part the svg-demo-shadwolf.r rendering ....
http://shadwolf.free.fr/SVG-rend-compare.jpg
I'm made to be so close to the goos implementation and not being 
able to solve by my own those problems ...
(scaling and position comming from the implementation of the matrix 
global and local and maybe the application of the scalling global 
system ...)
I'm mad (sic) to be so close to the good implementation and not being 
able to solve by my own those problems .
personally I would prefer the AGG doc to be release in the mean time 
of the VM.
(sorry wrong group ;)))
Bo
28-Jun-2005
[333x2]
Here's my thanks for the AGG support in Rebol.  Just make sure you 
have plenty of memory before you run it.  It runs very smoothly on 
my AMD XP 2500+ w/512MB.
fovsz: 450x450

layout compose [starfield: image (fovsz) black]

starfield: to-image starfield

loop 1000 [
	col: random 255
	starcol: to-tuple reduce [col col col]
	poke starfield random fovsz/x * fovsz/y starcol
]

view/new layout compose [
	b: image starfield
]

hvector: func [x y v][

 (fovsz/x / fov) * (fov / 2 + either zero? pos/2 - y [90][arctangent 
 (pos/1 - x) / (pos/2 - y)])
]

vvector: func [y z v][

 (fovsz/y / fov) * (fov / 4 + either zero? pos/2 - y [90][arctangent 
 (pos/3 - z) / (pos/2 - y)])
]

map: [
	"A New Beginning"
	""
	"Rebol HQ, led by their jedi leader,"
	"Carl Sassenrath, has begun"
	"preparations to strike back against"
	"Darth Gates at the Redmond system"
	"during a time of growing unrest"
	"among the netizens of the Empire."
	""
	"As the Empire works to complete"
	"construction of their hailed"
	"planetary domination device, code"
	{named "Longhorn Death Star", small}
	"centers of resistance continue to"
	"gain support among the"
	"oppressed masses."
	""
	"Even with mounting support, only"
	"One is powerful enough to overcome"
	"the dark side of the Force --"
	""
	"Rebol/View 1.3"
]

mapimg: copy []

foreach line map [

 b1: layout/origin compose/deep [text (line) 840 center font-size 
 48 sky black (either any [line = map/1 line = last map]['bold][])] 
 0x0
	append mapimg to-image b1
]

pos: [0 30 20]
dir: [0 0]

fov: 45

for l pos/2 200 .1 [
	agg: copy []
	x: 0 y: 0
	foreach item mapimg [
		y: y + 5
		if y < pos/2 [
			append agg compose [
				image (item)
				(to-pair reduce [hvector x + 15 y dir/1 vvector y 0 dir/2])
				(to-pair reduce [hvector x - 15 y dir/1 vvector y 0 dir/2])

    (to-pair reduce [hvector x - 15 y + 5 dir/1 vvector y + 5 0 dir/2])

    (to-pair reduce [hvector x + 15 y + 5 dir/1 vvector y + 5 0 dir/2])
				black
			]
		]
	]
	b/effect: compose/deep [draw [(agg)]]

	show b

	pos/2: l
]
Brett
28-Jun-2005
[335]
Started to look good, but it crashes ("REBOL/View System has encountered 
a problem and needs to close.  We are sorry for the inconvenience.") 
 XP with 1Gb ram.
Cyphre
28-Jun-2005
[336]
hmmit crashes here too...after adding wait 0.001 to the main programm 
loop it doesn't crash. I wouldn't suggest to use such "drastic" methods 
for window refresh.
Bo
28-Jun-2005
[337x2]
I guess it could be considered a stress test, although that was not 
my intent.
Cyphre, how would you achieve the same effect with a less "drastic" 
method?
Brett
28-Jun-2005
[339]
The crash should be submitted to RAMBO as a bug. But would be nice 
if we could try to target the specific cause a little more as a group. 
I mean is it the integration of AGG and REBOL, or is it the interpreter 
or is it provoking an XP or intel or Graphics card instability?
Volker
28-Jun-2005
[340]
seems it does ~2000 shows without processing events? and shows involve 
some event-handling i guess, all that invalidate-stuff and on-draw-messages 
on the windows-side. I think cypres wait is that less drastic method, 
not to slow it down, but to process such events.
Brett
28-Jun-2005
[341]
I put a wait on the inside loop and it still crashed, in the outside 
loop it worked. I took out the wait again and put a to-image b just 
before the show b and it works....
Cyphre
29-Jun-2005
[342]
I think it has something to do with timing/sync. Anyway please put 
it into Rambo so we can trace the crash. Thanks.
Bo
29-Jun-2005
[343]
Thanks for the input, guys.
Anton
30-Jun-2005
[344]
Bo, I sent you a version which updates on time events.
Bo
1-Jul-2005
[345]
Thanks, Anton!  I'm glad I got to see some of your enhancements to 
my script.  It's easy to forget about how much is actually built-in 
to the Rebol interpreter, so I go about doing things in a more complex 
way.  I'll update my corresponding script on Rebol.org.
Anton
1-Jul-2005
[346]
Welcome.
shadwolf
2-Jul-2005
[347x2]
I'm steel  waiting for an answer for my matrix problem ....
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
[349x3]
shadwolf: the format of MATIX command has the same argument order 
as in SVG specs.
MATIX=MATRIX
Can you provide SVG source and your DRAW source of  the image you 
posted as a problematic one?
shadwolf
5-Jul-2005
[352x4]
sure http://shadwolf.free.fr/blender.svgand http://shadwolf.free.fr/svg-demo-shad03.r
since version 03 I have changed the way to handle svg content but 
I don't inserted the transformation support in those lastest version 
(04 and 05) My other problem is how to suppoer localtransformation 
information and global one. So transformation informations are attached 
to a group and some other are attached to a draw primitive so How 
to represent it to AGG code
My other problem is about gradient effect
how to convert SVG gradient information to AGG one to make it simplier 
SVG use vector information x1  X2 y1 y2  they use a list of color 
with there position along the  vector ( from 0 to 1)  and they encap 
transformation information too So how to translate this to the fil-pen 
gradient linear exploitable issues