Archive for August, 2006

Asia Travels

On Thursday, I leave for Malaysia & China for a trip with equal parts business and pleasure.  Very excited!

I’m bringing along both my film SLR & my digital point and shoot.  So they’ll be some real time photo and a bunch of back-postings when I return.

 

Malaysia

time: gmt/utc +8 (noon in seattle = 3am next day in kuala lumpur)

currency: 1 usd = 3.68 ringgit (rm)

weather: 80F, showers (forecast)

 

China

time: gmt/utc +8 (noon in seattle = 3am next day in beijing)

currency: 1 usd = 7.97 yuan

weather: 80F, rain (forecast

Vista & Glass

I really like glass - it’s just so clean & elegant.  The only thing I don’t like is the default “color” - it comes out way too blue.  I know the hue is subtle, but it just clashes with everything else on the desktop.

My recommendation is to use “Frost” with transparency bumped all the way down.  It’s much better.  :)

 

default glass

 

frost glass with low transparency

Redwood National Forest

This past weekend, I was in Arcata, California with my folks for a wedding.  We wandered up to Redwood National Forest yesterday.  It was incredibly foggy… and a bit too reminiscent of Seattle weather.  :-)  But it was incredibly beautiful, and we had a fun time.

the redwoods.

 

driftwood on the shore

 

my parents

 

an old house in trinidad

Paragliding - Tiger Mountain

This past weekend, I went paragliding for the first time.  It was a “tandem flight” off Poo Poo Point on Tiger Mountain.  The weather was perfect: blue skies, warm sun.

I was in the first group to go up.   It was beautiful up in the air - very mellow and serene.  I actually had hoped for a bit more “extreme adventurous”…  but maybe next time. :-)  I did seem some wicked looking spirals from other paragliders.

 

Some photos:

The dude on the far right was supposed to act as ”ballast”…

 

….but the wind was so strong I just popped right up…

 

  

looking up..

 

looking down…

 

 

looking back…

Appreciating "Digital" Retouching

I took these photos on one of my favorite hikes ever: Oyster Dome in the Chuckanut Mountains last April. My friend Archana and I caught one of the first sunny spring days. As you can see, there were some amazing views of the San Juan islands.

I remember being somewhat heartbroken when I picked up the prints.  I hadn’t meant to do a silhouette (although I like it more now). And, the sunspot in the middle of the frame *killed* me.

But last night, I took out the sunspot, blended away the negative scratches… and lighted the tone a bit.  It was pretty cool.  Now, if only Nikon had an (affordable) full frame digital SLR…


scanned image, pre-photoshop

 


scanned image, post-photoshop for scratches & sunspot.

 


scanned image, post-photoshop for backlighting.

More Photos from Travels

Going through my stacks of negatives, it hit me how lucky I’ve been to travel. Here are a few more of my favorites from an early 2004 trip.


charles bridge in prague, czech republic

 


prague, czech republic

 


park guell in barcelona, spain

 


kunming, china

 


tiger leaping gorge, china

FontPlayer XBAP

I thought it would be fun to update the UI (and some functionality) for the FontPlayer SDK sample. This app lets you to play with the fonts installed on your the machine. It also shows off the OpenType features of specific fonts.

Some of the interesting features that I added to this app:

  • Embedded fonts in XBAP
  • ComboBox bound to system fonts, displayed using font
  • New CheckBox template
  • Text “reflection” effect

FontPlayer works with RC 1. Run it here. Code found here.

Screen Shots - Details


custom font


font ComboBox


new CheckBox template

Embedded fonts in XBAP
Custom fonts are a great way to brand the look & feel for your app. WPF’s embedded font support means I can use a custom font in a web app without affecting/installing system fonts.

In this app, I’m using Robby’s custom font, Ingebretsen Neato. To accomplish this, I included “Ingebretsen Neato.ttf” in the project and then referenced it in this style:


  <Style x:Key="Heading" TargetType="{x:Type TextBlock}"  >
    <!– Custom font from http://notstatic.com –>
    <Setter Property=”FontFamily”
        Value=”./Resources/#Ingebretsen Neato” />
    <Setter Property=”FontSize” Value=”20″ />
    <Setter Property=”Foreground” Value=”#FFFFFFFF”/>
    <Setter Property=”HorizontalAlignment” Value=”Center”/>
  </Style>

