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

Ashley
15-Oct-2007
[1153]
I doubt it. size-text expects a face argument and computes size based 
on face/text, face/font, face/edge and face/para values.
ICarii
15-Oct-2007
[1154]
all of which you can change to expected agg fonts etc before calling 
size-text

s: size-text make face compose [text: (t) font/name: "arial" para/wrap?: 
off]  ;etc..
Ashley
15-Oct-2007
[1155]
which is fine as long as you don't use vectorial ;)
ICarii
15-Oct-2007
[1156x2]
as long as you use pen off/none with vectorial the results should 
still match :)
unless of course you are using rotations or scaling :)
ReViewer
15-Oct-2007
[1158]
I will test it soon, Thanks!
amacleod
8-Oct-2008
[1159]
When drawing an object onto a face is there a way to insure that 
hte next object drawn is layed on top.

I'm drawing boxes on a face but when I try to draw addional boxes 
(different colors) they are hidden behind the first drwn objects..
Brock
8-Oct-2008
[1160]
In most graphics programs there is something called the z-index or 
something to that effect, that controls the depth of the objects 
in a view.  Usually range in value from 256 (top) to -256 (furthest 
away).  I can't speak for AGG though as I have not played with it 
yet.
ICarii
9-Oct-2008
[1161]
The AGG/Draw dialect will process and render things in the order 
they are specified inside the draw block for the face.  There is 
no z-index for AGG.
amacleod
9-Oct-2008
[1162x2]
I adding shape objects to a face by appending them to face/effect/draw 
but the appended shap is beneath the original face shapes.
If you draw onto a text field the text is on top. ..even if you 'paint' 
a box affter the text has been rendered. I do not understand what 
is going onthere?
Anton
9-Oct-2008
[1164x5]
Can you give a small example, eg:
view layout [box effect [draw [pen red line-width 2 shape [line 0x0 
10x0 10x10 0x10] pen green shape [line 5x0 10x5 5x15 0x5]]]]
The above example draws the red box first, and the green kite on 
top of it.
face/text rendering is separate to face/effect/draw rendering, and 
will always be on top.
So, please show us a small example of what you're doing.
amacleod
9-Oct-2008
[1169]
I'm doing something like this:

view layout [

 b: box effect [draw [pen red fill-pen red line-width 2 shape [line 
 0x0 40x0 40x40 0x40]
	]
	]

 btn "append draw" [append b/effect/draw compose ['pen green 'fill-pen 
 green 'shape ['line 5x0 30x5 5x25 0x20]]show b]
	]

Its much more complicated as I'm painting highlights on a series 
of faces in a panel. I go back and highlight in another color where 
a specified word is found. The hi-lite shows if its on a section 
of text not yet painted but not if it falls on painted text.

The above example works!

so it must be some where else in my app...

Thanks. I'll look it over...
Anton
9-Oct-2008
[1170x5]
You can't really "paint on a face". Faces redraw themselves from 
their specification every time they are shown.
Each face has an internal image buffer (that we don't have access 
to directly). This buffer is blanked just before the face redraws 
itself.
But anyway, face/text always renders after the face/effect/draw dialect.
view layout [box effect [draw [pen red line-width 5 line 0x0 100x100]] 
"hello"]
That shows the red line drawn behind the face/text, "hello".
amacleod
9-Oct-2008
[1175]
I got it working...

I do not know what i was doing before but its doing what I need...Thanks
Anton
9-Oct-2008
[1176]
Ok, no problem.
DideC
9-Oct-2008
[1177]
Maybe you were inserting in the draw block instead of appending (insert 
tail) !?
amacleod
9-Oct-2008
[1178x4]
Actually I  don't like this behavior...its too complicated to remove 
it again.Back to my original plan of moving and resizing a box form 
face to face...

view layout [
	bx: box 100.100.255 0x0

 b: box effect [draw [pen red fill-pen red line-width 2 shape [line 
 0x0 40x0 40x40 0x40]]]
	at 40x40 text "Hello World"

  btn "append draw" [append b/effect/draw compose ['pen green 'fill-pen 
  green 'shape ['line 5x0 30x5 5x25 0x20]]show b]
	btn "Moving box" [bx/offset: 20x20 bx/size: 90x90 show bx]
	]
