[1/4] from: frederic::email::wanadoo::fr at: 10-Oct-2002 17:35
Hi all !! i'm new in rebol and i'm not good in english so i'd try to be clear. I just test a script from auverlot's book, here it is : ********** REBOL  pos-xy: none view layout [ b: box 400x400 white feel [ detect: func [face event] [ switch event/type [ move [ pos-xy: event/offset append b/effect/draw reduce [pos-xy] show b ] down [ pos-xy: event/offset append b/effect/draw reduce ['circle pos-xy 30 'line] show b ] alt-down [ append b/effect/draw reduce ['fill-pen (random 255.255.255) 'line] ] ] ] redraw: none ] effect [draw ['pen black 'line]] ] ************ So first when i moved around the mouse over the box very fast the pen seems to follow very good. but if i click down just one time (a circle is paint in the box), then suddenly the pen seems to be late. if i stop move the mouse, the pen ends up arriving, and if i move fast again, the pen is always late. I don't understand why a simple draw circle command in a dynamic drawing decrease the drawing performance. I hope that you've understand my question. Thanks in advance to all. Fred.
[2/4] from: anton:lexicon at: 11-Oct-2002 11:48
The effect draw block is growing each time you add a new line or circle to draw. Each time show b is called, everything in the draw block is drawn. So as it grows, so it slows. A solution is to capture b's image once every while or perhaps every iteration, with: img: to-image b and clear the draw block at the same time. Then set b's image like this: b/image: img and at the next iteration, draw on top of that. Anton.
[3/4] from: frederic:email:wanadoo at: 11-Oct-2002 13:32
Thanks Anton for your response. I understand very well your explanation : as you add more and more draw commands in the effect block as it slows to draw the entire block. but if you try the sample code i posted you can see that you can draw for a very long time and very fast with a pen that follows mouse very closely. Then start again the script, click one time immediately to draw a circle and move the mouse fast, so you can see immediately that the drawing performance decrease. Your suggestion is a good idea to resolve this problem but i'm really surprise by the result of my test and i can't believe that drawing a simple circle (just one!) is so consequent. Or i must understand that in rebol drawing a circle is very complex and requiere a lot of compute that slow down performances. Maybe someone have another explanation to solve this question. Fred
[4/4] from: greggirwin:mindspring at: 11-Oct-2002 11:32
Hi Fred, <<...i'm really surprise by the result of my test and i can't believe that drawing a simple circle (just one!) is so consequent. Or i must understand that in rebol drawing a circle is very complex and requiere a lot of compute that slow down performances. Maybe someone have another explanation to solve this question. >> There are some underlying conceptual issues, perhaps, and some other things to consider. First, in many drawing apps, the things you draw become just "bits on a background", which is fast and easy to display. In more capable apps, you may have lots of drawing objects which can be arbitrarily moved between layers (i.e. Z-ordered), etc. They tend to be highly optimized, and are the subject of an enormous amount of effort to keep their performance high. REBOL faces are very general and powerful. Every face uses the compositing engine and can have its own set of effects. The DRAW effect (as I understand it) has to be re-interpreted every time you show the face, which can be very slow, especially where fills and things are concerned. The little paint app I've seen holds its own pretty well, but I haven't seen Olivier's to see how it works or performs. Two things that affect face redrawing performance are 1) the size of the face, and 2) any other effects you have applied to it. Large faces are slow to paint, and other effects have to be re-rendered each time as well, which can bring things to a crawl if you're not careful. Their performance is good, but real-time, 24-bit compositing is a lot of work no matter how you look at it. HTH! --Gregg