silverlight 3: pixel shaders

with pixel shaders in silverlight 3 effects such as blurs and drop shadows are literally one line of xaml markup – no code required.  More advanced effects can also be applied by writing your own pixel shader or leveraging the already converted WPF Pixel shade library for SL which can be found at http://wpffx.codeplex.com/ 

 

 

<Page

  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

  <Grid> 

        <Grid.ColumnDefinitions>

            <ColumnDefinition Width="300"/>

            <ColumnDefinition Width="*"/>

        </Grid.ColumnDefinitions>

        <StackPanel Margin="8" Grid.Column="0">

            <TextBlock Text="This text should be blurry" FontSize="20">

                <TextBlock.Effect>

                    <BlurEffect />

                </TextBlock.Effect>

            </TextBlock>

            <TextBlock Text="Shadow on Text" FontSize="20">

                <TextBlock.Effect>

                    <DropShadowEffect ShadowDepth="5" />

                </TextBlock.Effect>

            </TextBlock>

        </StackPanel>

        <StackPanel Margin="8" Grid.Column="1" Orientation="Horizontal" VerticalAlignment="Top">

            <Ellipse Height="100" Width="200" Fill="Blue" Margin="10 0 0 0">

                <Ellipse.Effect>

                    <DropShadowEffect ShadowDepth="10" />

                </Ellipse.Effect>

            </Ellipse>

        </StackPanel>

  </Grid>

</Page>

 

 


Comments

Comments are closed

About Me

Christian Thilmany is a User Experience Architect for Microsoft's Developer & Platform Evangelism Team and sits in Austin, TX