Mike Swanson

March, 2006

  • Mike Swanson's Blog

    Miter Limits in Illustrator and WPF


    Continuing my series of posts on "gee, that's obscure," I thought I'd document the difference between miter limits in both Adobe Illustrator and the Windows Presentation Foundation (WPF). I ran into these differences while building my export plug-in, and they caused me a bit of pain.

    Both Illustrator and WPF support miter limits for connected line segments. Miter limits control how "pointy" your segments look where they're joined. Because miter limits in both Illustrator and WPF are relative to the thickness of the line, they are naturally more noticeable with larger stroke widths. For thick line segments that meet at very acute angles, the join can be very pointy...so much that it can look quite ridiculous. Miter limits allow you to control when Illustrator and WPF decide to trim—or bevel—the join.

    The two illustrations below show example miter limits and how they're handled by both systems. The actual content that is rendered to the screen is shown in black. Blue represents the line centers.

    Before we talk about limits, we need to understand the miter length. Miter lengths are measured differently between Illustrator and WPF. In Illustrator, the miter length is measured from the inside of the join to its outside point. In WPF, it's measured from the center of the join to its outside point. This effectively means that a miter length in WPF is half of what it would be in Illustrator.

    Miter limits are represented by ratios. In Illustrator, the default miter limit is 4, and the limit specifies a threshold. Essentially, a miter limit of 4 says: "if the miter length of this join is greater than 4 times my line thickness, bevel it; otherwise, allow the mitered join." In the left diagram, the dashed horizontal lines are each one line thickness away from each other. Notice that the miter length of the first join exceeds 4 times the thickness of the line. Because of this, Illustrator will bevel the join. The miter length of the second join falls below 4, so it is mitered (pointy). So, miter limits in Illustrator represent an either/or situation; either the line is beveled at the center of the join, or it is mitered. There is no in between.

    In WPF, the miter limit is used to clamp the miter length. The miter limit represents a ratio of the miter length to half of the line's thickness. In the right diagram, the dashed horizontal lines are each one half line thickness away from each other. The first join has a miter limit of 3, so it is beveled (trimmed) at 3 times one half of the line thickness. The second join is beveled at 2 times one half of the line thickness. Notice that—unlike Illustrator—miter limits in WPF are not treated as a threshold; they simply specify where to limit the miter.

    It's certainly possible to mathematically determine an equivalent miter limit between a single join in Illustrator and WPF. But, because most figures are made up of many joined line segments, and miter limits in WPF are set on the figure, there is no way to specify different miter limits for each join. This is precisely why my Illustrator to XAML Export Plug-In takes a conservative approach and specifies a miter limit of 1, thereby preventing the extremely pointy miters that would result for very acute angles. In retrospect, I suppose that setting a miter limit that is half that of Illustrator's might be a reasonable alternative.

    So, if you do notice some extra beveled lines in your exported artwork, you should first try removing the miter limit setting from your XAML. If the results are unsatisfactory, you'll need to play with the setting until you achieve visually desirable results.

    Special thanks to fellow Microsoft employee, Anthony Hodsdon, for his help in clarifying the WPF behavior.

  • Mike Swanson's Blog

    MIX06 Session Recordings


    The MIX06 conference in Las Vegas is over, and it was an outstanding event. Feedback has been almost universally positive, and attendees are encouraging us to do this again. MIX06 was a smaller, more intimate conference, and many of our presentations and panels were driven by our customers and partners. Personally, I loved the one-on-one engagement that I had with attendees. It's a fantastic way to get a lot of great product feedback and actually meet the people who are building on top of and extending our technology.

    If you weren't able to join us in Vegas, don't worry. We're working to get around 50 sessions of content across nearly three days prepped and published for your online enjoyment. We expect to finish the post production process in the next three to four weeks. Then, we'll be hosting everything for six full months, for free, for anyone (not just attendees). In addition to watching the video for each presentation, you'll be able to download each session for offline viewing.

    Since MIX06 is a web conference, we're delivering all of the post show content online. We won't be producing DVD sets like we did for PDC05. I've grabbed a screen shot of the current web interface, although I'm sure it'll change a little bit before we launch.

  • Mike Swanson's Blog

    Two New Expression March CTPs

    On Friday, we released March 2006 CTPs of both Expression Interactive Designer (formerly code named "Sparkle") and Expression Graphic Designer (formerly code named "Acrylic"). Although it may seem confusing, this version of EID works with the WinFX February 2006 CTP. The Expression team blog has a post about some of the changes. And just so you don't miss it, fellow evangelist, Karsten Januszewski, wrote about three of his useful EID discoveries.
  • Mike Swanson's Blog

    Managed Code on Xbox 360


    Yes, you read that correctly. In case you missed the announcement at the Game Developers Conference earlier this week, be sure to read about Microsoft XNA, specifically the XNA Framework. Here's the juicy part:

    A custom version of the Common Language Runtime is being built to enable the execution of managed code on an Xbox 360, and at GDC the XNA team showcased some exciting demonstrations of games which were built on an early version of this technology.

    More information from Brian Keller. Awesome!

  • Mike Swanson's Blog

    New IE7 Build and Developer Toolbar Update


    The IE team released the Internet Explorer 7 Beta 2 Preview build to coincide with the MIX06 conference. You can find more details about the release on the team's blog post.

    They've also released an updated beta 2 version of their Internet Explorer Developer Toolbar (more). I've posted about this very handy toolbar before, and if you do web development, this is definitely something you'll want to add to your toolbox.

Page 1 of 2 (6 items) 12