Chapter 20. Extending the Windows Phone Picture Viewer

,

In This Chapter

Image Photo Extras applications

Image Reading images using the XNA MediaLibrary class

Image Saving images to the Pictures Hub

Image Processing image pixels

Image Photo Share applications

Image Uploading an image to a custom WCF service


The Windows Phone photo experience is a key aspect of the phone OS. These days, just about everyone who uses a smartphone wants to be able to alter and share photos with friends and family via social networks.

The Windows Phone picture viewer app displays local or online photos in a consistent way. You can reach the picture viewer on a Windows Phone by navigating to the Windows Phone Pictures Hub and then selecting any image. The picture viewer’s menu is activated by tapping the three dots at the bottom of the page.

Whereas most of the built-in Windows Phone apps do not offer points of extensibility, the built-in picture viewer app is one exception.

With the picture viewer, it is possible to give users the capability to launch your app directly from the picture viewer itself, to provide extended image-processing capabilities, or to send an image to a third-party cloud service.

The picture viewer provides two extensibility points: photo extras applications and photo share applications.

Photo extras application extensibility allows you to integrate your photo altering app with the OS, giving users the capability to launch your app from the picture viewer, alter a photo, and save it back to the phone’s picture library.

Photo share application extensibility allows you to integrate your photo upload app into the picture viewer application, giving users the capability to upload an image to a third-party service via your app.

This chapter begins by looking at photo Extras applications. You see how to add an app to the picture viewer’s Extras menu and how to create an Extras application that traces the edges within an image and allows the user to save the image back to the phone’s picture library.

Finally, this chapter looks at photo Share applications. You learn how to add an app to the picture viewer’s Share menu and how to create a photo Share application that uploads images to a custom WCF service.

For developing Windows Phone apps, we are fortunate to have a number of technologies at our disposal. In Chapter 7, “Employing Media and Web Elements,” you saw how an XNA API was used to play sound effects efficiently. In this chapter, you see how some of the picture and media capabilities are, again, provided by XNA APIs.


Note

Windows Phone supports either 16 or 32bpp (bits per pixel). By default Windows Phone apps use 16bpp, which can cause some images to appear to be of low quality. Gradients in particular are most subject to the apparent effects of low pixel density, and when using 16bpp, banding may be detected in some images.

To use 32bpp in your app, modify its WMAppManifest.xml file by adding a BitsPerPixel attribute to the App element, as shown in the following excerpt:

<App ...
    BitsPerPixel="32">
</App>

Be aware that using 32bpp may impact the performance of your app, especially if you are rendering a lot of images in a list, for example. Where possible, apply dithering as preprocessing to image assets instead.


..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.189.188.36