1 out of 2 rated this helpful - Rate this topic

PhotoCamera Class

Windows Phone

March 22, 2012

Provides the basic camera functionality for a Windows Phone still camera application. This class includes members for enabling and configuring functionality such as image capture, focus, resolution, and flash mode. Also, it provides events for camera focus, image capture, and image availability.

System.Object
  Microsoft.Devices.Camera
    Microsoft.Devices.PhotoCamera

Namespace:  Microsoft.Devices
Assembly:  Microsoft.Phone (in Microsoft.Phone.dll)
XMLNS for XAML: Not mapped to an xmlns.
public sealed class PhotoCamera : Camera
<PhotoCamera .../>

The PhotoCamera type exposes the following members.

  Name Description
Public method PhotoCamera() Initializes a new instance of the PhotoCamera class.
Public method PhotoCamera(CameraType) Initializes a new instance of the PhotoCamera class for the specified type of camera.
Top
  Name Description
Public property AvailableResolutions Queries the camera for the available resolutions. (Inherited from Camera.)
Public property CameraType Gets the type of camera that the Camera object represents; indicates the location of the camera on the device. (Inherited from Camera.)
Public property FlashMode Gets or sets the flash mode. Unsupported flash modes silently default to Off.
Protected property InternalLock This member is for internal use only. (Inherited from Camera.)
Public property IsFocusAtPointSupported Specifies whether the camera can programmatically auto focus on a specific point in the viewfinder.
Public property IsFocusSupported Specifies whether the camera can be auto-focused programmatically.
Public property Orientation Gets the number of degrees that the viewfinder brush needs to be rotated clockwise to align with the camera sensor. (Inherited from Camera.)
Public property PreviewResolution Gets the current resolution of the image provided by the PhotoCameraGetPreviewBuffer methods. This method is for use by the live viewfinder. (Inherited from Camera.)
Public property Resolution Gets or sets the resolution of the image captured by the camera. (Inherited from Camera.)
Protected property SequenceNumber This member is for internal use only. (Inherited from Camera.)
Public property YCbCrPixelLayout Gets the YCbCr pixel layout of the camera preview buffer.
Top
  Name Description
Public method CancelFocus Cancels the current focus operation.
Public method CaptureImage Initiates a full-resolution capture of the current image displayed in the viewfinder.
Public method Dispose Disposes of the image source stream and frees resources used by the Camera object. (Inherited from Camera.)
Public method Equals (Inherited from Object.)
Protected method Finalize Releases unmanaged resources and performs other cleanup operations before the Camera object is reclaimed by garbage collection. (Inherited from Camera.)
Public method Focus Starts a camera auto focus operation.
Public method FocusAtPoint Starts a camera auto focus operation on a specific point in the viewfinder, for those devices that support it.
Public method GetHashCode (Inherited from Object.)
Public method GetPreviewBufferArgb32 Copies the current viewfinder ARGB frame into a buffer for further manipulation.
Public method GetPreviewBufferY Copies the luminance data for the current viewfinder frame into a buffer for further manipulation.
Public method GetPreviewBufferYCbCr Copies the current viewfinder frame into a buffer for further manipulation.
Public method GetType (Inherited from Object.)
Protected method InvokeAndRemapExceptions This member is for internal use only. (Inherited from Camera.)
Public method IsFlashModeSupported Determines whether a particular flash mode is supported on the device.
Protected method MemberwiseClone (Inherited from Object.)
Protected method SafeFireEvent(EventHandler) This member is for internal use only. (Inherited from Camera.)
Protected method SafeFireEvent<T>(EventHandler<T>, T) This member is for internal use only. (Inherited from Camera.)
Public method ToString (Inherited from Object.)
Top
  Name Description
Public event AutoFocusCompleted Occurs after the focus operation is complete.
Public event CaptureCompleted Occurs when the capture sequence is complete.
Public event CaptureImageAvailable Occurs when an image is available.
Public event CaptureStarted Occurs when the capture sequence has started.
Public event CaptureThumbnailAvailable Occurs when a thumbnail image is available.
Public event Initialized Occurs when the camera object has been initialized. (Inherited from Camera.)
Top

To account for the Windows Phone execution model, initialize the PhotoCamera object in the OnNavigatedTo(NavigationEventArgs) method and explicitly call the camera Dispose method during the OnNavigatingFrom(NavigatingCancelEventArgs) method. Add event handlers for PhotoCamera and CameraButtons events in the OnNavigatedTo(NavigationEventArgs) method and remove them in the OnNavigatingFrom(NavigatingCancelEventArgs) method.

For examples and more information about how to implement these members, see How to: Create a Base Camera Application for Windows Phone.

Note Note:

multiple devices If photo capture is not a core feature of your application, consider using the Camera Capture Task to capture photos instead of using the camera APIs directly. Memory allocated for the Camera Capture Task does not count toward total application memory use. This helps minimize your application’s memory use, which is particularly important when your application runs on a 256-MB device. For more information, see Developing for 256-MB Devices and How to: Use the Camera Capture Task for Windows Phone.

Windows Phone OS

Supported in: 7.1

Windows Phone

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Did you find this helpful?
(1500 characters remaining)