Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I would use the Effect property of whatever the client area you wish to gray scale. You will however need to create your own pixel shader to do the gray scale conversion.</p> <p><a href="http://windowsclient.net/wpf/wpf35/wpf-35sp1-more-effects.aspx" rel="nofollow noreferrer">http://windowsclient.net/wpf/wpf35/wpf-35sp1-more-effects.aspx</a></p> <p>You could quickly test your concept by using the BlurEffect class instead of a custom shader. </p> <pre><code>&lt;Window x:Class="WpfGrayscaleSample.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Window1" Height="327" Width="526"&gt; &lt;Grid&gt; &lt;Grid.RowDefinitions&gt; &lt;RowDefinition Height="239*" /&gt; &lt;RowDefinition Height="50*" /&gt; &lt;/Grid.RowDefinitions&gt; &lt;Canvas Name="clientArea" Background="Transparent" Grid.Row="0"&gt; &lt;!-- Just some controls --&gt; &lt;Button Height="31" Name="button1" Width="80" Canvas.Left="30" Canvas.Top="125"&gt;Button&lt;/Button&gt; &lt;Button Height="28" Name="button2" VerticalAlignment="Bottom" Click="button2_Click" HorizontalAlignment="Right" Width="75" Margin="0,0,16,34" Canvas.Left="66" Canvas.Top="54"&gt;Button&lt;/Button&gt; &lt;Rectangle Margin="86,43,0,0" Name="rectangle1" Stroke="Black" Fill="Crimson" Height="59" HorizontalAlignment="Left" VerticalAlignment="Top" Width="109" Canvas.Left="145" Canvas.Top="44" /&gt; &lt;/Canvas&gt; &lt;!-- Button to activate the shader effect --&gt; &lt;Button Height="23" Margin="15,0,0,21" Name="button3" VerticalAlignment="Bottom" HorizontalAlignment="Left" Width="75" Grid.Row="1" Click="button3_Click"&gt;Button&lt;/Button&gt; &lt;/Grid&gt; </code></pre> <p></p> <p>And the event handler for button3 would simply be</p> <pre><code> private void button3_Click(object sender, RoutedEventArgs e) { clientArea.Effect = new BlurEffect() { Radius = 10.0 }; } </code></pre> <p>Of course it is a bit more work to hook up the custom shader for the gray scaling, but the added bonus of the pixel shader is going to be performance.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload