Blur Effect : Silverlight Windows Phone 8.1 - c#

I am writing windows phone 8.1 silverlight app,
I have a Stackpanel in my XAML page, I want to create its background "Blur".
Is there any way to do it?

There is no easy way to apply effects such as blur to elements. More typical would be to dim them by placing a partially transparent rectangle over the disabled element.
If you really want blur you would need to render the element to a bitmap, but the bitmap contents, and then place that image over the original element.

If you have an image as background you could add the blurred effect by modifying the image before setting it as background.
There's multiple libraries that allow you do to this eg. Win2D and Lumia Imaging SDK 2.0.
They are both fairly simple to work with and have pro's and con's.
Nokia Imaging SDK allows you to work directly with bitmaps / writeablebitmaps while Win2D has a more smooth blur rendering.
Here's a guide to how you can implement and work with both: http://www.blendrocks.com/code-blend/2015/1/29/implementing-image-blur-in-a-windows-universal-app

Related

Recolor image in Windows 10 Universal App C#

Working on an app and as part of it I need to recolour it to match the phones accent color.
What I have is a gray scale image with transparent sections and want to change it the colored.
The white sections will be the pure accent color
Gray sections will be the accent color faded
Black sections will be black
I've done this in the past, but never with a universal app.
Any help or suggestions would be great.
Thanks,
You can use Lumia Imaging SDK to apply some basic effects on your image.
If it doesn't fit your requirement. You can use Win2D to work on your picture. You can find a good example of Win2D by this link: Shawn's Terrific Universal App for photogRaph Tweaking.

Words in transparent PNG have jagged edges

I've built an app which uses transparent PNGs to display an overlay for users to tap using WPF and C#. However, there are weird jagged edges around the words. Would this be more of a C#/WPF limitation or a Photoshop issue?
Screen resolution is 720p. App runs on win7pro.
Screenshot:
Definitely a problem with the image itself. I see the same fringing when viewing the image against a black background on my phone. Make sure you compose the text over a transparent background (i.e., don't remove the background with a magic wand tool) and save with a full alpha channel (32-bit PNG).

Canvas to image in WinRT Code

In Win8 Metro apps i have a canvas it contains images and blocks and i want to save it to be displayed as an image using async, any idea with code?
Can't be done I'm afraid - WinRT has no way to save xaml to an image.
Your best bet would be to handcraft your own bitmap, but it's a lot of work.
Sorry, I could have done with this functionality to!

how to save Canvas as image in WINRT using c# [duplicate]

I am developing a paint like application in metro style with C#/XAML. I want to save whatever content is drawn on canvas as image. I have checked this solutions but it didn't helped me.
Save canvas to bitmap
http://blogs.msdn.com/b/saveenr/archive/2008/09/18/wpf-xaml-saving-a-window-or-canvas-as-a-png-bitmap.aspx
So how can I save the canvas content as image ? Please help me with sample coding.
The accepted answer from Sascha is no longer true for Windows 8.1. There is a new RenderTargetBitmap class that allows Rendered XAML to be converted to a bitmap.
See: http://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.xaml.media.imaging.rendertargetbitmap.aspx
However I can't seem to render that XAML is Collapsed or otherwise not currently on screen. Any help with that would be appreciated!
It seems it is currently not supported out of the box like we were used to do it with WPF:
http://social.msdn.microsoft.com/Forums/en-US/winappswithcsharp/thread/dd66c749-efed-4b55-a716-e0aa3a637d28
While when doing HTML5/Javascript Metro apps you can do this:
http://social.msdn.microsoft.com/Forums/en-US/winappswithhtml5/thread/cf8c17dc-68d4-4777-951f-bb7f0665bd06
The standard approach in other xaml frameworks such as Silverlight and WP7 was to use WriteableBitmap, however the version in WinRT doesn't have a constructor that takes a xaml element which leads me to believe that it's currently impossible against the latest API.
Sorry I couldn't be more help/
One workaround is to use Direct2D with DirectWrite. It is a bit involved, but I might make a library available at some point.

Windows 8 Metro App - Render PNGs

I am needing to render some custom PNGs in a Windows 8 app.
Basically I need to create a custom live tile by putting some drawings made in my app on top of an image for a live tile, and the only way to do this is render a PNG to disk, see here.
What library should I use to do this? My first thought was to use a Xaml UserControl and RenderTargetBitmap, but it is not available in a Metro app.
WinRT XAML Toolkit has some extension methods for WriteableBitmap that you could use too. You could probably use WriteableBitmapLoadExtensions for loading and WriteableBitmapSaveExtensions for saving. It has a fairly limited blitting capability though since that is exposed by WriteableBitmapEx already and simple to write anyway. WriteableBitmapBlitBlockExtensions is only a method to blit a full width block of pixels from bitmaps of same width.
Edit* RenderTargetBitmap is now available in Windows 8.1. It doesn't support some elements though (I think it doesn't render camera previews, media elements and perhaps WebViews).
Currently the only option is to use DirectX (or SharpDX) to create your image. You'll probably have to recreate the drawing using the low-level DirectX APIs.
WritableBitmapEx might also be helpful if your drawings are simple.

Categories