Use Paint.NET to Create a Lake

by Bobbi Perreault 16. January 2009 20:05
Share on Facebook

Paint.NET is free software for digital photo editing.  I use it for 85% of my bitmap image processing needs - about the only time I switch to Photoshop is when I need to remove backgrounds because the Polygonal lasso tool makes it so easy. 

I had some fun this morning by putting a lake where none existed.  I started with a picture of FlatIrons that was taken by me when I worked in Longmont. 

I first increased the size of my canvas by adding 120 or so pixels onto the bottom. (Ctrl-R, or Image-Resize)

I used the Rectangle Select tool to select the mountain piece, then Ctrl-C to copy it.  Ctrl-Shift-V pastes my selection into a new layer.

From the Layers menu, select "Flip Vertical" and this will turn it upside down.  Then I type 'M' to get the 'Move Selected Pixels' tool, and move the flipped layer down to the bottom of my canvas.  This lines up the old bottom of the picture with a flipped copy of it's self.

 

 

Keep this layer selected. 

Use the Effects-Noise-Add Noise menu item to litter up the selection with a bunch of white specs.

Use the Effects-Blur-Motion Blur menu item to make the water 'wavy' - Do that by setting the angle to 180 and extending the blur to lengthen the lines.  Keep this selection active.

Once again, copy then paste into a new layer. 

Set the layer properties to Transparency of 70.  (F4 to access, or Layers-Properties)

Keeping this area selected, bump up the contrast to lighten this layer.

 

Move your layer selection back down to the first layer, the original picture - but keep your 'water' selection active.  Copy once again.

Move your layer selection up to the layer that is lightened and made transparent.  Then once again, paste your clipboard into a new layer.

For this third layer - once again set the transparency to 90.  This time use the Contrast tool (Ctrl-Shift-C, or Adjustments-Brightness/Contrast) to Darken the layer.

Now here's the fun piece.  Grab the Lasso select tool and with your mouse down for the whole time - drag your cursor back and forth and back and forth in a wave pattern across the darkened layer you just added.  Keep the lines you're drawing very skinny at the top of your "water" and far apart.  By the time you get to the bottom of your "water" your polygons should be wider - but closer to each other - think wave.

When you've filled the water with your lines, let up the mouse this will select portions of the transparent darker layer.  DELETE your selection.  And magic waves appear.

Here's a link to the final product - I like it for the background of my Twitter page.

NEXT - I'm going to take my waves into Expression Design.  These guys are going to ripple across the screen in the background of my new toy web site, Dont Call Me Late For Supper.

 

ReMix, a new API from Best Buy

by Bobbi Perreault 11. January 2009 13:17
Share on Facebook

