<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://www.windows-now.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Nathan Dunlap : DrawingBrush</title><link>http://www.windows-now.com/blogs/ndunlap/archive/tags/DrawingBrush/default.aspx</link><description>Tags: DrawingBrush</description><dc:language>en</dc:language><generator>CommunityServer 2008 SP2 (Build: 31104.93)</generator><item><title>Creating Clip Art for Avalon</title><link>http://www.windows-now.com/blogs/ndunlap/archive/2004/05/17/3493.aspx</link><pubDate>Mon, 17 May 2004 22:44:00 GMT</pubDate><guid isPermaLink="false">20f58a17-7e15-440c-89b3-dfe02fe74bcd:3493</guid><dc:creator>ndunlap</dc:creator><slash:comments>25</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://www.windows-now.com/blogs/ndunlap/rsscomments.aspx?PostID=3493</wfw:commentRss><comments>http://www.windows-now.com/blogs/ndunlap/archive/2004/05/17/3493.aspx#comments</comments><description>&lt;P&gt;&lt;FONT face=Arial size=2&gt;I've been asked how I created different Clip Art pieces in my demos a lot recently so I figure this is a good topic to blog on. If any of you have taken a look at typical path data, you are aware that its pretty&amp;nbsp;painful to even&amp;nbsp;think about manipulating or creating path content without some sort of tool. One way I have gotten around this is to turn Microsoft Office into a makeshift editor for creating Avalon ready Clip Art using the Windows Client Printer Driver. Here is a simple how-to:&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;First make sure you have installed the Windows Client Printer Driver. &lt;/FONT&gt;&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;&lt;FONT face=Arial size=2&gt;Open &amp;#8220;Add/Remove Programs&amp;#8221; from the Control Panel.&lt;/FONT&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;FONT face=Arial size=2&gt;Click on "Add or Remove Windows Components"&lt;/FONT&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;FONT face=Arial size=2&gt;In the components list click the checkbox for "Windows Client Printer Driver"&lt;/FONT&gt;&lt;/LI&gt;&lt;/OL&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;After install is complete you can access the Printer driver from any application that supports printing. I'm not aware of how well other applications will do when working with the printer driver, but I do know that Office 2003 works great.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;Here is how I get clipart from&amp;nbsp;Microsoft Word&amp;nbsp;into my XAML projects.&lt;/FONT&gt;&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;&lt;FONT face=Arial size=2&gt;Open a document in Microsoft Word.&lt;/FONT&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;FONT face=Arial size=2&gt;Click Insert &amp;gt; Picture &amp;gt; Clip Art...&lt;/FONT&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;FONT face=Arial size=2&gt;Change dropdown for "Results should be:" to only search on Clip Art. You can even filter it down further based on file type. I have most success searching for .wmf files only.&lt;/FONT&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;FONT face=Arial size=2&gt;Perform your Clip Art search.&lt;/FONT&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;FONT face=Arial size=2&gt;Click on a clip art tile to insert it in your Word document.&lt;/FONT&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;FONT face=Arial size=2&gt;Click File &amp;gt; Page Setup and set all your Margins to zero. (this is to ensure that the art is drawn starting at a 0,0 reference point for all the resulting paths.)&lt;/FONT&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;FONT face=Arial size=2&gt;Click File &amp;gt; Print then c&lt;/FONT&gt;&lt;FONT face=Arial size=2&gt;hoose the Windows Client Printer Driver&lt;/FONT&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;FONT face=Arial size=2&gt;Click the &amp;#8220;Properties&amp;#8220; button.&lt;/FONT&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;FONT face=Arial size=2&gt;Change "Output Format" to "Windows Client Markup File" (otherwise the output will be a .container file which wont let you get into the markup. Choosing Markup File will export a .XAML)&lt;/FONT&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;FONT face=Arial size=2&gt;Click "OK" to continue on to printing and specify a file name and destination. (c:\foo.xaml)&lt;/FONT&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;FONT face=Arial size=2&gt;Navigate to the file destination and there should be the foo.xaml file and a folder called "foo_files"&lt;/FONT&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;FONT face=Arial size=2&gt;Open "Page_1.xaml" in this folder with your XAML editor.&lt;/FONT&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;FONT face=Arial size=2&gt;All the Path elements in between the "FixedPage" elements are fair game. Copy and paste those into your app. I find it useful to wrap these elements in Canvas and set the dimensions of the Canvas to the same size as the clip art dimensions that are specified in Word. If you need different dimensions, you can resize the art in Word and export again using the printer driver. I also like to turn clip art into DrawingBrushes for easy reuse at multiple sizes.&lt;/FONT&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://www.windows-now.com/aggbug.aspx?PostID=3493" width="1" height="1"&gt;</description><category domain="http://www.windows-now.com/blogs/ndunlap/archive/tags/DrawingBrush/default.aspx">DrawingBrush</category><category domain="http://www.windows-now.com/blogs/ndunlap/archive/tags/Vectors/default.aspx">Vectors</category><category domain="http://www.windows-now.com/blogs/ndunlap/archive/tags/Images/default.aspx">Images</category></item><item><title>Hooray for WinHEC bits!</title><link>http://www.windows-now.com/blogs/ndunlap/archive/2004/05/07/3413.aspx</link><pubDate>Fri, 07 May 2004 19:07:00 GMT</pubDate><guid isPermaLink="false">20f58a17-7e15-440c-89b3-dfe02fe74bcd:3413</guid><dc:creator>ndunlap</dc:creator><slash:comments>28</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://www.windows-now.com/blogs/ndunlap/rsscomments.aspx?PostID=3413</wfw:commentRss><comments>http://www.windows-now.com/blogs/ndunlap/archive/2004/05/07/3413.aspx#comments</comments><description>&lt;P&gt;&lt;FONT face=Arial size=2&gt;Now that the SDK has been updated I can finally start posting on some of the really cool features that I have been playing with for the last couple of months. &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;I've got an article in the works that is an updated version of my GelButton that I posted earlier. Its not finished yet, but if you want to get a sneak peek you can see the source code and screen shots here. &lt;A href="http://www.longhornblogs.com/ndunlap/articles/3392.aspx"&gt;http://www.longhornblogs.com/ndunlap/articles/3392.aspx&lt;/A&gt;&amp;nbsp; It isn't a straight port of the original GelButton demo, but I have drastically reduced the complexity of how it was created using Grid. Also I have made the drop shadow and the shines on the button much more aesthetically pleasing using the Blur&amp;nbsp;ImageEffect.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;Now that the SDK is live here are some links I think are pretty exciting and interesting...&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;&lt;STRONG&gt;Grid &lt;BR&gt;&lt;/STRONG&gt;&lt;A href="http://longhorn.msdn.microsoft.com/lhsdk/ref/ns/system.windows.controls/c/grid/grid.aspx"&gt;&lt;STRONG&gt;http://longhorn.msdn.microsoft.com/lhsdk/ref/ns/system.windows.controls/c/grid/grid.aspx&lt;/STRONG&gt;&lt;/A&gt;&lt;BR&gt;&lt;A href="http://longhorn.msdn.microsoft.com/lhsdk/layout/overviews/grid_ovw.aspx"&gt;&lt;STRONG&gt;http://longhorn.msdn.microsoft.com/lhsdk/layout/overviews/grid_ovw.aspx&lt;/STRONG&gt;&lt;/A&gt;&lt;/FONT&gt;&lt;FONT face=Arial size=2&gt;&lt;BR&gt;This panel is awesome. I will admit I havent been using it enough to really feel like I have mastered its use but it really fixes the issues I blogged on earlier about not being able to do margin effects easily without doing the DockPanel.Dock=&amp;#8220;fill&amp;#8220; workaround. Grid allows you to apply NineGrid like slice and dice control on layouts that contain things other than image data. When I started using shape elements to create the visuals for my controls and applications layouts I immediately found myself wanting to have the same kind of control like I had with NineGrid. With the Grid panel I get that kind of control but I am not limited to a&amp;nbsp;nine cell configuration.&amp;nbsp;This is very cool and powerful and there are going to be some really exciting and creative designs enabled using this. I can't wait to see the different way people use this. &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;&lt;STRONG&gt;ImageEffects&lt;BR&gt;&lt;A href="http://longhorn.msdn.microsoft.com/lhsdk/ref/ns/system.windows.media/c/imageeffect/imageeffect.aspx"&gt;http://longhorn.msdn.microsoft.com/lhsdk/ref/ns/system.windows.media/c/imageeffect/imageeffect.aspx&lt;/A&gt;&lt;BR&gt;&lt;/STRONG&gt;So far the one I am using a lot is Blur. With blur&amp;nbsp;I can create some gorgeous drop shadows, on any kind of elment, text, shape, button, etc. My GelButton example is using it a lot. I've also got some cool laser effects I am doing with blur that I will be posting on.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;&lt;STRONG&gt;OpacityMasks&lt;BR&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;A href="http://longhorn.msdn.microsoft.com/lhsdk/graphicsmm/overviews/opacitymasking.aspx"&gt;&lt;FONT face=Arial size=2&gt;&lt;STRONG&gt;http://longhorn.msdn.microsoft.com/lhsdk/graphicsmm/overviews/opacitymasking.aspx&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/A&gt;&lt;BR&gt;&lt;FONT face=Arial size=2&gt;Another great toy for pulling off some sweet effects. You can use gradients, images, DrawingBrushes, etc to create your masks.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT face=Arial size=2&gt;3D&lt;BR&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;A href="http://longhorn.msdn.microsoft.com/lhsdk/graphicsmm/overviews/basic3d.aspx"&gt;&lt;STRONG&gt;&lt;FONT face=Arial size=2&gt;http://longhorn.msdn.microsoft.com/lhsdk/graphicsmm/overviews/basic3d.aspx&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/A&gt;&lt;BR&gt;&lt;FONT face=Arial size=2&gt;Need I say more? Ok I will.... This changes everything. No more hard line between creating 3D content and mixing it with 2D content. I had been asking for 2D perspective transform so I could pull off pseudo 3D effects...Real 3D is so much better! Try this sometime... create an app that has 3D elements that composite on top of 2D elements like a complex layout with text flowing in it. Then composite that on top of another 3D element and hey while your at it throw a video element at the very bottom of the stack so it has to render through all that stuff. Hmm maybe throw a video element on top and set some opacity on it. Maybe even put an opacity mask on the topmost video element. Then animate a bunch of stuff. Run it full screen.&amp;nbsp;&lt;/FONT&gt;&lt;FONT face=Arial size=2&gt;&amp;nbsp;Its definitely&amp;nbsp;a new world we are living in! I will get some posts with cool 3D samples up soon.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;&lt;STRONG&gt;DrawingBrush in resources...&lt;/STRONG&gt;&lt;BR&gt;One note for people that have read my earlier blogs about using DrawingBrush... There are some changes with how DrawingBrush works when it is used as a resource. If your app has DrawingBrushes defined as a resource you will need to do a work around for the app to still work. I will try to post simple code soon. In the meantime you can see how I got my DrawingBrush resources working in the LoginScreen Demo &lt;A href="http://longhorn.msdn.microsoft.com/lhsdk/sampledocs/sampleapplications/wcpsamp_demosample_loginscreen.aspx"&gt;http://longhorn.msdn.microsoft.com/lhsdk/sampledocs/sampleapplications/wcpsamp_demosample_loginscreen.aspx&lt;/A&gt;. Check out default.xaml.cs and look at the Init event. &lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;You can still &lt;FONT color=#000000&gt;use a DrawingBrush as a resource, just not as a resource before the application has loaded. Basically the first access to a DrawingBrush needs to happen before the DrawingBrush is used to render, so accessing it in the start up event causes the first access to occur before layout and render has happened. &lt;/FONT&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://www.windows-now.com/aggbug.aspx?PostID=3413" width="1" height="1"&gt;</description><category domain="http://www.windows-now.com/blogs/ndunlap/archive/tags/Resources/default.aspx">Resources</category><category domain="http://www.windows-now.com/blogs/ndunlap/archive/tags/DrawingBrush/default.aspx">DrawingBrush</category><category domain="http://www.windows-now.com/blogs/ndunlap/archive/tags/Vectors/default.aspx">Vectors</category><category domain="http://www.windows-now.com/blogs/ndunlap/archive/tags/Styles/default.aspx">Styles</category><category domain="http://www.windows-now.com/blogs/ndunlap/archive/tags/Layout/default.aspx">Layout</category></item><item><title>Creating vector icons with DrawingBrush</title><link>http://www.windows-now.com/blogs/ndunlap/archive/2003/12/15/1862.aspx</link><pubDate>Tue, 16 Dec 2003 00:13:00 GMT</pubDate><guid isPermaLink="false">20f58a17-7e15-440c-89b3-dfe02fe74bcd:1862</guid><dc:creator>ndunlap</dc:creator><slash:comments>4</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://www.windows-now.com/blogs/ndunlap/rsscomments.aspx?PostID=1862</wfw:commentRss><comments>http://www.windows-now.com/blogs/ndunlap/archive/2003/12/15/1862.aspx#comments</comments><description>&lt;P&gt;&lt;FONT face=Arial size=2&gt;OK, creating icons in today's world sucks... First I have to create multiple sizes of icons 16x, 24x, 32x 48x, 64x, etc.&amp;nbsp; Even when I go through all the&amp;nbsp;trouble of making sure I have all the different dimensions of the icons I need, I still run the risk of my icons being mangled when they show up on a monitor running a different DPI (with high dpi monitors on their way, this is becoming more and more of an issue).&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;Creating vector icons with DrawingBrush is a way that I get around the problems of needing multiple resolution and multiple dimension icons. DrawingBrush allows me to basically combine a bunch of vector shapes and then define them as a brush resource that I can paint the Fill, Background properties on elements. This is really convenient when I want to get the benefit of using vectors if I want my strokes and shapes to always proportionally scale and I don't mind if the vectors don't intelligently resize or if the strokes become distorted when stretching and scaling. This is typically the&amp;nbsp;behavior I expect&amp;nbsp;when I am using graphical elements like clipart and icons.&lt;/FONT&gt;&amp;nbsp; &lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;Here is what it looks like:&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size=2&gt;&amp;lt;Canvas&amp;gt;&lt;BR&gt;&amp;lt;Canvas.Resources&amp;gt;&lt;BR&gt;&amp;nbsp;&lt;FONT color=#006400&gt;&lt;STRONG&gt;&amp;lt;!-- Define the vector icon with a drawing brush --&amp;gt;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;DrawingBrush ViewBox="-5,-5,265,265" def:Name="Blue_Ball_Icon"&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;Drawing&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;PATH ... /&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;Ellipse .. /&amp;gt; &lt;BR&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;Rectangle ... /&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/Drawing&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;/DrawingBrush&amp;gt;&lt;BR&gt;&amp;lt;/Canvas.Resources&amp;gt;&lt;BR&gt;&lt;/FONT&gt;&lt;BR&gt;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" color=#006400 size=2&gt;&amp;lt;!--&amp;nbsp;Use the vector icon&amp;nbsp;--&amp;gt;&lt;BR&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size=2&gt;&amp;lt;Button Background="{Blue_Ball_Icon}" Width="16px" Height="16px" /&amp;gt;&lt;BR&gt;&amp;lt;Button Background="{Blue_Ball_Icon}" Width="160px" Height="160px" /&amp;gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;CANVAS&gt;&lt;FONT face=Arial color=#006400 size=2&gt;&lt;A href="http://www.dunlap.cc/lhblog/DrawingBrush/DrawingBrush.zip"&gt;&lt;STRONG&gt;Working example posted&amp;nbsp;here.&lt;/STRONG&gt;&lt;/A&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;The image below show is a snap shot of a DrawingBrush that is used for various sized icons. I kept the jpg low res for the web, but if you run the app linked below you will see that the fidelity on every one of the icons is excellent. The stretched image shows that you will distort your shapes and strokes, but you wont ever show any pixelation.&lt;BR&gt;&lt;/FONT&gt;&lt;IMG src="http://www.dunlap.cc/lhblog/drawingbrush/db.jpg"&gt; &lt;/P&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://www.windows-now.com/aggbug.aspx?PostID=1862" width="1" height="1"&gt;</description><category domain="http://www.windows-now.com/blogs/ndunlap/archive/tags/Resources/default.aspx">Resources</category><category domain="http://www.windows-now.com/blogs/ndunlap/archive/tags/DrawingBrush/default.aspx">DrawingBrush</category></item></channel></rss>