开发者

Icons in Silverlight: Images vs. Vectors

开发者 https://www.devze.com 2022-12-28 04:35 出处:网络
I like using the vector drawing feature of Expression Blend to create icons. That way I can change colors easily on my icons without having to resort to an image editor.

I like using the vector drawing feature of Expression Blend to create icons. That way I can change colors easily on my icons without having to resort to an image editor.

But my question is... Say I have a treeview control that has an icon next to each tree element and say I have hundreds of elements. Do you think using images is faster - performance wise than using vector icons? B/c I'd rather use vectors but开发者_如何转开发 I'm wondering about performance concerns.


Whenever you produce vector graphics that are static, use CacheMode to at least reduce the level of math needed to handle the said graphics (given Silverlight doesn't use GPU and relies on software rendering to perform tasks like this).

That being said, go for the Bitmap approach as much as you can as it's less tax on the CPU but obviously more tax in download - balancing act :(

A good article on this can be found here:


http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/archive/2009/04/16/silverlight-3-and-gpu-acceleration.aspx


Scott Barnes

(Former Silverlight Product Manager)


Yes it's probably faster to have little bitmap icons. But it's also probably negligibly faster. WPF itself uses little vectors for things like the + and - in tree views if you break down the templates. It's designed to handle things like this. I also prefer to use the vector icons.

The only other trouble you'll probably encounter is "fuzziness", that's just the nature of vector graphics but with icons it's possible to explicitly draw every pixel and get them exactly right and thus be a bit less fuzzy. The downside is, of course, if you need it to be displayed at any other size it looks much much worse.

Just have to weigh the trade-offs.

0

精彩评论

暂无评论...
验证码 换一张
取 消