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

Bo
28-Jun-2005
[334]
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
[352x6]
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
so to resume transformation informations are Global (attached to 
a group of drawable primitives) local (attached to a drawable primitive 
and attached to gradient in defs)
sorry I make a mistake the code with the matrix support is http://shadwolf.free.fr/svg-demo-shadwolf02.r
Anton
5-Jul-2005
[358]
Is there a mode for backwards compatibility with old draw ? eg. (lines 
are not anti-aliased, but simple jagged)
shadwolf
5-Jul-2005
[359x5]
antialiased of ...
but many drawable primitivs have keep the same name but takes other 
arguments
and others doesn"t exists :)
I have inserted the matrix transformation into my new code
I'm near to the solution
Rebolek
11-Jul-2005
[364]
'arc takes radius argument as a pair! but 'circle takes radius argument 
as two decimal! - I think it's inconsistent
DideC
11-Jul-2005
[365]
'arc is consistent with 'ellipse !!!
Anton
11-Jul-2005
[366x4]
It is, however you can think of circle usually taking only one number 
to be the radius.
It's a handy alternative to ellipse (I haven't tried ellipse) which 
allows you not to need to use scale.
view layout [b: box navy 100x100 effect [draw [circle 30x50 19.5 
20.2 circle 60x50 19.5 20.6]] image b/size * 4 to-image b]
You can see the two ellipses are slightly different.
Rebolek
11-Jul-2005
[370]
yes I understand, but when there's such a precision with cicrle, 
why it's not same with 'arc?
Anton
11-Jul-2005
[371x2]
you can get it using    scale 0.1 0.1    for example.
sometimes it's handier with pair!s, sometimes it's handier with pairs 
of decimal!s
Rebolek
11-Jul-2005
[373x2]
OK, but I still think that 'arc, 'circle and 'ellipse should have 
radius parametr in same form.
pair! with decimal precission would be nice
Anton
11-Jul-2005
[375x2]
Ah, but that's the thing... :)
Adding a new datatype is a major extra body of code. And with SCALE 
we really don't need it.
Rebolek
11-Jul-2005
[377x4]
I know I know, it was ust a small dream ;)
but still - I think that 'arc, 'circle and ellipse should have same 
type parameteres
for radius
I've just found in the documentation that 'arc in 'shape uses two 
decimal!s and not one pair!. And now tell me it's NOT confusing :)))
Anton
12-Jul-2005
[381x3]
Circle fill and outline don't seem to match up quite perfectly.
img1: to-image layout/tight [image 40x40 effect [draw [pen black 
fill-pen leaf circle 20x20 19]]]

img2: to-image layout/tight [image white 40x40 effect [draw [pen 
black fill-pen leaf circle 20x20 19]]]
view layout [image 200x200 img1 image 200x200 img2]
You can see some light green pixels at top left of the outside of 
the circle, and at the bottom left, on the inside of the circle.

I wonder if this is a rebol agg implementation issue or an agg issue.