Toan Huynh Technical Evangelist Imaging on Windows Phone
May 13, 2015
Toan Huynh
Technical Evangelist
Imaging on
Windows Phone
Windows Phone 8 – Imaging on Windows Phone
8/14/2013Microsoft confidential2
• Lenses
• Nokia Imaging SDK
• Windows Phone Photo Extensibility
8/14/2013Microsoft confidential3
Lenses
Creating a Lens
• A Lens is a custom camera application which can be
accessed from within the camera application
• An application is flagged as a Lens application by
setting a flag in the manifest and providing icons
that can be used to browse for the Lens when the
camera is in use
• I’ve created a FunkyCamera lens application which I
have registered in this way
4
Creating a Lens application
• This text must be added to the WMAppManifest.xml file for the application, just after the
<Tokens> section
• There is no GUI for this alteration, you have to edit the XML directly
<Extensions><Extension ExtensionName="Camera_Capture_App"ConsumerID="{5B04B775-356B-4AA0-AAF8-6491FFEA5631}"TaskID="_default" />
</Extensions>
Adding the Lens Icons
• Three Icons are required, one for each Windows Phone screen size
• WVGA 173 × 173 Assets\Lens.Screen-WVGA.png
• 720p 259 × 259 Assets\Lens.Screen-720p.png
• WXGA 277 × 277 Assets\Lens.Screen-WXGA.png
• They are all placed in the Assets folder of the application
• Use a transparent background to match the Windows Phone color scheme
8/14/20136
(add shader example)
• Three Icons are required, one for each Windows Phone screen size
• WVGA 173 × 173 Assets\Lens.Screen-WVGA.png
• 720p 259 × 259 Assets\Lens.Screen-720p.png
• WXGA 277 × 277 Assets\Lens.Screen-WXGA.png
• They are all placed in the Assets folder of the application
• Use a transparent background to match the Windows Phone color scheme
8/14/20137
• You can also create an application that has an auto-upload behaviour for pictures that the
user may take
• The upload behaviour is a “resource intensive” background task
• The application must set the extension shown above and display a settings page where the
user can set authentication and upload options
• This is a background process and therefore might not get to run
Creating an Auto-Uploader for photos
<Extensions><Extension ExtensionName="Photos_Auto_Upload"ConsumerID="{5B04B775-356B-4AA0-AAF8-6491FFEA5632}"TaskID="_default" />
</Extensions>
8/14/2013Microsoft confidential9
Nokia Imaging
SDK
Nokia Imaging SDK
• Early Beta version, makes some of the technologies that Nokia uses in its own imaging
applications available to developers
• Provides more than 50 pre-made filters and effects that have been specifically developed
for mobile imaging, with speed and memory performance as key drivers
• The SDK is super-fast, meticulous memory and code optimization
• Allows access to any image data without decoding the whole image
• Apply effects to high resolution images, without worrying about memory budget
10
Easy to use
• Add a filter to your existing project with just a few lines of C#.
• Support to be called from C++ code.
• The filters can be chained to create more effects
11
Core concepts
• Provided as a Windows Phone Runtime library
• One of the key benefits of this is that developers can call the methods of the library from
C#, Visual Basic, or C++.
12
1.An editing-session is created from an image.2.One or several filters and effects are added to the session.3.The editing-session is rendered into a bitmap or into a memory buffer.4.Steps 2 and 3 are repeated if needed.5.The editing-session is closed.
Editing-session code
using Nokia.Graphics.Imaging;
using (EditingSession editsession = new EditingSession(inputBuffer))
{
// First add an antique effect
editsession.AddFilter( FilterFactory.CreateAntiqueFilter());
// Then rotate the image
editsession.AddFilter(
FilterFactory.CreateFreeRotationFilter(35.0f, RotationScaleMode.FitInside) );
// Add more filters here if you want... // Finally, execute the filtering and render to a bitmap await
editsession.RenderToBitmapAsync(outputBuffer);
}
The libraries
• Before starting to use the functionality provided by the Nokia Imaging SDK, the SDK
libraries must be added to the project.
• Two ways to add the libraries are proposed:
• Using the Visual Studio NuGet package manager
• Adding references to the project. For detailed instructions
8/14/201314
The libraries (Cont.)
8/14/201315
The information herein is for informational
purposes only an represents the current view of
Microsoft Corporation as of the date of this
presentation. Because Microsoft must respond
to changing market conditions, it should not be
interpreted to be a commitment on the part of
Microsoft, and Microsoft cannot guarantee the
accuracy of any information provided after the
date of this presentation.
© 2012 Microsoft Corporation.
All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.
MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION
IN THIS PRESENTATION.