Share via


PhotoFun

Version: 1.0.0

Description

This hands-on-lab walks you through the new camera APIs in the Windows Phone "Mango" release. You will learn how to capture and preview the live camera stream, integrate with the hardware buttons, and even how to apply effects to the live stream.

Overview

Per the common chassis specification required by Microsoft, all Windows Phone devices must have a 5 MegaPixel camera (or better). In the Windows Phone 7.0 release, the only way for an application to interact programmatically with the camera was to use the CameraCaptureTask chooser. An application could use this chooser to take a snapshot with the built-in camera application

The new Windows Phone Codenamed “Mango” release allows for much better integration with the camera. There is a new Microsoft.Devices.PhotoCamera class that provides fine-grained control of the camera and enables your application to get direct access to the camera’s controls and the raw frames.

This lab shows how easy it is to leverage the PhotoCamera API to capture the live camera feed and manipulate it while still providing a preview to the user. The lab also shows how to access some of the other camera controls, including the camera button.

Objectives

This lab will show you how to:

  • Write an application that can capture a live camera feed and display the preview on the screen
  • Take pictures with the camera and save them to the device’s media library
  • Perform intensive image processing operations on a separate thread to avoid blocking the UI

Prerequisites

The following prerequisites will help you gain the most from this hands-on lab:

  • Microsoft Visual Studio 2010 or Microsoft Visual C# Express 2010, and the Windows® Phone Developer Tools available at https://go.microsoft.com/?linkid=9772716
  • Prior knowledge of how to develop Windows® Phone applications (If you are new to Windows® Phone 7 development, begin by reading https://msdn.microsoft.com/en-us/gg266499. This lab assumes you understand the basics and focuses on camera integration.)

Lab Structure

This lab includes a single exercise with the following tasks:

  1. Capture and display the live camera feed and take pictures with the camera.
  2. Perform intensive image processing operations on a separate thread.

Estimated completion time

Completing this lab should take between 15 to 30 minutes.