for example.


Now if I draw the box after the face it covers the textt which I 
want to avoid too.view layout [
	bx: box 100.100.255 0x0

 b: box effect [draw [pen red fill-pen red line-width 2 shape [line 
 0x0 40x0 40x40 0x40]]]
	at 40x40 text "Hello World"

  btn "append draw" [append b/effect/draw compose ['pen green 'fill-pen 
  green 'shape ['line 5x0 30x5 5x25 0x20]]show b]
	btn "Moving box" [bx/offset: 20x20 bx/size: 90x90 show bx]
Can you use alpha channel in vid or only in draw?
DidC, I thought about that but I was appending. I think I was not 
drawing the box properly.
Above code : ignore the second code example. I hit ctrl-v instead 
of cntrl-s
Anton
9-Oct-2008
[1182x3]
If you want to process face/text rendered text, then you're going 
to have to put a (semi-transparent) face on top of it (or in its 
pane).
; in its pane

view layout [h1 "hello" with [pane: make face [offset: 5x5 size: 
20x10 effect: [merge luma 90] edge: none]]]
This will affect how events are handled, unfortunately. As far as 
I know, there is no way to make a face "event transparent" at this 
time. I spent a lot of time looking at this already.
amacleod
9-Oct-2008
[1185]
Got it!
I draw a box with 0 size at the end of the panel:
bx: box 0x0 edge [color: red size: 2x2]

Then I size it , move it to where I need it , and append an effect: 
		bx/offset: face/offset + khead - 0x3
		bx/size: as-pair (ktail/x - khead/x) 21
		bx/effect: append [merge][multiply 100.0.0]

Works great. I'm using it to highlight a search word as I step through 
all the text faces in a panel.

Thanks for the help...
Anton
9-Oct-2008
[1186x4]
Are you doing the APPEND more than once ? (the block will grow and 
grow...)
You only need to set the effect once.
bx: box edge [color: red size: 2x2] with [show?: false]
then you only need to set the offset and size. The above also shows 
how to make the face initially invisible. (An alternative to size: 
0x0).
amacleod
9-Oct-2008
[1190x4]
SHow? false...good idea!

I've abandoned the append draw  idea as it would take some parsing 
code to remove it again when I move to the next face...
Moving a box around is alot easier.
Oh...You mean the effect append...Yeah I've been appending every 
time I do the search. But I probed bx/effect but it does not look 
like its growing unless i"m only seeing the tail in the probe

I got an out of memory crash before that I've been trying to track 
down. This might be it.
probe on head bx/effect but I only get a single occurance of the 
effect block. But teh code looks like it would do what you suggest.
got rid of the append function and just used teh effect on hte creationof 
the box...no reason to append it.
Good eye Anton, thanks
Anton
9-Oct-2008
[1194]
No problem.
Brock
26-Oct-2008
[1195x2]
Are there any demo's that show the manipulation of AGG graphics within 
a GUI?  For example, dragging points of a bezier curve to reshape 
the line etc?  I thought I saw some from either Cypher or the AGG 
demos done by others.  Can anyone point me to them?
I'd like to see if I can't create a very small, very simple example 
of a vector drawing program... but would need some place to start 
as at the moment, I don't have a clue.
Gregg
26-Oct-2008
[1197]
I remember something too Brock, but can't find it now either.
Brock
26-Oct-2008
[1198]
Thanks for trying to find something.  Maybe it will show up in the 
next few days.
Anton
27-Oct-2008
[1199]
Brock:

do http://anton.wildit.net.au/rebol/gfx/demo-intersection-point-of-two-lines.r
Brock
27-Oct-2008
[1200]
Thanks Anton, that will be helpful.
Brock
28-Oct-2008
[1201]
Have looked over your code Anton.  There is alot of info I can use 
from it.  Thanks for bringing it to my attention.
Anton
29-Oct-2008
[1202]
do http://anton.wildit.net.au/rebol/gfx/demo-intersection-points-of-circle-and-line.r