microsoft / Lumia-Imaging-SDK-Extras

Extra functionality and sample code for the Lumia Imaging SDK
MIT License
25 stars 21 forks source link

Lumia Imaging SDK Extras

This repository contains extra functionality and sample code for the Lumia Imaging SDK.

The code is provided under the MIT license, and can therefore be conveniently used and modified.

Parts contained will typically target the latest released version of the Lumia Imaging SDK, unless otherwise marked.

Philosophy


Managed (C#/.NET)

Layer system

Folder: Managed/Lumia.Imaging.Extras.Layers/

Allows to describe image processing as a list of layers, like the familiar representation found in photo editing apps.

After configuring the layers, an IImageProvider endpoint can be easily retrieved and rendered.

Features

Image sources/effects

Folder: Managed/Lumia.Imaging.Extras.ImageProviders/

NoiseImageSource

A noise generator image source. Internally uses a ColorImageSource and a NoiseFilter.

HighpassEffect

A "highpass" effect, similar to familiar ones in photo editing apps. Uses EffectGroupAdapter to form an "effect group".

RepeatedTileImageSource

A source generator that repeats a given tile in both x and y directions until it reaches the desired size. For example it can be used to create seamlessly repeating backgrounds such as seen in some games.

DepthofField

A set of high-level scenarios showing how to set up a "DoF" effect.

HslAdjustmentEffect

Example of an effect that does higher level HSL adjustments, similar to familiar ones in photo editing apps. Allows adjustments of saturation and lightness around Master, Red, Green, Blue, Cyan, Magenta and Yellow channels.

Utility code

Folder: Managed/Lumia.Imaging.Extras.Utility/

DotVisualizationExtensions

ImageProviderExtensions

BitmapExtensions

BufferExtensions

MaybeTask<T>

Value type that either holds a result or a task-of-result. This helps interactive app scenarios, keeping GC activity in check when dealing with mixed sync/async operations, as otherwise each new Task causes a heap allocation.


Native (C++ with WRL and C++/CX)

Support code and samples for writing custom Lumia Imaging SDK components in native code (WRL and C++/CX).

Headers and IDL files

Folder: Native/Include/

Generated IDL and .h files for the Lumia Imaging SDK. These make it possible to use the Imaging SDK in various lower-level WRL and interop scenarios.

These were generated with the winmdidl tool (from the Windows SDK) and then also postprocessed to remove some quirks present in C++/CX .winmd files. The generation scripts may also be published but they're not yet available.

For now, the namespaces from Lumia.Imaging.winmd are covered. The intention is to keep updating this with files matching the latest released SDK.

Custom filter helpers

Folder: Native/CustomFilter/

Makes it easier to write custom block-based filters in both standard C++ with WRL and in C++/CX. The API is similar to CustomFilterBase in Lumia.Imaging.Managed.

Custom effect helpers

Folder: Native/CustomEffect/ (C++/CX only, WRL version not yet available)

Makes it easier to write custom bitmap-based effects in both standard C++ with WRL and in C++/CX. The API is similar to CustomEffectBase in Lumia.Imaging.Managed.

Custom image source helpers

Folder: Native/CustomImageSource/ (not yet available)

Makes it easier to write custom bitmap-based image sources in both standard C++ with WRL and in C++/CX. The API is similar to CustomImageSourceBase in Lumia.Imaging.Managed.

Effect group helpers

Folder: Native/EffectGroup/ (C++/CX only, WRL version not yet available)

Makes it easier to write effect groups in both standard C++ with WRL and in C++/CX. The API is similar to EffectGroupBase in Lumia.Imaging.Managed.

Samples

Folder: (C++/CX) Native/Samples/CustomCx/ / (WRL) Native/Samples/CustomWRL/

Sample library projects showing how to package custom filters/effects/effect groups for use in universal apps (Windows 8.1, Windows Phone 8.1).

EmptyCustomFilter: WRL and C++/CX versions of an example custom filter that passes through the image unchanged.

RgbGainCustomFilter: WRL and C++/CX versions of an example custom filter that has parameters and does something interesting.

EmptyCustomEffect: C++/CX version of an example custom effect that passes through the image unchanged.

EmptyEffectGroup: C++/CX version of an example effect group that has no inner effects.

HighpassEffectGroup: C++/CX version of an example effect group that is a native version of the managed HighpassEffect.

Unit tests

All tests are available in the sample solution: "Lumia Imaging SDK Extras.sln".

There are two test projects:

You may want to right-click and do "Unload Project" on the one you don't want to run, as otherwise they are hard to distinguish in the Test Explorer in Visual Studio.