When I heard of this API of Best Buy's fom the Minnov8 Gang's podcast,  Mashup Best Buy, I thought I just had to give it a try.  I got an API key at that time, but it took me four long months try it out.  (Let's not talk about time management - not a good subject for me.)

I found it very simple to use, if a bit limited in functionality.  (For example, you can't pull a list of categories from the API, but you can query the products by category once you have that information) 

I wanted to try this in a Silverlight application.  I decided to structure the application so as to keep my API key as part of the server app, so the requests back to the API are done by my web server - not the Silverlight app.

Getting data back from the Best Buy servers is all done with REST requests, like this:

http://api.remix.bestbuy.com/v1/products?sort=name.desc&apiKey=YOURKEYHERE

http://remix.bestbuy.com/docs/types/Products

http://api.remix.bestbuy.com/v1/products(manufacturer='canon'&salePrice%3C33)?apiKey=YOURKEYHERE

http://api.remix.bestbuy.com/v1/products(categoryPath.name='audio'&salePrice%3C33)?apiKey=YOURKEYHERE

http://api.remix.bestbuy.com/v1/products(categoryPath.name=' Blu-ray & DVD Players ')?apiKey=YOURKEYHERE

I couldn't find documentation on what parameters you can pass, but when you send an invalid request ( an incorrect name= value), you receive back all the valid attributes in the error message.  So that was fine.

This silverlight ReMix demo application is written using the Silverlight Islands method of putting together a web app with Silverlight sprinkled through it.  That would be for SEO if this were going to be a real site.  I've written about the Islands method before, you can refer here, and here.

 Source Code (only SL app, not server side.) here   and you need this:  Wrap Panel

Anyway, have fun.  Here's how you can get your own API key to play with this great new source of content for the web.  http://remix.bestbuy.com/

 

Working with Docx using Silverlight and WPF - XBAP

by Bobbi Perreault 4. January 2009 04:34
Share on Facebooksmiley-sm

In exploring the possibility of using Silverlight to write an editor for Word documents, I learned a few things that may or may not be obvious to my smarter programming friends out there.

In any case, for what it's worth, here are some links, advice, and lessons learned from a weekend of knocking my head against the wall.

To begin with, the problem statement (as stated to me by my client): "We need to be able to edit a Word document (Office 2007 to be exact), track any changes made to the document, and display the document back to the user with the changes modified.  And we want to do this with Silverlight."

I started by searching the web for contributions by others.  I found quite a lot of great information to get me started.  My initial conclusion was that Silverlight, while a wonderful tool, was not the BEST tool for this job.  Further conversations with the client assured me that the only platform requiring support was Windows.  This said XBAP would be a better place to start since WPF has FlowDocument.

NOTE:  XBAP OpenFlowDocumentExtensions - will not work with an XBAP application because it requires full trust.  So just don't even try them together.  Unfortunately, this makes the job immensely more difficult.  Same goes for multi-window XBAP.

My Getting Started Links.

  (Don't worry, if you're short on TIME, skip to the end, where my conclusions and sample code are) 

Whether you decide to go with WPF or a combination of Html and Silverlight, I found examples of how to parse DOCX / OpenXML using XSLT, how to parse using LINQ, and also links to Microsoft’s SDK for working with DOCX / OpenXML . There is much information available.

DOWNLOAD http://www.microsoft.com/downloads/details.aspx?FamilyID=ad0b72fb-4a1d-4c52-bdb5-7dd7e816d046&DisplayLang=en:  THIS IS OPENXML TECHNOLOGY PREVIEW, read and write openxml documents.

this blog entry has example code to import word xml into wpf.:  http://blogs.microsoft.co.il/blogs/tamir/archive/2008/04/22/wordml-to-flowdocument-how-to-convert-docx-files-to-wpf-flowdocument.aspx

this blog entry has example code to import word xml into html page.  uses IHttpHandler too.:  http://blog.maartenballiauw.be/post/2008/01/Preview-Word-files-(docx)-in-HTML-using-ASPNET-OpenXML-and-LINQ-to-XML.aspx

Rendering WordML documents in ASP.NET:  Posted by: Signs on the Sand, on 01 May 2006 | View original

eXml

http://www.codeproject.com/KB/WPF/OpenFlowDoc.aspx:  Parsing an OpenXML Document using XLINQ

http://www.emxsoftware.com/LINQ/ParsingWordMLusingXLinq:  More on parsing OpenXML with XLINQ

http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/2b7720c2-0a14-43f0-8931-d91ef87d0cda/:  Advice on parsing XML for WPF

http://openxmldeveloper.org/articles/OpenXMLDocFromDotNetWebVersion.aspx: Create WordXML without Word

TextGlow - too bad this wasn't working for me when I visited. 

http://www.openxml.biz/OpenXMLWriter.html:  OpenXMLWriter

http://conceptdev.blogspot.com/2007/03/open-docx-using-c-to-extract-text-for.html : CSharp to extract WordML

http://www.codeproject.com/KB/office/ExtractTextFromDOCXs.aspx: DOCX to Text

http://blogs.msdn.com/karstenj/archive/2007/01/11/the-definitive-post-on-xbap-trust-levels.aspx: The Definitive Post on XBAP trust levels.

http://blogs.msdn.com/akshayns/archive/2007/05/02/clickonce-deployment.aspx: ClickOnce deployment and Trust

http://dedjo.blogspot.com/2008/04/wordml-to-flowdocument-how-to-convert.html:WordML to Flow Document.

http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/c2f23026-1e7a-4efa-8bab-2479f404634d/: Images in FlowDocument

http://www.charlespetzold.com/blog/2006/01/180334.html: Tables in RichText

Conclusions:

Up front:  Tables are not supported in any of the online examples we encountered.  If your documents for WPF or silverlight contain tables then you have a LOT of work to do to complete that piece.  I found this part extremely complicated and time consuming to implement and so in other words, it didn't get done.

The final project used OpenFlowDocumentExtensions which is a project I used to display the docx file. And I used it to feed the docx file to the Writer class

And there's some work done in the linked project for comparing original Docx to Modified Docx.

Here's a link to the DocxEditor project I was working on, when I gave up because tables are so darn hard.  Maybe it'll help someone out there - It's basically a lot of pieces of other people's work, but I spent four days to get to this point so I hope it helps someone.

 

Tags: , ,

How To

 

RSS Feed FriendFeed