timberland hats ComDayBe Image manipulation in Windows 8 metro app

timberland splitrock ComDayBe Image manipulation in Windows 8 metro app

During this session I presented some technical items on how to make your Windows 8 app more attractive Because of the fact that we currently only shared the slide deck, I’ll be putting up some small blog posts with code references so you can use these inside your own app as well!Our Community app presents a list of events that contain sessions. Such a session can be given by one speaker or more speakers. What we wanted to achieve was to let the user of our app directly see the image(s) of the speaker(s) when he looks at the session list. But the trick here is that because of the use of XAML templates we only have one Image control inside our session list with a given Width and Height. So we need to transform the given images so that they will fit. The effect we are after is this, one speaker = one large image, more speakers = smaller images inside one large one:Now how do you do this well it’s very easy and this thanks to the WriteableBitmapEx lib available on codeplex or through NuGet. With these extensions you can manipulate your images.So when you added a reference to the WriteableBitmapEx, you’ll only need a WriteableBitmap inside your code and you are set! What we do in our app, if the session is only given by one speaker we will just be downloading the image from the web ourselves and return it to the image control.Downloading images from the web is done by using the FromStream extension.if you get version 1.0.2.0 of the WriteableBitmapEx, you don need to change the source code,
timberland hats ComDayBe Image manipulation in Windows 8 metro app
because as of that version the problem has been fixed!But befor we continue, do note that the current code base of the FromStream method swaps Red en Blue colour channels! The effect you’ll get are speaker images that look a lot like Navi people from Avatar .To do this kind of manipulation we use the Blit method. The Blit method is used on the Target image and you’ll have to give it a set of 4 parameters. The first one is a rectangle indicating where in the new Target image you will be placing the Original image. But the neat thing here is, that by setting this first rectangle parameter you can also in one go resize the Original image! The second parameter is the actual Original image itself. And the third parameter is a source rectangle, also here a neat thing, you can if you want only take out a part of the original image! But we use the complete image The last parameter is a BlendMode and this is set to Additive.
timberland hats ComDayBe Image manipulation in Windows 8 metro app