Welcome to MSDN Blogs Sign in | Join | Help

Added BMP Decoder

I updated the Image Source samples to include the BMP Decoder (missing from my previous post).

Posted by jstegman | 1 Comments

Kitchen Updates

I updated my Kitchen PhotoZoom gallery with a few photos to show some progress I made over the last few weekends.  Updates include adding crown to the cabinets some casing updates and we put in the backsplash (not grouted yet).   The backsplash, shown below, is white ceramic subway tiles (3x6) with glass tile accents.

 

 

PhotoZoom sample

 

 

Posted by jstegman | 1 Comments

Updated Source for Image Samples

Updated on 11/10 to fix the ZIP archives and add dependent projects.

In addition to updating the image samples to the final version of Silverlight V2, I've also updated the source:

For each of these samples, you'll need the following project:

Posted by jstegman | 4 Comments

More Silverlight Controls

Good news for anyone looking for more Silverlight controls including better chart/graph controls.  The Silverlight Toolkit just released on CodePlex and includes numerous new controls with source.  You can find a controls sample page here and a charting sample page here.  The controls include the following:

  • TreeView
  • AutoCompleteBox
  • DockPanel
  • WraPanel
  • Label
  • Expander
  • HeaderedItemControl
  • HeaderedContentControl
  • NumericUpDown
  • ViewBox
  • ButtonSpinner
  • ImplicitStyleManager
  • Charts (Pie, Bar, Column, Scatter and Line)
  • Several theming samples
Posted by jstegman | 1 Comments

PhotoZoom Sample

My goal was to update my DeepZoom sample to RTM using the DeepZoom composer but decided to directly use PhotoZoom as I needed that for some general photo storage anyway.  The nice thing about PhotoZoom is that it automatically generates a Silverlight 2 DeepZoom view based on the uploaded photos.  I've added a couple of galleries that capture some of the home improvement projects I've been working on.  Here's a snapshot of the auto-generated DeepZoom view for my Kitchen remodel photos.

 

 

 

PhotoZoom sample

 

 

Here's another on for a mantle rebuild.

Posted by jstegman | 2 Comments

Silverlight 2 Sample Updates

I updated the PNG, GIF and BMP samples to the final version of Silverlight 2 including addressing several reported bug fixes.
Posted by jstegman | 3 Comments

Sample Updates for Beta 2

I updated a few of my most recent samples to work with the Beta 2 version of Silverlight 2.  You can find general information on Beta 2 in the getting started section on Silverlight.net.  Scott Guthrie also has a good write-up on some of the new features in Beta 2 and you can find that here.

 

You can find a Beta 2 version of the DeepZoom Silverlight 2 Developer Reference Poster sample here.  To build this sample, I used the Beta 2 update of the DeepZoom Composer.  You can find more information about this tool including a download link here.  Here’s a screen shot of updated sample:

 

DeepZoom sample

 

 

I updated and enhanced the Silverlight PNG encoder sample.  I fixed a few bugs in the Pixel APIs reported by folks from the community (thanks if you were one of those).  I also updated the Mandelbrot part of this sample to support zooming – which is really the cool part of the Mandelbrot set.  You can find the Beta 2 source for this sample here.  Here’s a screen shot of the updated sample:

 

 

PNG Encoder Sample

 

To further test the Pixel APIs, I wrote a BMP decoder and then connected that to the PNG encoder to create a sample that supports display of any standard BMP file.  As part of this sample, I wrote a few image filters on top of this including a Sepia tone filter.  You can find a Beta 2 version of the sample here and the source here.  Here’s a screen shot of this sample:

 

 

BMP Decoder Sample

 

Similar to the BMP decoder sample, I took Jill Zhang’s .NET based GIF Utility sample from CodePlex and ported it to Silverlight to create a Silverlight based GIF decoder.  I used this with the PNG encoder to create a sample that does GIF decode and display in Silverlight.  The GIF Utility supports reading all GIF frames (e.g. Animated GIF support) and my sample shows how you can use this to support animated GIFs in Silverlight.  You can find a Beta 2 version of the sample here and the source here.  Here’s a screen shot of this sample that shows the results of reading a GIF with multiple frames:

 

 

GIF Decoder Sample

 

Posted by jstegman | 4 Comments

Updated PNG Generator Sample

I fixed a few bugs in the ImageGenerator sample.  One was related to non-square images and the other was related to images larger than 64K.  If you're using this sample, you'll want to pick up the updated source here.


Thanks to planetmarshalluk for the bug report on the 64K issue.
Posted by jstegman | 2 Comments

Dynamic Image Generation in Silverlight

 

I’ve posted a sample PNG image generator here (Beta 1 bits). 

 

This has 3 dynamically generated images – one randomly filled 64x64 image that’s updated at 6 frames/sec.  A second 128x128 image with a gradient fill and a third that’s a 512x512 dynamically generated image of the Mandelbrot set.  When running the page you’ll see performance is quite good (each page refresh will re-create all images).  Note that there are still some optimizations that can be made to minimize re-writes of bytes and if anyone updates this, let me know and I’ll post the updated sample.

 

You can find the source here.  It’s fairly small as I don’t generate a compressed image and therefore don’t need the PNG compression library (ZLIB).  On the flip side, the dynamically generated image is not well suited for local storage since its not compressed.

 

The API to dynamically generate an image and assign it to an Image element is fairly straight-forward:

 

      ei = new EditableImage(height, width);      // EditableImage class from this sample

      image = new BitmapImage();

 

      // Generate gradient filled image

      for (int idx = 0; idx < height; idx++)      // Height (y)

      {

        for (int jdx = 0; jdx < width; jdx++)     // Width (x)

        {

          ei.SetPixel(jdx, idx, (byte)idx, (byte)jdx, 255, 255);

        }

      }

 

      // Get stream and set image source

      image.SetSource(ei.GetStream());

      img2.Source = image;                  // img2 is an Image element

 

 

