OpacityMask

This property only uses whatever the alpha channel value is for the supplied Brush. The other channels of the Brush's rendered content (e.g., Red, Green, or Blue) are ignored.

The most commonly used Brush for this purpose is an ImageBrush , which can be used for traditional "photo masking" techniques such as vignettes. But any defined Brush (such as LinearGradientBrush ) could be used.

In Extensible Application Markup Language (XAML), this property value can use an inline syntax that is specific to any given implementation of the Brush abstract class. This inline syntax will vary between each type of implementation. See Painting with WinFX Brushes for more information.


<!-- With the Opacity Mask-->
<Image
  Height="150"
  Width="200"
  Source="sampleImages/Waterlilies.jpg"
  HorizontalAlignment="Left"
  Margin="10"
  Grid.Column="2" Grid.Row="1">
  <Image.OpacityMask>
    <ImageBrush ImageSource="sampleImages/tornedges.png"/>
  </Image.OpacityMask>
</Image>

opacityMask.rar



你可能感兴趣的:(opacity)