The text team’s blog has a lot more info about fonts & typography if you’re interested.

ComboBox bound to system fonts

The XAML to create a ComboBox bound to the system’s font:


  <ComboBox Name="FontFamilyComboBox"
    ItemsSource=
       ”{Binding Source={x:Static media:Fonts.SystemFontFamilies}}”
    ItemTemplate=”{StaticResource FontFamilyTemplate}”
    SelectionChanged=”FontFamilySelectionChanged”
    Width=”150″ HorizontalAlignment=”Center”
  />

In order display the font names in the actual font, I used a data template w/ a type converter.


  <local:FontFamilyToStringConverter x:Key="FontFamilyToString" />
  …
  <DataTemplate x:Key=”FontFamilyTemplate” >
    <TextBlock
      Text=
        ”{Binding Converter={StaticResource FontFamilyToString}}”
      FontFamily=”{Binding}”
    />
  </DataTemplate>

The type converter was defined in the code-behind file:


  public class FontFamilyToStringConverter : IValueConverter
  {
    public object Convert(object value, Type targetType,
                          object parameter, CultureInfo culture)
    {
       FontFamily fontFamily = value as FontFamily;
       return fontFamily.ToString();
    }
    …  
  }

New CheckBox template

I thought that a new look & feel for the CheckBox would more sense for toggling the options. I based the control template on Robby’s SimpleStyles. I then animated the opacity of the OptionsGrid based on the CheckBox.Checked event.

To see it, look at Resources\CheckBox.xaml.

Loose XAML, XBAPs & Hyperlink Images

As Mark Alaczar points out in his WPF sandbox whitepaper, sandboxed top level navigation requires user initiation.

Some definitions to help this make sense:

  • Top level navigation: Navigations that target the hosting web browser. For instance, navigating the entire browser, or a specific HTML <iframe>, to http://netfx3.com.
  • User initiated: Direct result of an explicit user action. In the case of top level navigation, this is most likely the user clicking on a hyperlink. “Programmatic”, on the other hand, is the direct result of a dev action, like NavigationService.Navigate(…).

In this version of WPF, top level navigations in sandboxed apps require “user initiation.” Today, only the Hyperlink class has this notion of “user-initiatedness,” and it cannot (for security reasons) be subclassed in the internet sandbox.

There are many cases, however, where a more interesting Hyperlink than the default is desired. This post uses styling to create an image hyperlink that works in the internet sandbox.

Hyperlink is an inline-level flow content element that derives from TextElement, not ContentControl. This means it must be put inside of a text element container like Paragraph or TextBlock.

To create a more general control that can be used in different layout containers, you can use a ContentControl with the following style:

<ControlTemplate TargetType="ContentControl" x:Key="Hyperlink">
  <TextBlock Text=”" TextWrapping=”Wrap”>
    <Hyperlink TextDecorations=”" NavigateUri=”http://www.netfx3.com”>
      <Image Style=”{StaticResource HyperlinkImage}”>
      </Image>
    </Hyperlink>
  </TextBlock>
</ControlTemplate>

You can than style the image, perhaps adding a mouse over trigger:

<Style x:Key="HyperlinkImage" TargetType="{x:Type Image}">
  <Setter Property=”Source”>
    <Setter.Value>
      <BitmapImage UriSource=”flowers_color.jpg”/>
    </Setter.Value>
  </Setter>

  <Setter Property=”HorizontalAlignment” Value=”center”/>
  <Setter Property=”VerticalAlignment” Value=”center”/>
  <Setter Property=”Stretch” Value=”Uniform”/>
  <Setter Property=”IsEnabled” Value=”true”/>

  <!– Hover Trigger to change image source–>
  <Style.Triggers>
    <Trigger Property=”Image.IsMouseOver” Value=”true”>
      <Setter Property=”Image.Source”>
        <Setter.Value>
          <BitmapImage UriSource=”flowers_bw.jpg”/>
        </Setter.Value>
      </Setter>
    </Trigger>
  </Style.Triggers>
</Style>

Then create the ContentControl itself:

<WrapPanel Margin="40" Orientation="Vertical">
  <ContentControl  Width=”100″ Template=”{StaticResource Hyperlink}”/>
</WrapPanel>

You can try it out in loose xaml here.