Image sample
Posted by jstegman | 18 Comments

Silverlight in Financials Sample

Jaime Rodriguez posted a nice financials sample built using Silverlight 2 Beta 1.  Very cool and gives you a nice taste of some of the power of Silverlight 2.


Financials Image
Posted by jstegman | 3 Comments

DataGrid Sample from Mix08

I've been asked by a few folks to post the DataGrid sample I showed in my Mix08 talk.  This uses the same backend and data source as the Mix08 sample below but uses a DataGrid rather than an ItemsControl for the UI.  There was a bit of XAML required in order to get the DataGrid to do the masters view - this was provided to me Scott Morrison, the DataGrid Program Manager.  The XAML required to do the formatting is (assumes you’ve mapped the System.Windows.Controls.Data assembly to an XML namespace identified as “data”):

    <data:DataGrid x:Name="results" RowHeight="60" IsReadOnly="True" Width="800" Margin="14"

      RowBackground="#99FFFFFF" AlternatingRowBackground="#66FFFFFF"

      HeadersVisibility="None" GridlinesVisibility="Horizontal"            

      RowDetailsVisibility="VisibleWhenSelected" SelectionMode="SingleFullRow">

      <data:DataGrid.Columns>

        <data:DataGridTemplateColumn Width="80">

          <data:DataGridTemplateColumn.CellTemplate>

            <DataTemplate>

              <Border CornerRadius="5" BorderThickness="1" Margin="5" BorderBrush="DarkGray" Background="Black">

                <Image Source="{Binding ImageUrl}" Stretch="UniformToFill" Margin="1"/>

              </Border>

            </DataTemplate>

          </data:DataGridTemplateColumn.CellTemplate>

        </data:DataGridTemplateColumn>

         

        <data:DataGridTextBoxColumn DisplayMemberBinding="{Binding Title}" FontSize="20" FontWeight="Bold" Width="527"/>

         

        <data:DataGridTemplateColumn Width="165">

          <data:DataGridTemplateColumn.CellTemplate>

            <DataTemplate>

              <StackPanel VerticalAlignment="Center">

                <TextBlock Text="Source" Foreground="#666666" FontWeight="Bold" FontFamily="Trebuchet MS" FontSize="14"/>

                <TextBlock Text="{Binding Source}" FontFamily="Trebuchet MS" FontSize="14"/>

              </StackPanel>

            </DataTemplate>

          </data:DataGridTemplateColumn.CellTemplate>

        </data:DataGridTemplateColumn>

      </data:DataGrid.Columns>

     

      <data:DataGrid.RowDetailsTemplate>

        <DataTemplate>

          <!-- MouseLeave -->

          <Grid Margin="5,5,5,0" Background="Transparent">

            <Grid.ColumnDefinitions>

              <ColumnDefinition />

              <ColumnDefinition Width="Auto"/>

            </Grid.ColumnDefinitions>

             

            <Grid.RowDefinitions>

              <RowDefinition Height="Auto"/>                           

              <RowDefinition Height="10" />

            </Grid.RowDefinitions>

             

            <StackPanel>

              <TextBlock Text="{Binding Description}" TextWrapping="Wrap" Margin="5" FontFamily="Trebuchet MS" FontSize="16"/>

              <TextBlock Text="Posted On:" Foreground="#666666" Margin="5,5,5,0" FontFamily="Trebuchet MS" FontSize="14" FontWeight="Bold"/>

              <TextBlock Text="{Binding PublishDate}" Margin="5,0,5,5" FontFamily="Trebuchet MS" FontSize="14"/>

              <TextBlock Text="View Count:" Foreground="#666666" Margin="5,5,5,0" FontFamily="Trebuchet MS" FontSize="14" FontWeight="Bold"/>

              <TextBlock Text="{Binding ViewCount}" Margin="5,0,5,5" FontFamily="Trebuchet MS" FontSize="14"/>

            </StackPanel>

 

            <Border Grid.Column="1" Height="330" Width="440" CornerRadius="5" BorderThickness="1" Margin="5" BorderBrush="DarkGray" Background="Black" VerticalAlignment="Top">

              <Grid>

                <MediaElement Margin="2" Source="{Binding VideoUrl}" AutoPlay="True"/>

                <Button Content="Play" Width="50" Height="50" Margin="0,0,0,35" Opacity="0"/>

              </Grid>

            </Border>

          </Grid>

        </DataTemplate>

      </data:DataGrid.RowDetailsTemplate>

    </data:DataGrid>

The application output is nothing more than a Deep Zoom version of the poster:

Formatted DataGrid

Posted by jstegman | 4 Comments

Deep Zoom version of Silverlight 2 Developer Reference Poster

I took a reasonable resolution version of the Silverlight 2 Developer Reference Poster and crossed that with the Deep Zoom Composer, added a JS mouse wheel library and in about 5 minutes had a Deep Zoom version of the poster running in Silverlight.  The sample is posted here.

The XAML is simple – just point the MultiScaleImage element to the output of the Deep Zoom Composer.

  <Grid x:Name="LayoutRoot" Background="White">

    <MultiScaleImage x:Name="img" Source="poster/info.bin"/>

</Grid>

The JavaScript is a bit more complex and you can find that here.


Deep Zoom Poster

Posted by jstegman | 15 Comments

Another Mix08 sample

I've posted