Mike Swanson

February, 2009

  • Mike Swanson's Blog

    Test Version of My Illustrator to XAML Plug-In for the Mac


    One of the most frequent questions I get related to my Adobe Illustrator to XAML Export Plug-In is: “does it run on a Mac?” Unfortunately, the answer has always been “no,” because I’ve never owned a Mac, and I’ve never done any Mac development…ever. If you can believe it, the last Apple computer I wrote code for was the Apple IIe. Those were the days!

    Last week, I asked around the office, and between Tim Sneath and Thomas Lewis, I was able to borrow a Mac Mini to play around with (thanks, guys!). I installed OS X Tiger and Xcode 2.5, because I wanted to target the Illustrator CS3 SDK (which recommends that OS/tool combination). I would have gone back a bit further, but the CS and CS2 SDKs are both based on CodeWarrior, and I didn’t want to make my situation any more difficult by using even older versions of the OS and tools. Because of this choice, the plug-in should work fine with Illustrator CS3 and CS4, though I’ve only been able to test it on CS4 myself.

    Fortunately, when I wrote the original plug-in for the PC version of Illustrator, I mostly stuck to the platform agnostic functionality and types that are exposed by the SDK. This made it much easier to port the code to the Mac. Here are the three biggest challenges I encountered:

    • General unfamiliarity with the Mac – since I haven’t used a Mac since the Mac Classic (before it was even called “Classic”), just finding my way around the system felt like I was exploring an alien planet. Where did my Illustrator window go!?!?
    • Xcode – being unfamiliar with the Mac didn’t make it any easier to understand the project system or the Xcode developer tools. And Carbon? What’s that? :-)
    • Platform-specific code – if you’ve used the PC version of the plug-in, you know that you can hold down the left shift key during export to pop-up your default XAML viewer; if you hold down the right shift key, your WPF export uses DrawingBrush syntax. The Mac API that I found doesn’t allow me to distinguish between the left and right shift keys, so the Mac version exports DrawingBrush syntax regardless of which Shift key is held down.

    If you’d like to help test, download Mac version 0.18 (see update below) and copy the XAMLExport.aip file to your Illustrator plug-in folder. Like the most recent PC version, you’ll find "XAML for Silverlight (*.XAML)" and "XAML for WPF (*.XAML)" as new formats under File/Export. I’ve run many files from my test suite through the plug-in and have so far been able to add all of them successfully to Expression Blend 2 on my PC.

    It may help to read through the Features list on my plug-in page to see what works and what doesn’t. Also, I’d love it if someone could test it with Illustrator CS, CS2, and CS3 and report their results…I only have CS4 on the Mac.

    Thanks in advance for your help and feedback!

    Update: A newer version of the plug-in is now available, including version 0.19 for both the PC and the Mac.

  • Mike Swanson's Blog

    My Windows 7 Beta 1 Experience


    As mentioned in a recent post about My Windows 7 Theme Pack, I’ve been running Beta 1 (build 7000) for awhile now, and I love it!

    Windows 7 feels nimble, it doesn’t get in my way, and it lets me access and organize my work using some very natural conventions. In earlier versions, I’ve always known that I can right-click on the taskbar and select Tile Vertically to arrange my applications. But guess what? I very rarely did it. However, in Windows 7, a simple drag of the window to the right or left edge of the screen performs this task much more naturally. And once I learned that I can use Windows + Right/Left Arrow as a keyboard shortcut, well…I find myself using this all the time.

    Most of the improvements—for me—are along the same lines. It’s as if Windows 7 gets out of my way while at the same time exposing the tasks that I need to perform in fresh and friendly ways. I right-clicked an ISO file the other day to see if I had my DVD burning software installed only to find that Windows 7 has a “Burn disc image” option built-in. How cool is that?

    I’ve also found myself using the taskbar full-screen preview feature to “glance” at other windows without actually switching to them. How often are you in an application like Microsoft Word when you need to refer to some data on a web page or in an Excel spreadsheet? Normally, I’d have to switch to the application, look at the data, then switch back. In Windows 7, I simply hover over the thumbnail on the taskbar, see a full-screen preview of the window, and when I move the mouse away from the thumbnail, I’m back in Word. Effortless.

    It’s all of these little flourishes that make the overall experience so much better. For a more comprehensive review of Windows 7, check out Paul Thurrott’s SuperSite.

    I’m running Windows 7 on my desktop machine at home, my desktop at work, and my primary laptop. Across all three of these machines, I’ve had a chance to install and use lot of software. While I haven’t exhaustively tested all of the applications, I have been using them with no significant issues. I thought I’d pass along the list for those who are curious (I linked to the lesser-known applications for reference):

    • Adobe Illustrator CS3 & CS4 (32- and 64-bit)
    • Adobe Photoshop Lightroom 2.2
    • Adobe Photoshop CS3 & CS4
    • Adobe Reader 8 & 9
    • Call of Duty: Modern Warfare
    • Call of Duty: World at War
    • Crayon Physics Deluxe
    • CuteFTP Home 8
    • DxO Optics Pro 5.3.2
    • Expression Blend 2
    • Expression Web 2
    • Far Cry 2
    • Focus Magic 3.02
    • HP Photosmart Pro B9180
    • Microsoft LifeCam VX-6000
    • Nero 8 (I mostly use Nero Burning ROM and Nero Vision)
    • Nikon Scan 4.0.2
    • Noise Ninja 2.3.2

    The only real issues I’ve had relate to the two scanners at home:

    • Nikon SUPER COOLSCAN 5000 ED – A great negative and slide scanner, but this older product doesn’t have a 64-bit driver. This is the only reason I’m not currently running 64-bit Windows 7 at home. Fortunately, the 32-bit driver works perfectly.
    • Epson Perfection V700 Photo – The scanner works fine when using a USB 2.0 connection, but it will not work when using IEEE 1394 (FireWire). The IEEE 1394 connection works fine with Windows Vista, and this is the only thing I’ve found that is compatible with Vista but not with Windows 7. I’ve notified the Windows team so they can investigate.

    Overall, Windows 7 is a joy to use. If you want to give it a spin, you have until Feburary 10th to download the beta.


  • Mike Swanson's Blog

    Native Text and Symbol Support Added to My Illustrator to XAML Plug-In


    Wow! I can hardly believe that this is the third post on my Illustrator to XAML plug-in in the past month. After not touching the code for well over two years, it’s been fun digging back into the project. Adding Mac OS X support has been a brand new challenge for me, and I’ve enjoyed every minute. The response to the test version of the Mac plug-in has been fantastic. It’s clear to me that there are a lot of Illustrator users on the Mac who want to work with Silverlight and WPF! The good news is that the PC and Mac codebases for the plug-in are essentially in-sync, and any improvements that I make in the future should apply to both versions.

    One of the more common requests I’ve received is for native text support. As a matter of fact, native text support was one of the first features I started to build way back in 2005. At the time, though, when I dug-in to the Adobe Text Engine (otherwise known as ATE), it seemed like I had teleported into another dimension. The text engine provides a lot of typographic flexibility, and the API is newer than many of the more traditional APIs in Illustrator. I was already in unfamiliar territory building a plug-in, let alone learning about yet another deep and complex API. So, I disabled my early text code, and it’s been dormant ever since. The workaround has always been “convert your text to outlines before you export.” Of course, this method offers very little flexibility when you want to dynamically change text at runtime, and the text outlines significantly bloat the XAML.

    The new version of the plug-in exports native point text. However, it does not export text that has been fitted to a path (for an example of this limitation, check out the Yellowstone Map illustration on my updated Eye Candy page). Fortunately, most text in Illustrator is point text, so this shouldn’t present a problem for common cases. Illustrator also supports many advanced text features that are not currently exported, so you may notice differences in the way text is rendered. One of the text features that is not handled is the relative spacing between letters and words, otherwise known as tracking. Here’s an example of some Illustrator text with increased tracking (top) and how the exported XAML is rendered with WPF (bottom):

    I added the red lines to show that the anchor point of each TextBlock element is correctly aligned. However, because the tracking value is not accommodated in the XAML, each text run falls out of alignment. By the way, the Illustrator API returns three individual glyph runs for this single word, which is why there are three TextBlock elements. Since all of the other attributes of this text run are identical (color, baseline, font size, font family), a future enhancement to the plug-in should combine all three of these glyph runs into one. For now, the manual solution would be to simply delete all but the first TextBlock.

    While I was digging through the code, I also uncommented some early work I had begun on symbols. In Illustrator, a symbol is an art object that can be reused multiple times within a single document. So, after a symbol is created, instances of that symbol can be added to the document many times without having to create multiple copies of complex artwork. A great example of symbol use can be seen in the aforementioned Yellowstone Map on the Eye Candy page. I’ve included a small section of the map to the right showing square black symbols used to mark picnic areas, food, lodging, etc. Ideally, symbols would be exported to a ResourceDictionary and referenced in the exported XAML, though this is not the case in the current version.

    The last tweak I made was to improve the behavior of the shift keys in the PC version. The keyboard detection logic I was using seemed unreliable, and often times, the XAML editor would launch even though the left shift key was not being held down. I’ve received a handful of e-mail inquiries about this behavior, and I’m happy to say that I was able to fix it in this version. Why shift keys instead of dialog box choices, you ask? Well, it’s mostly because I didn’t want to spend the time to learn how to use the Adobe Dialog Manager (ADM)…yet another complex API. Plus, I’ve grown to like the simplicity and ease of the shift key approach.

    I updated the Adobe Illustrator to XAML Export Plug-In site to bring it a bit more up-to-date. Nothing radical, though I did use Robby Ingebretsen’s fantastic Kaxaml editor to create some new visuals (thanks, Robby!). There’s also installation instructions for both PC and Mac along with download links to the most recent version.

    If you’re planning to attend MIX09 and want to chat about the plug-in (or anything, really), send me a tweet when you’re in Vegas, and I’m happy to hook-up. Otherwise, feel free to leave comments, feedback, and suggestions to this post or drop me a line directly.

    Most of all, have fun! :-)

Page 1 of 1 (3 items)