Skip to main content

Microsoft Silverlight

Answered Question Image vs Rectangle & ImageBrushRSS Feed

(0)

Grofit
Grofit

Member

Member

229 points

310 Posts

Image vs Rectangle & ImageBrush

 Hey,

Just wondering if anyone knows off top of their head which is faster for bulk drawing... lets say you have 1000 on screen, would it be faster to have 1000 images, or 1000 rectangles with image brushes set. Im sure in Flash their image objects were fairly slow... not like the inside of SL is anything like flash...

ksleung
ksleung

Contributor

Contributor

5366 points

1,028 Posts

Answered Question

Re: Image vs Rectangle & ImageBrush

Don't have any solid data but I'd imagine they are the same or about the same?

A rectangle with Image brush is for all practical purpose the same as an image in the following sense: (1) they are both UI elements, (2) from an image you read the pixels off its image source, and from a rectangle you get the pixel from the image brush which maps coordinates to pixel values...  Perhaps imageBrush is slightly slower because there is this coordinate-to-pixel-value translation, and this translation is generic (like it must also work for fill, gradient, etc).  But should be about the same?

But this is just my guess.

MarkMonster
MarkMonster

Contributor

Contributor

5220 points

1,046 Posts

Re: Image vs Rectangle & ImageBrush

I know the ImageBrush will be faster when you use Path, compared to Image with Clipping.

Mark Monster - MCPD Enterprise
http://mark.mymonster.nl
Silverlight and Expression Insiders UG

Dont forget to click "Mark as Answer" on the post that helped you.

Grofit
Grofit

Member

Member

229 points

310 Posts

Re: Image vs Rectangle & ImageBrush

 Good to know, at the moment its just a LOT of stuff on screen alot of images are the same but they all have different translations.

Ive tested it myself with both but i didnt notice any performance difference, so was just wondering if anyone had tested and there was a slight difference with each?

MarkMonster
MarkMonster

Contributor

Contributor

5220 points

1,046 Posts

Answered Question

Re: Image vs Rectangle & ImageBrush

This kind of information about Performance tips can be found in Essential Silverlight 3: http://www.amazon.com/Essential-Silverlight-Microsoft-NET-Development/dp/0321554167

Mark Monster - MCPD Enterprise
http://mark.mymonster.nl
Silverlight and Expression Insiders UG

Dont forget to click "Mark as Answer" on the post that helped you.
  • Unanswered Question
  • Answered Question
  • Announcement
Microsoft Communities