Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C# / Silverlight / WPF / Fast rendering lots of circles

I want to render a lot of circles or small graphics within either silverlight or wpf (around 1000-10000) as fast and as frequently as possible. If I have to go to DX or OGL, that's fine, but I'm wondering about doing this within either of those two frameworks first (read: it's OK if an answer is WPF-only or Silverlight-only). Also, if there is a way to access DX through WPF and render on a surface that way, I would be interested in that as well.

So, what's the fastest way to draw a load of circles? They can be as plain as necessary, but they do need to have a radius. Currently I'm using DrawingVisual and a DrawingContext.DrawEllipse() command for each circle, then rendering the visual to a RenderTargetBItmap, but it becomes very slow as the number of circles rises.

By the way, these circles move every frame, so caching isn't really an option unless you're going to suggest caching the individual circles . . . But their sizes are dynamic, so I'm not sure that's a great approach.

like image 456
Walt W Avatar asked Feb 25 '10 20:02

Walt W


People also ask

Bahasa C digunakan untuk apa?

Meskipun C dibuat untuk memprogram sistem dan jaringan komputer namun bahasa ini juga sering digunakan dalam mengembangkan software aplikasi. C juga banyak dipakai oleh berbagai jenis platform sistem operasi dan arsitektur komputer, bahkan terdapat beberepa compiler yang sangat populer telah tersedia.

C dalam Latin berapa?

C adalah huruf ketiga dalam alfabet Latin. Dalam bahasa Indonesia, huruf ini disebut ce (dibaca [tʃe]).

Bahasa C dibuat pertama kali oleh siapa dan tahun berapa?

Bahasa pemrograman C ini dikembangkan antara tahun 1969 – 1972 oleh Dennis Ritchie. Yang kemudian dipakai untuk menulis ulang sistem operasi UNIX. Selain untuk mengembangkan UNIX, bahasa C juga dirilis sebagai bahasa pemrograman umum.


1 Answers

In Silverlight 3.0+, most likely, you will use WriteableBitmap for this. In WPF it also may be a good choice.

I wrote two demo applications in Silverlight. They may be little buggy, but they demonstrate the point.

  1. Hello world application. Definitely can be optimized. Performance isn't that good, but that's because I made something stupid. I believe it has ~2 500 ellipses:

alt text http://img42.imageshack.us/img42/5629/helloworld.jpg

  1. Slide show application. I can't recall number of objects here, but it's way more than 10 000.

alt text http://img11.imageshack.us/img11/5264/slideshowa.jpg

like image 108
Anvaka Avatar answered Sep 19 '22 18:09

Anvaka