concept ImageBrush in category c#

appears as: ImageBrush
Windows Store App Development

This is an excerpt from Manning's book Windows Store App Development.

In this chapter, I’ll start with coverage of the brushes, focusing on how colors are defined and used and how brushes make it possible to have solid colors as well as gradients. I’ll even get into coverage of the ImageBrush, which enables you to paint shapes and even text using a bitmapped image.

The final brush we’ll discuss in this chapter is the ImageBrush. Unlike the Solid-ColorBrush and LinearGradientBrush, the ImageBrush paints not with individual colors but with an entire image.

Use an ImageBrush when you need to fill an arbitrary shape with an image. Also consider using an ImageBrush instead of an Image element (covered later in this chapter) in cases where you need to show the same image a number of times on the same page, because the ImageBrush will generally perform better in that scenario.

I used an interesting photo in figure 7.4, but you’re not likely to find that type of ImageBrush use in top apps in the Windows Store. Yes, it was popular back in the day to paint fonts with images, but that generally doesn’t fit well in the Windows design aesthetic. Instead, you can use the ImageBrush to provide shaped clipping to images. For example, you may want photos to show up in a circular or oval frame. You can paint the image to an oval in that case.

Figure 7.4. ImageBrush being used to paint the itteh bitteh Internet Kitteh’s shocked face all over our UI