No background in painted rect

Alex Tweedly alex at tweedly.net
Thu Dec 1 14:02:10 EST 2005


R. Hillen wrote:

> Hello Xavier, hello Ken,
>
> thank you for your help.
>
>
> I looked everywhere in the documentation, but it was not very  
> helpfull. I know, all is written there, but to find it and how it is  
> connected together, is another thing. But I found a little stack and  
> learned from it, that I had to "set the filled to true" and to do  
> that _before_ choosing the paint tool. (Yesterday, trying graphic  
> pbjects, I learned from this list to set the opaque to true.)
>
> I want to show soundlevels in an area,  200 times 200 datapoints as  
> litte scaled coloured rects, so I have to paint it. I also tried to  
> use graphic objects. While the painting of the 40000 datapoints take  
> about 8 Minutes, using graphic objects takes about twice as long. The  
> main time is used by dragging the rects or painting the rectangles.
>
> And both is a very long time to show some data.

I don't know exactly what your display needs to look like, but I suspect 
you could benefit from a technique this list taught me, about a year 
ago. (With many thinks to everyone involved back then, esp. Geoff Canyon 
who came up with the definitive demo for this technique - see
http://lists.runrev.com/pipermail/use-revolution/2003-October/024092.html 

Summary - if this is unclear, just read Geoff's email described above.

A polygon graphic object in Rev can be
 - filled (or not)
 - have "invisible" edges
 - can therefore make up a number of separate, discrete filled sections

(You create an invisible edge by including a blank line in the list of 
points).

You can make a set of small rectangles by creating a polygon, setting 
the "filled" and color attributes as you need, and then giving it a set 
of point such as

10,10
20,10
20,20
10,20
10,10

50,50
70,50
70,60
50,60

etc.

Even better, if you want to have many of the small scaled rectangles be 
the same size/color, you can use the "marker" feature of a polygon graphic.

You set the marker as you want it (i.e. a set of points, markerLineSize, 
markerFillColor, etc.), and then each point of the polygon is marked 
with one of these markers. Use that in conjunction with the invisible 
edges, and you can get a set of rectangles with no visible polygon 
edges.  The "downside" is that each color/size combination needs a 
different polygon - but most apps that need a large number of rectangles 
will have quite a lot of regularity in the rectangle characteristics.

Using this, I was able to get some apps which draw thousands (2000-5000) 
rectangles, and then animate them by moving them around the screen in 
almost real time. I forget the exact details, but I think I got 10-15 
frame refreshes per second at 2000 rectangles - very impressive graphic 
performance for a scripted language.



-- 
Alex Tweedly       http://www.tweedly.net



-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.362 / Virus Database: 267.13.10/189 - Release Date: 30/11/2005




More information about the use-livecode mailing list